OpenFDA NDC Directory¶
Queries the OpenFDA National Drug Code (NDC) Directory for drug product information. You can search or count results by common drug attributes (e.g., brand name, generic name, dosage form, route, active ingredients) with optional exact matching. Returns result records and request metadata as JSON strings.

Usage¶
Use this node to look up drug products in the NDC Directory by specific attributes or to count matches. Typical workflow: set a field (e.g., brand name), provide a value (e.g., "aspirin"), choose search or count, and optionally enable exact match. The node outputs JSON stringified results and metadata that you can pass to downstream nodes for parsing, display, or further analysis.
Inputs¶
| Field | Required | Type | Description | Example |
|---|---|---|---|---|
| field_value | True | STRING | The value to match against the selected field (e.g., a brand or generic name). | aspirin |
| field | True | CHOICE | Which NDC attribute to query. Options map to OpenFDA fields. | brand name |
| action | True | CHOICE | Select 'search' to retrieve matching records or 'count' to retrieve counts grouped by the selected field/value. | search |
| exact_match | True | BOOLEAN | When true, performs exact matching on the selected field. | false |
| limit | True | INT | Maximum number of results to return. Minimum is 1. | 10 |
Outputs¶
| Field | Type | Description | Example |
|---|---|---|---|
| results | STRING | JSON string of the OpenFDA API 'results' array matching the query. | [{"product_ndc": "12345-6789", "brand_name": "ASPIRIN", ...}] |
| metadata | STRING | JSON string of the OpenFDA API 'meta' response including query info and result count. | {"disclaimer": "...", "results": {"skip": 0, "limit": 10, "total": 123}} |
Important Notes¶
- Field options and mappings: Available field choices include 'active ingredient name' (active_ingredients.name), 'active ingredient strength' (active_ingredients.strength), 'brand name' (brand_name), 'generic name' (generic_name), 'dosage form' (dosage_form), 'route' (route), and 'packaging description' (packaging.description).
- Exact matching behavior: When exact_match is true, the node queries the '.exact' variant of the selected field.
- Endpoint: Queries the OpenFDA NDC endpoint (/drug/ndc.json).
- Output format: Both outputs are JSON strings. Parse them if you need structured objects downstream.
- Minimum limit: limit must be at least 1.
- Error handling: On errors, the node returns stringified JSON with an 'error' field (e.g., {"error": "Network error"}).
Troubleshooting¶
- No results returned: Try disabling exact_match, verify the field/value combination, or increase the limit.
- Received an error JSON: Check network connectivity and retry. The node returns {"error": "Network error"}, {"error": "JSON decode error"}, or {"error": "Unknown error"} on failures.
- Unexpected counts or results: Ensure the correct field is selected for your query context and that the field_value reflects the expected formatting (e.g., ingredient name vs. strength).
- Downstream parsing issues: Remember outputs are JSON strings. Parse them before attempting to access fields.