DEV Community

Ava Torres
Ava Torres

Posted on

How to Search FDA Drug Recalls and Adverse Events Programmatically

The FDA publishes an enormous amount of drug safety data through the openFDA API -- adverse event reports, recall enforcement actions, drug labeling, and more. If you work in pharmacovigilance, regulatory affairs, healthcare journalism, or competitive intelligence for pharma, this data is essential.

The problem: the openFDA API is powerful but painful to use at scale. Pagination is count-based with a hard limit of 26,000 results per query. Date filtering uses a non-standard syntax. The response format nests data several levels deep. And there's no built-in way to export results to CSV or Excel.

What the FDA publishes

Drug Adverse Events (FAERS): Reports of side effects and adverse reactions submitted by healthcare professionals, consumers, and manufacturers. Millions of reports going back to 2004. Each report includes the drug name, reaction terms, patient demographics, outcome (hospitalization, death, disability), and reporter type.

Drug Recalls & Enforcement: FDA enforcement actions including recalls, market withdrawals, and safety alerts. Includes the reason for recall, product description, distribution pattern, classification (Class I/II/III), and current status.

Drug Labeling: Structured label data including indications, warnings, contraindications, and dosage information.

Why you'd want this data

Pharmacovigilance teams monitor adverse events for their drugs and competitors. A spike in reports for a specific reaction can signal a safety issue before it becomes a regulatory action.

Regulatory affairs tracks FDA enforcement actions to stay ahead of compliance requirements and understand how the agency is prioritizing inspections and recalls.

Healthcare journalists investigate drug safety patterns -- which drugs have the most adverse event reports, which manufacturers have the most recalls, and how outcomes trend over time.

Competitive intelligence in pharma uses adverse event data to understand competitor drug safety profiles and identify market opportunities.

Litigation support pulls adverse event reports for specific drugs during product liability cases.

The openFDA API pain points

If you've tried to use the openFDA API directly, you've run into these:

  1. 26,000 result limit -- you cannot retrieve more than 26,000 results per query, even with pagination. For popular drugs with tens of thousands of adverse event reports, you need to split queries by date range.

  2. Non-standard date syntax -- dates use the format [20200101+TO+20201231] instead of standard ISO dates.

  3. Nested JSON -- adverse event reports nest drug information, reactions, and patient data in arrays within arrays. Flattening this for analysis requires custom parsing.

  4. No CSV export -- results come as raw JSON only.

A simpler approach

I built two Apify actors that wrap the openFDA API and handle these pain points:

OpenFDA Drug Adverse Events & Recalls

Search for drug adverse events and recall enforcement actions. Filter by:

  • Drug name -- brand or generic name
  • Date range -- standard date format, no openFDA syntax needed
  • Reaction term -- specific adverse reactions (e.g., "nausea", "hepatotoxicity")
  • Outcome -- filter by seriousness (death, hospitalization, disability)
  • Record type -- adverse events, recalls, or both

Results come back as clean, flat JSON. Export to CSV, Excel, or Google Sheets directly from Apify.

Example searches

  • All adverse event reports for "Ozempic" in the last 12 months
  • Class I drug recalls in 2024-2025
  • Adverse events with outcome "death" for a specific drug class
  • All recall enforcement actions by a specific manufacturer

Combining with other health data

The FDA data is often just one piece of a larger research workflow:

All free public data. No API keys required.

Getting started

  1. Go to the OpenFDA Drug Adverse Events & Recalls actor
  2. Enter a drug name or search term
  3. Set date range and filters
  4. Click "Start" -- most searches complete in under a minute
  5. Export results in your preferred format

This is official FDA data accessed through their public API. No scraping, no CAPTCHA, no rate limit worries.

Top comments (0)