# openFDA Scraper: Recalls, Drug Labels & Adverse Events (`winterlock/openfda-scraper`) Actor

Pull FDA drug, device and food recalls, prescription and OTC drug labels, FAERS adverse event reports and the full NDC drug directory from the FDA's official openFDA API. Filter by product, company, state, recall class and date. No key, no login, no scraping.

- **URL**: https://apify.com/winterlock/openfda-scraper.md
- **Developed by:** [Alex Burton](https://apify.com/winterlock) (community)
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $10.00 / 1,000 recalls

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## openFDA Scraper: Recalls, Drug Labels & Adverse Events

Six FDA datasets behind one input form. Pull drug, device and food recalls, prescription and over-the-counter drug labels, FAERS adverse event reports, and the full National Drug Code directory — filtered by product, company, state, recall class and date, and flattened into spreadsheet-ready rows.

| Mode | What you get |
|---|---|
| **Drug recalls** | FDA drug enforcement reports: class, reason, firm, distribution, dates |
| **Device recalls** | The same for medical devices |
| **Food recalls** | The same for food and cosmetics |
| **Drug labels** | SPL label text: boxed warning, indications, dosage, contraindications, interactions |
| **Adverse events** | FAERS reports: reactions, outcomes, suspect drugs, patient age and sex |
| **NDC directory** | Every listed drug product: NDC, labeler, dosage form, active ingredients |

### Why use this one

- **The FDA's own API, nothing else.** This reads `api.fda.gov`, the endpoint the Food and Drug Administration publishes for programmatic access. No HTML parsing, no login, no key required, and no terms-of-service grey area — so there is nothing to break when a web page is redesigned and no account to get blocked.
- **Six datasets, one consistent output.** Each dataset has its own field names and its own date field. This Actor translates one set of plain-English filters into the right query for whichever one you pick, so a date range means `report_date` for a recall and `receivedate` for an adverse event without you having to know that.
- **Dates come out readable.** openFDA stores dates as `20250131`. Every date field here is ISO `2025-01-31`, which sorts correctly in Excel and loads into a database as a date.
- **The nesting is flattened.** A FAERS report buries reactions and drugs under `patient.reaction[]` and `patient.drug[]`. You get `reactions`, `reactionOutcomes`, `suspectDrugs` and `drugGenericNames` as plain columns, plus counts. Label text sections come out as one column each.
- **An escape hatch for power users.** `searchQuery` passes a raw openFDA query clause through untouched and ANDs it with your other filters, so anything the form doesn't cover is still reachable.

### How to use it

1. Choose **What to collect**.
2. Set any filters you want — leave them all empty to take the newest records in that dataset.
3. Click **Start**, then download results as JSON, CSV, Excel or HTML, or fetch them through the Apify API.

#### Example input: Class I drug recalls this year

```json
{
  "mode": "drugRecalls",
  "classification": "Class I",
  "dateFrom": "2026-01-01",
  "maxResults": 1000
}
```

#### Example input: one company's recalls in California

```json
{
  "mode": "foodRecalls",
  "firm": "Dole",
  "state": "CA",
  "maxResults": 500
}
```

#### Example input: serious adverse events mentioning a drug

```json
{
  "mode": "drugEvents",
  "productSearch": "metformin",
  "seriousOnly": true,
  "dateFrom": "2025-01-01",
  "maxResults": 2000
}
```

#### Example input: every NDC product from one labeler

```json
{
  "mode": "ndcDirectory",
  "firm": "Teva Pharmaceuticals USA, Inc.",
  "maxResults": 5000
}
```

#### Example input: a raw openFDA clause

```json
{
  "mode": "drugLabels",
  "searchQuery": "openfda.route:\"TRANSDERMAL\" AND _exists_:boxed_warning",
  "maxResults": 200
}
```

### Output

Each item carries a `type` field — `recall`, `label`, `adverseEvent` or `drugProduct` — and the dataset has a ready-made table view for each.

#### A recall

```json
{
  "type": "recall",
  "dataset": "food",
  "recallNumber": "F-0123-2026",
  "eventId": "90123",
  "status": "Ongoing",
  "classification": "Class I",
  "productType": "Food",
  "recallingFirm": "Example Foods Inc",
  "firmCity": "Fresno",
  "firmState": "CA",
  "firmCountry": "United States",
  "productDescription": "Example brand spinach, 10 oz bag",
  "productQuantity": "12,480 cases",
  "reasonForRecall": "Potential Listeria monocytogenes contamination",
  "voluntaryMandated": "Voluntary: Firm initiated",
  "initialFirmNotification": "Press Release",
  "distributionPattern": "Nationwide",
  "recallInitiationDate": "2026-02-14",
  "reportDate": "2026-02-26",
  "terminationDate": null
}
```

#### An adverse event report

```json
{
  "type": "adverseEvent",
  "safetyReportId": "12345678",
  "receiveDate": "2025-06-03",
  "serious": "1",
  "isSerious": true,
  "seriousnessHospitalization": "1",
  "reporterCountry": "US",
  "reporterQualification": "1",
  "reporterQualificationLabel": "physician",
  "patientSex": "2",
  "patientSexLabel": "female",
  "patientOnsetAge": 64.0,
  "patientOnsetAgeUnit": "801",
  "patientOnsetAgeUnitLabel": "year",
  "patientWeightKg": 78.0,
  "reactionCount": 2,
  "reactions": ["Nausea", "Dizziness"],
  "reactionOutcomes": ["1", "6"],
  "reactionOutcomeLabels": ["recovered/resolved", "unknown"],
  "drugCount": 3,
  "suspectDrugs": ["METFORMIN HYDROCHLORIDE"],
  "drugGenericNames": ["METFORMIN HYDROCHLORIDE"]
}
```

FAERS fields such as `serious`, `patientSex`, `reporterQualification` and `reactionOutcomes` keep the coded values the FDA publishes, exactly as received. Beside them, `isSerious`, `patientSexLabel`, `reporterQualificationLabel`, `patientOnsetAgeUnitLabel` and `reactionOutcomeLabels` translate them using the code lists in the openFDA field reference; a code outside those lists gets a null label rather than a guess. `reactionOutcomes` lines up one-to-one with `reactions` (null where the report gives no outcome), while `drugIndications` and `drugRoutes` list the distinct values across the report's drugs.

### Pricing

Pay only for results:

| Result | Price |
|---|---|
| Recall | $10.00 per 1,000 |
| Drug label | $10.00 per 1,000 |
| Adverse event report | $10.00 per 1,000 |
| NDC drug product | $10.00 per 1,000 |

Set a maximum spend per run in the run options and the Actor stops cleanly when it's reached.

### Limits to know about

These come from the FDA's API, not from this Actor:

- **26,000 hits per query.** openFDA serves up to 1,000 records per page and refuses to page past 26,000 hits for one query. The Actor stops at that ceiling and tells you in the log. To collect more, split the work by date range — a year at a time, or a month for adverse events — and run it again.
- **Rate limits.** Without a key: 240 requests per minute and 1,000 requests per day, per IP address. With a free key from open.fda.gov: 240 requests per minute and 120,000 requests per day. Since each request brings back up to 1,000 records, the keyless daily allowance is already large; the optional **openFDA API key** input is there for heavy scheduled use.
- **Adverse events are reports, not conclusions.** A FAERS report says someone reported an event while taking a drug. It is not evidence the drug caused it, reports are not verified, and the same event can be reported more than once. The FDA is explicit about this, and so is every response the API sends.
- **Adverse events have no company filter.** FAERS reports carry a reporting company number but no searchable company name, so the **Company** field is rejected for that mode with a message rather than silently ignored. Search by drug name instead.
- **`openfda` enrichment is sparse on recalls.** The FDA attaches brand and manufacturer names to an enforcement report only when it can match the product to a listed drug. For food and device recalls that block is usually empty, so `brandNames` and `genericNames` are often `[]` — the product name you want is in `productDescription`.
- **Label text is long.** Each label section is truncated at 20,000 characters so a single label can't swamp your spreadsheet, and only the first block of each section is kept when the API returns several.
- **Data lags.** Each dataset has its own refresh schedule and the enforcement reports in particular are published weekly, so the newest recall in the API can be a few days behind an FDA press release.

### FAQ

**Do I need an account or API key?** No. openFDA is open and keyless. A free key only raises the daily request limit, and it goes in the optional, secret **openFDA API key** field if you want it.

**Can I monitor new recalls?** Yes. Schedule the Actor daily with a `dateFrom` of the last week or so, and connect the dataset to Slack, Google Sheets, Zapier or Make.

**Why are some fields missing from a row?** openFDA omits a field entirely when a record has no value for it, so the row comes back with `null` rather than failing. Every field is read defensively.

**What's the difference between drug labels and the NDC directory?** The NDC directory is one row per marketed drug product — identifiers, dosage form, ingredients. A label is the full prescribing or Drug Facts text for an SPL document. Use the directory to enumerate products and labels to read what they say.

**Is this legal?** Yes. openFDA is a public US government API, published by the FDA for exactly this purpose, with no authentication. The FDA's own disclaimer accompanies every response: the data is not for clinical decision-making and should not be used to make decisions about medical care.

### Feedback

Found a bug or need a field that's missing? Open an issue on the Actor's **Issues** tab.

# Actor input Schema

## `mode` (type: `string`):

Which openFDA dataset to pull from. Each one has its own fields, and the filters below adapt to your choice.

## `productSearch` (type: `string`):

Matches the product description on a recall, the brand name on a label or in the NDC directory, or the reported drug on an adverse event.

## `firm` (type: `string`):

The recalling firm on a recall, the labeler in the NDC directory, or the manufacturer on a label. Adverse event reports have no searchable company name.

## `dateFrom` (type: `string`):

Earliest date, as 2025-01-31. Applies to the report date on a recall, the effective date on a label, the receive date on an adverse event, or the marketing start date in the NDC directory.

## `dateTo` (type: `string`):

Latest date, as 2025-12-31.

## `state` (type: `string`):

Two-letter state code of the recalling firm, for example CA. Ignored for labels, adverse events and the NDC directory.

## `classification` (type: `string`):

Class I is the most serious: a reasonable probability of serious harm or death. Class III is least serious.

## `recallStatus` (type: `string`):

Where the recall stands in the FDA's process.

## `reaction` (type: `string`):

A MedDRA reaction term as reported, for example nausea or hepatic failure.

## `seriousOnly` (type: `boolean`):

Keep only reports the sender flagged as serious (death, hospitalisation, disability, birth defect or life-threatening).

## `searchQuery` (type: `string`):

Advanced. A raw query clause, ANDed with everything above, for example openfda.pharm_class_epc:"nonsteroidal anti-inflammatory drug". Uses openFDA's own Lucene syntax.

## `sort` (type: `string`):

For example report_date:asc. Leave empty to sort newest first by the dataset's own date field.

## `apiKey` (type: `string`):

Not required. A free key from open.fda.gov raises the daily limit from 1,000 to 120,000 requests. Leave empty to run without one.

## `maxResults` (type: `integer`):

openFDA serves up to 1,000 per page and will not page past 26,000 hits for a single query.

## `maxItems` (type: `integer`):

Stop the run after saving this many items. Leave empty for no limit.

## `maxConcurrency` (type: `integer`):

Pages are fetched in order, so this is a ceiling rather than a target. openFDA allows 240 requests per minute.

## `proxyConfiguration` (type: `object`):

Not needed. The openFDA API is open to datacenter traffic.

## Actor input object example

```json
{
  "mode": "drugRecalls",
  "productSearch": "metformin",
  "classification": "any",
  "recallStatus": "any",
  "seriousOnly": false,
  "maxResults": 100,
  "maxConcurrency": 3,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

## `results` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "productSearch": "metformin"
};

// Run the Actor and wait for it to finish
const run = await client.actor("winterlock/openfda-scraper").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "productSearch": "metformin" }

# Run the Actor and wait for it to finish
run = client.actor("winterlock/openfda-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "productSearch": "metformin"
}' |
apify call winterlock/openfda-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,winterlock/openfda-scraper"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/gJH8A8gdnuwvHjxrm/builds/xzgb0isAZt0MLwMoH/openapi.json
