openFDA Drug NDC Directory Scraper avatar

openFDA Drug NDC Directory Scraper

Pricing

Pay per event

Go to Apify Store
openFDA Drug NDC Directory Scraper

openFDA Drug NDC Directory Scraper

Export official openFDA Drug NDC Directory product and package metadata by NDC, drug name, labeler, regulatory status, and dates.

Pricing

Pay per event

Rating

0.0

(0)

Developer

Stas Persiianenko

Stas Persiianenko

Maintained by Community

Actor stats

0

Bookmarked

2

Total users

1

Monthly active users

2 days ago

Last modified

Categories

Share

Export official openFDA Drug NDC Directory records from api.fda.gov/drug/ndc.json.

This Apify Actor helps compliance teams, pharmacy data vendors, healthcare enrichment pipelines, and drug-reference analysts collect structured product and package NDC metadata without building and maintaining openFDA pagination code.

What does openFDA Drug NDC Directory Scraper do?

It queries the public openFDA Drug NDC Directory API and saves normalized dataset rows.

You can search by drug name, generic name, labeler, product NDC, package NDC, regulatory category, product type, dosage form, and date ranges.

The actor can emit one row per product NDC or one row per package NDC.

Who is it for?

  • ๐Ÿงช Pharma compliance teams checking product listings and marketing status.
  • ๐Ÿ’Š Pharmacy pricing teams enriching package NDC catalogs.
  • ๐Ÿฅ Healthcare data vendors building normalized drug reference tables.
  • ๐Ÿ“Š Analysts comparing labelers, dosage forms, and product types.
  • โš™๏ธ Developers who need repeatable NDC exports inside ETL jobs.

Why use this actor?

  • Uses the official openFDA public API.
  • No login, cookies, or browser automation required.
  • Handles pagination, retries, and normalization.
  • Produces Apify datasets ready for CSV, JSON, Excel, API, or integrations.
  • Supports both product-level and package-level exports.

What data can it extract?

Field groupExample fields
Product IDsproductNdc, productId, splId
Package IDspackageNdc, packageDescription, packaging
Drug identitybrandName, genericName, activeIngredients, dosageForm
Company metadatalabelerName, manufacturerName
Regulatory metadataproductType, marketingCategory, applicationNumber, finished
DatesmarketingStartDate, marketingEndDate, listingExpirationDate
Enrichmentroute, pharmClass, openfda

How much does it cost to scrape openFDA NDC records?

The actor uses pay-per-event pricing.

  • Start event: charged once per run.
  • Item event: charged for each saved dataset row.

Final live tiered pricing is calculated from cloud cost measurements before publication. The default private-build price is intentionally low for testing.

Input options

Use these common fields:

  • query โ€” free-text drug, NDC, or labeler search.
  • ndcs โ€” exact product or package NDC values.
  • brandName โ€” exact brand name filter.
  • genericName โ€” exact generic name filter.
  • labelerName โ€” exact labeler/manufacturer name filter.
  • marketingCategory โ€” FDA marketing category.
  • dosageForm โ€” tablet, capsule, solution, injection, etc.
  • productType โ€” human prescription drug, human OTC drug, and similar.
  • finished โ€” filter finished or unfinished products.
  • marketingStartFrom / marketingStartTo โ€” marketing date window.
  • listingExpirationFrom / listingExpirationTo โ€” listing expiration window.
  • rawSearch โ€” advanced openFDA Lucene syntax.
  • outputMode โ€” products or packages.
  • maxItems โ€” maximum rows to save.
  • pageSize โ€” openFDA page size.

Example: search aspirin products

{
"query": "aspirin",
"outputMode": "products",
"maxItems": 25,
"pageSize": 100
}

Example: package-level NDC export

{
"labelerName": "Walgreen Company",
"outputMode": "packages",
"maxItems": 50,
"pageSize": 100
}

Example: prescription drug monitoring workflow

{
"productType": "HUMAN PRESCRIPTION DRUG",
"marketingStartFrom": "2024-01-01",
"outputMode": "products",
"maxItems": 100,
"pageSize": 100
}

Output example

{
"recordType": "products",
"productNdc": "0002-0800",
"packageNdc": null,
"brandName": "Example Drug",
"genericName": "EXAMPLE INGREDIENT",
"labelerName": "Example Labeler",
"activeIngredientNames": ["EXAMPLE INGREDIENT"],
"dosageForm": "TABLET",
"productType": "HUMAN PRESCRIPTION DRUG",
"marketingCategory": "NDA",
"listingExpirationDate": "20261231",
"sourceUrl": "https://api.fda.gov/drug/ndc.json?...",
"scrapedAt": "2026-06-30T00:00:00.000Z"
}

