Skip to content

OpenFDA NDC Directory

Queries the OpenFDA NDC (National Drug Code) Directory API to retrieve product information such as brand name, generic name, dosage form, route, packaging, and active ingredient details. Returns results and metadata as JSON strings. Supports both search and count actions with optional exact matching.
Preview

Usage

Use this node when you need to look up drug products in the FDA’s NDC Directory by fields like brand name, generic name, or active ingredients. Commonly placed early in a workflow to fetch regulatory product data that can then be parsed, filtered, or displayed downstream.

Inputs

FieldRequiredTypeDescriptionExample
field_valueTrueSTRINGThe value to query for in the selected field.aspirin
fieldTrueCHOICEWhich NDC Directory field to search. Options map to specific OpenFDA fields.brand name
actionTrueCHOICESelect 'search' to return matching records or 'count' to return aggregation counts for the selected field.search
exact_matchTrueBOOLEANIf true, performs an exact match query on the selected field.false
limitTrueINTMaximum number of results to return. Minimum value is 1.3

Outputs

FieldTypeDescriptionExample
resultsSTRINGJSON string of the OpenFDA API 'results' array matching the query or count output.[{"brand_name": "ASPIRIN", "generic_name": "ASPIRIN", "dosage_form": "TABLET"}]
metadataSTRINGJSON string of the OpenFDA API 'meta' object, including information like result count and request details.{"disclaimer": "...", "results": {"skip": 0, "limit": 3, "total": 120}}

Important Notes

  • Field options: "active ingredient name", "active ingredient strength", "brand name", "generic name", "dosage form", "route", "packaging description".
  • Exact match behavior: When exact_match is true, the query uses the '.exact' variant of the selected field for stricter matching.
  • Actions: 'search' returns matching records; 'count' returns aggregated counts for the chosen field.
  • Rate limits and availability: Subject to OpenFDA API rate limits and service availability.
  • Output format: Both outputs are JSON strings; downstream nodes may need to parse them before further processing.

Troubleshooting

  • Network error: If the API is unreachable or times out, the node returns {"error": "Network error"} in both outputs. Check connectivity and retry.
  • JSON decode error: If the API response cannot be parsed, the node returns {"error": "JSON decode error"}. Retry later or verify the API status.
  • Unknown error: Returns {"error": "Unknown error"} on unexpected failures. Review input values and try a simpler query.
  • Empty results: If 'results' is empty, confirm the field and field_value are valid for the NDC dataset or try disabling exact_match.
  • Too few/many results: Adjust 'limit' for desired volume; for broad queries consider using 'count' first to explore data distribution.