TL;DR
openFDA provides programmatic access to the US Food and Drug Administration's public datasets — covering drug labeling (all FDA-approved prescription/OTC drugs), adverse event reports, food recall enforcement reports, and medical device registrations. The data is browsable through a structured JSON API with full-text search, faceted filtering, and pagination. No API key is required, and the data is updated as the FDA publishes new information.
Quick start: https://api.fda.gov/drug/label.json
No API key needed — just make a request!
How to Use This API
1. Drug Labeling — Search by Brand Name
https://api.fda.gov/drug/label.json?search=ibuprofen
Returns drug label information including active ingredients, purpose, warnings, dosage, and manufacturer. Each result includes the structured label data as submitted to the FDA.
2. Drug Adverse Events
https://api.fda.gov/drug/event.json?search=patient.drug.openfda.brand_name:aspirin&limit=5
Search adverse event reports by brand name or generic ingredient. Response includes patient age/sex, reaction descriptions, outcomes, and reporter information.
3. Food Recall Enforcement Reports
https://api.fda.gov/food/enforcement.json?search=salmonella
Lists food recalls with: product description, reason for recall, recall classification, distribution pattern, and recall initiation date.
4. JavaScript — Drug Label Lookup
async function searchDrug(query) {
const resp = await fetch(
`https://api.fda.gov/drug/label.json?search=${encodeURIComponent(query)}&limit=3`
);
const data = await resp.json();
return data.results.map(r => ({
brand: r.openfda?.brand_name?.[0] || 'Unknown',
generic: r.openfda?.generic_name?.[0] || '',
manufacturer: r.openfda?.manufacturer_name?.[0] || '',
purpose: r.purpose?.[0],
warnings: r.warnings?.[0]?.substring(0, 200)
}));
}
searchDrug('ibuprofen').then(drugs => {
drugs.forEach(d => {
console.log(`${d.brand} (${d.generic}) — ${d.manufacturer}`);
});
});
5. Python — Adverse Events Count by Year
import requests
def count_events_for_drug(drug_name):
resp = requests.get(
'https://api.fda.gov/drug/event.json',
params={
'search': f'patient.drug.openfda.brand_name:{drug_name}',
'count': 'receivedate'
}
)
data = resp.json()
print(f"Adverse events for {drug_name}:")
for year in data.get('results', [])[:10]:
print(f" {year['time']}: {year['count']} reports")
count_events_for_drug('Tylenol')
https://api.fda.gov/drug/label.json?search=ibuprofen
Frequently Asked Questions
- What datasets does openFDA offer?
- Drug (labeling, adverse events, NDC), Food (enforcement, recalls), Device (registrations, adverse events, recalls), Animal & Veterinary (labeling, adverse events), and Cosmetics (adverse events). Each has its own base URL.
- How do I search by a specific field?
- Use the
searchparameter with field paths:search=openfda.brand_name:tylenolorsearch=patient.drug.openfda.generic_name:acetaminophen. Supports AND/OR logic. - Are there rate limits?
- openFDA has no authentication requirements and generous rate limits — roughly 240 requests per minute for most endpoints. For large-scale research, contact the FDA for higher limits.
- Can I get a count of matching results?
- Yes, set
count=field_nameinstead ofsearch. For example,count=openfda.brand_name.exactreturns the top brands with their document counts. - What pagination is supported?
- Use
limit(max 100) andskipparameters. The response includesmeta.results.totalfor the total matching record count. - Is the API data real-time?
- Data is updated regularly as the FDA publishes. Drug labeling is updated weekly. Adverse events are published quarterly. Check the
meta.last_updatedfield in responses.
API Details
- API URL
https://api.fda.gov- Documentation
- open.fda.gov/apis
- Category
- Health
- Authentication
- Not Required
- Geographic Coverage
- US — United States FDA data
What You Can Build
- Drug information lookup tool — search by brand name for label/warnings
- Adverse event dashboard — track safety reports for common medications
- Food recall alert system — monitor FDA for new recalls by category
- Medical reference app with structured drug labeling data
- Pharmaceutical research tool for adverse event trend analysis