Product rows vs package rows

Choose products when you want one row for every product NDC.

Choose packages when your workflow needs package NDCs, package descriptions, package marketing dates, or package-level pricing enrichment.

Package rows still include the parent product fields.

Tips for better results

  • Use exact NDC filters when you already have product or package codes.
  • Use labelerName for manufacturer/labeler exports.
  • Use productType and date filters for repeat monitoring jobs.
  • Keep pageSize at 100 unless you are exporting large batches.
  • Use rawSearch only if you know openFDA search syntax.

Integrations

  • ๐Ÿ“ฅ Export dataset rows to CSV for analysts.
  • ๐Ÿ” Schedule recurring Apify tasks for catalog refreshes.
  • ๐Ÿงฉ Send dataset output to Make, Zapier, or a webhook.
  • ๐Ÿ—„๏ธ Pull results with the Apify API into a warehouse.
  • โœ… Compare new rows against an internal drug master table.

API usage with Node.js

import { ApifyClient } from 'apify-client';
const client = new ApifyClient({ token: process.env.APIFY_TOKEN });
const run = await client.actor('automation-lab/openfda-drug-ndc-directory-scraper').call({
query: 'aspirin',
outputMode: 'products',
maxItems: 100,
});
console.log(run.defaultDatasetId);

API usage with Python

from apify_client import ApifyClient
client = ApifyClient('YOUR_APIFY_TOKEN')
run = client.actor('automation-lab/openfda-drug-ndc-directory-scraper').call(run_input={
'query': 'aspirin',
'outputMode': 'products',
'maxItems': 100,
})
print(run['defaultDatasetId'])

API usage with cURL

curl -X POST 'https://api.apify.com/v2/acts/automation-lab~openfda-drug-ndc-directory-scraper/runs?token=YOUR_APIFY_TOKEN' \
-H 'Content-Type: application/json' \
-d '{"query":"aspirin","outputMode":"products","maxItems":100}'

MCP usage

Use Apify MCP with the actor-specific tool URL:

$https://mcp.apify.com/?tools=automation-lab/openfda-drug-ndc-directory-scraper

Add the actor to Claude Code:

$claude mcp add apify-openfda-ndc https://mcp.apify.com/?tools=automation-lab/openfda-drug-ndc-directory-scraper

Claude Desktop JSON config example:

{
"mcpServers": {
"apify-openfda-ndc": {
"url": "https://mcp.apify.com/?tools=automation-lab/openfda-drug-ndc-directory-scraper"
}
}
}

Example prompts:

  • "Export 100 aspirin NDC product records and summarize the labelers."
  • "Find package-level NDC rows for Walgreen Company."
  • "Collect human prescription drug NDC listings marketed since 2024."

Legality

The actor reads an official public API and does not bypass access controls, login walls, or private systems.

This actor uses the official public openFDA API. Respect openFDA terms, attribution guidance, and any data-use obligations in your organization.

The actor does not provide medical advice. Validate regulatory conclusions with official FDA sources and your compliance team.

FAQ

Is this medical advice?

No. The actor exports public data and does not interpret safety, efficacy, approval, or prescribing decisions.

Can I export package NDCs?

Yes. Set outputMode to packages to save one row per package NDC with parent product metadata.

Troubleshooting: no rows returned

If no rows are returned, your exact filter may be too narrow.

Try a broader query, remove date filters, or run with only productType and maxItems to confirm availability.

Troubleshooting: openFDA syntax error

If you use rawSearch, openFDA may reject invalid Lucene syntax.

Remove rawSearch and use the friendly fields first.

Explore related Automation Lab actors for healthcare, compliance, and public-data workflows on Apify:

Changelog

  • 0.1 โ€” Initial private build for official openFDA Drug NDC Directory product and package exports.

Support

If a specific filter or workflow is missing, open an Apify issue with your input JSON and expected output shape.

Data freshness

openFDA aggregates public FDA datasets. Refresh cadence depends on FDA/openFDA upstream data updates.

Performance

This is an HTTP API actor and normally runs quickly with low memory. Large exports are bounded by maxItems and openFDA API availability.

Reliability

The actor retries temporary 429 and 5xx API responses with exponential backoff.

Best practices

Start with a small run, inspect the dataset, then increase maxItems for production exports.

Example workflows

  • NDC catalog enrichment.
  • Labeler portfolio export.
  • Package NDC pricing joins.
  • Marketing-category monitoring.
  • Drug reference QA.

Field stability

Output field names are designed to remain stable after publication. Optional fields may be null when openFDA does not provide the value.