The Mine Works
openFDA Scraper: Drug Adverse Events, Device Recalls, and Food Safety Data
← All posts
tutorial June 23, 2026 · 2 min read

openFDA Scraper: Drug Adverse Events, Device Recalls, and Food Safety Data

Extract FDA drug adverse events, device recalls, 510k clearances, and food enforcement actions from all openFDA endpoints using a single Python script. No API key required.

Try the scraper

The actor referenced in this article. Pay only for results delivered.

View the scraper →

The openFDA API exposes seven distinct endpoints covering drug adverse events, drug labeling, drug recalls, device 510k clearances, device adverse events, device recalls, and food enforcement actions. Each endpoint has its own URL scheme, field names, and pagination behavior.

Our openFDA Unified Scraper handles all seven through a single interface. You pick the endpoint, write a search query, and get back structured JSON.

Endpoints covered

EndpointWhat it returns
drug/eventPatient adverse event reports for drugs
drug/labelFDA-approved prescribing information
drug/enforcementDrug recall actions and alerts
device/510kDevice clearance decisions
device/eventMedical device adverse events
device/recallDevice recall actions
food/enforcementFood and supplement recall actions

Python example

import requests

run = requests.post(
    "https://api.apify.com/v2/acts/themineworks~openfda-unified-crawler/runs",
    headers={"Authorization": f"Bearer {APIFY_TOKEN}"},
    json={
        "endpoint": "drug/event",
        "search": "patient.drug.medicinalproduct:aspirin+AND+serious:1",
        "maxResults": 100
    }
)

run_id = run.json()["data"]["id"]

# Poll until finished
import time
while True:
    status = requests.get(
        f"https://api.apify.com/v2/actor-runs/{run_id}",
        headers={"Authorization": f"Bearer {APIFY_TOKEN}"}
    ).json()["data"]["status"]
    if status in ("SUCCEEDED", "FAILED"):
        break
    time.sleep(5)

# Fetch results
items = requests.get(
    f"https://api.apify.com/v2/actor-runs/{run_id}/dataset/items",
    headers={"Authorization": f"Bearer {APIFY_TOKEN}"}
).json()

for item in items:
    print(item["endpoint"], item.get("patient", {}).get("patientdeath"))

Device 510k clearances

To pull medical device clearances from a specific applicant:

{
    "endpoint": "device/510k",
    "search": "applicant:Medtronic",
    "maxResults": 50
}

Each result includes device name, applicant, decision date, product code, and the regulation number.

Food safety recalls

{
    "endpoint": "food/enforcement",
    "search": "reason_for_recall:undeclared+allergen",
    "maxResults": 200
}

Returns recalling firm, product description, recall reason, classification (Class I/II/III), and states affected.

Search syntax

openFDA uses Lucene query syntax. Field names vary per endpoint. The search parameter is passed directly to the openFDA API, so the openFDA field reference is the canonical source for constructable queries.

Leave search empty to pull the most recent records across the entire endpoint.

Pricing

$0.005 per record. Runs with zero results are not charged.

The actor is available on Apify.

Related Actor

Explore the scraper referenced in this article — see inputs, outputs, and pricing, then run it on Apify.