openFDA Drug NDC Directory Scraper
Pricing
Pay per event
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
Maintained by CommunityActor 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 group | Example fields |
|---|---|
| Product IDs | productNdc, productId, splId |
| Package IDs | packageNdc, packageDescription, packaging |
| Drug identity | brandName, genericName, activeIngredients, dosageForm |
| Company metadata | labelerName, manufacturerName |
| Regulatory metadata | productType, marketingCategory, applicationNumber, finished |
| Dates | marketingStartDate, marketingEndDate, listingExpirationDate |
| Enrichment | route, 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โproductsorpackages.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
labelerNamefor manufacturer/labeler exports. - Use
productTypeand date filters for repeat monitoring jobs. - Keep
pageSizeat 100 unless you are exporting large batches. - Use
rawSearchonly 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 ApifyClientclient = 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.
Legal and compliance notes
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.
Related scrapers
Explore related Automation Lab actors for healthcare, compliance, and public-data workflows on Apify:
- https://apify.com/automation-lab/openfda-drug-ndc-directory-scraper
- https://apify.com/automation-lab
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.