# OpenFDA Drug Adverse Events & Recall Scraper (`parseforge/openfda-scraper`) Actor

Scrapes drug adverse events, drug labels, and food enforcement recalls from the openFDA public API. Returns each record as a flat row with full FDA payload.

- **URL**: https://apify.com/parseforge/openfda-scraper.md
- **Developed by:** [ParseForge](https://apify.com/parseforge) (community)
- **Categories:** Education, Developer tools, Automation
- **Features:** Limited permissions
- **Stats:** 2 total users, 0 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $19.00 / 1,000 results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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

[![ParseForge](https://raw.githubusercontent.com/ParseForge/apify-assets/main/banner-v4.webp)](https://apify.com/parseforge?fpr=vmoqkp)

### OpenFDA Drug Adverse Events & Recall Scraper

**Scrape FDA drug adverse events, drug labels, and food enforcement recalls from the openFDA public API, up to a million records per run.** Every record arrives as a flat row with its full FDA payload. No API key, no login, no rate limits. Export to CSV, JSON, Excel, or XML.

The openFDA API is the official public gateway to FDA drug safety and recall data, but querying it means writing API calls, handling pagination, and flattening deeply nested JSON. This Actor does that for you. Pick a dataset, add an optional search expression and date range, and it returns clean rows ready for analysis.

| Who uses it | What they scrape OpenFDA for |
|---|---|
| Pharmacovigilance analysts | Monitor adverse event reports for a specific drug or reaction |
| Product liability lawyers | Gather recall and adverse event evidence for litigation |
| Pharma market researchers | Track safety signals and label changes across drug classes |
| Food safety compliance teams | Pull enforcement recall records for supplier audits |

### What it does

This Actor collects drug adverse events, drug labels, or food enforcement recalls from the openFDA API and returns each record as a flat row.

- 📋 **Three FDA datasets:** drug adverse events, drug labels, and food enforcement recalls, selectable in one input.
- 🔍 **openFDA search expressions:** filter by any indexed field, like patient.reaction.reactionmeddrapt:"headache" or recalling_firm:"ABC Corp".
- 📅 **Date range filter:** narrow drug adverse events by receive date with start and end dates.
- ⚡ **Up to 1,000,000 records per run:** set maxItems to pull everything you need in one go.
- 🧾 **Flat row output:** every record is returned as a single row, no nested JSON to untangle.

Results export to CSV, JSON, Excel, or XML, or straight from the API.

### What you can do with OpenFDA data

**💊 Monitor adverse events for a drug.**

A pharmacovigilance analyst sets dataType to drug_events and search to patient.drug.openfda.brand_name:"Lipitor" to collect recent adverse event reports and spot emerging safety signals.

**⚖️ Build evidence for product liability cases.**

A lawyer pulls food enforcement recalls with search recalling_firm:"Company X" to document a pattern of violations for a lawsuit.

**📈 Track label changes over time.**

A pharma market researcher scrapes drug labels for a set of products and compares indications and warnings across versions to inform competitive positioning.

**🛡️ Audit food suppliers for recalls.**

A food safety compliance team runs the actor weekly with dataType food_enforcement and a search on supplier names to catch new recalls before they affect production.

### Why choose this scraper

| | What you get |
|---|---|
| **No API key** | The openFDA API is public and keyless, so you can start scraping immediately. |
| **Full FDA payload** | Each row contains the complete record as returned by openFDA, with all fields preserved. |
| **Three datasets in one** | Switch between adverse events, labels, and food recalls without changing actors. |
| **Date and search filters** | Narrow results before they hit your dataset, saving storage and processing time. |

### How it compares

This Actor focuses on the three core openFDA datasets with a simple search and date filter, while competitors bundle additional FDA sources or AI scoring.

| Feature | ParseForge | Clinical Trials & FDA Pipeline Intelligence Scraper | OpenFDA Drug Intelligence - Adverse Events + AI | FDA Intelligence - Recalls, Approvals & Adverse Events |
|---|---|---|---|---|
| Drug adverse events | Yes | Yes | Yes | Yes |
| Drug labels | Yes | Not listed | Not listed | Yes |
| Food enforcement recalls | Yes | Not listed | Not listed | Yes |
| Date range filter | Yes | Not listed | Not listed | Yes |
| Search expression filter | Yes | Not listed | Not listed | Not listed |
| AI severity scoring | Not listed | Not listed | Yes | Not listed |
| Device recalls and clearances | Not listed | Yes | Not listed | Yes |

### Configure the run

Drive the Actor from a dataset choice, an optional openFDA search expression, and an optional date range for drug adverse events. Filters run as each record is read, so only matches reach your dataset. The Input tab lists every parameter.

A first run with the defaults:

```json
{
 "maxItems": 10,
 "dataType": "drug_events"
}
```

A larger pull:

```json
{
 "maxItems": 200,
 "dataType": "drug_events"
}
```

### Pricing

Pay-per-result: **$0.021 per result** collected. You pay only for the results written to your dataset.

| Results collected | Approximate cost |
|---|---|
| 100 results | $2.10 |
| 1,000 results | $21.00 |
| 10,000 results | $210.00 |

New Apify accounts start with $5 in free credit.

### Free users

Free-plan runs return up to 10 results as a preview. [Upgrade your Apify plan](https://console.apify.com/sign-up?fpr=vmoqkp) to collect up to 1,000,000 results per run.

### Run it

1. [Create a free Apify account with $5 in credit](https://console.apify.com/sign-up?fpr=vmoqkp).
2. Open the [OpenFDA Drug Adverse Events & Recall Scraper](https://apify.com/parseforge/openfda-scraper?fpr=vmoqkp).
3. Set your inputs and any filters, then click **Start**.
4. Export the results as CSV, Excel, JSON, or XML from the **Dataset** tab.

Run it programmatically through the [Apify API](https://docs.apify.com/api/v2) (`run-sync-get-dataset-items`) or the [ApifyClient](https://docs.apify.com/api/client/js) for JavaScript and Python.

### Use with AI agents (MCP)

Give an AI agent live access to OpenFDA through the Model Context Protocol. Add the Actor to Claude, Cursor, or any MCP client:

```bash
claude mcp add --transport http apify "https://mcp.apify.com?tools=parseforge/openfda-scraper"
```

Then prompt it in plain language to run the scraper and read back the results.

### Troubleshooting

**Why am I getting no results?**

Check your search expression for typos or invalid field names. Also verify that your date range, if set, overlaps with actual record dates. Try removing filters to see if the dataset itself returns records.

**Why did the run stop before reaching maxItems?**

The openFDA API may have fewer matching records than your maxItems. The actor stops when it has collected all available matches.

**Why are my date filters not working?**

Date filters only apply to drug_events. For drug_labels and food_enforcement, the startDate and endDate inputs are ignored.

**Why is my search expression returning an error?**

Make sure the expression follows openFDA syntax, including quotes around string values and correct field names. Refer to the openFDA API documentation for the dataset you are using.

**Can I get more than 1,000,000 records?**

The maxItems input is capped at 1,000,000 per run. If you need more, split your query by date ranges or other filters and run the actor multiple times.

### FAQ

| Question | Answer |
|---|---|
| Do I need an API key for openFDA? | No. The openFDA API is public and does not require an API key. You can run this Actor immediately. |
| What datasets can I scrape? | You can choose from drug adverse events, drug labels, and food enforcement recalls using the dataType input. |
| How do I filter by a specific drug or reaction? | Use the search input with an openFDA search expression. For example, patient.drug.openfda.brand_name:"Lipitor" or patient.reaction.reactionmeddrapt:"headache". |
| Can I filter by date? | Yes, for drug adverse events you can set startDate and endDate to filter records by the receivedate field. Date filters do not apply to drug labels or food enforcement. |
| How many records can I get in one run? | You can set maxItems up to 1,000,000 records per run. |
| What format is the output? | Each record is returned as a flat row in your dataset. You can export to CSV, JSON, Excel, or XML from Apify. |
| Is the data from the official FDA source? | Yes, this Actor pulls directly from the openFDA public API, which is the official FDA data platform. |
| Can I scrape all records without a search term? | Yes, leave the search input blank to fetch all records for the selected dataset, up to maxItems. |
| What is an openFDA search expression? | It is a query string that filters records by indexed fields. The openFDA documentation lists all searchable fields for each dataset. |
| Does this Actor handle pagination automatically? | Yes, it follows the openFDA API pagination to collect all matching records up to your maxItems limit. |

### Related actors

Browse the full [ParseForge collection](https://apify.com/parseforge?fpr=vmoqkp) for more scrapers.

🆘 **Need help?** Email parseforge@protonmail.com with your run ID, your input, and what you expected.

⚠️ **Disclaimer.** This Actor is unofficial and is not affiliated with, endorsed by, or sponsored by U.S. Food and Drug Administration. It collects only publicly available data. You are responsible for using the collected data in compliance with the source's terms of service and applicable data-protection laws, including GDPR, CCPA, and PIPL. Do not use it to collect personal data unlawfully.

# Actor input Schema

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

How many records to collect per run.

## `dataType` (type: `string`):

Which FDA dataset to query.

## `search` (type: `string`):

Optional openFDA search expression (e.g. patient.reaction.reactionmeddrapt:"headache" or recalling_firm:"ABC Corp"). Leave blank to fetch all records.

## `startDate` (type: `string`):

Filter records received on or after this date. Only applies to drug_events (uses receivedate field).

## `endDate` (type: `string`):

Filter records received on or before this date. Only applies to drug_events.

## Actor input object example

```json
{
  "maxItems": 10,
  "dataType": "drug_events"
}
```

# 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 = {
    "maxItems": 10,
    "dataType": "drug_events"
};

// Run the Actor and wait for it to finish
const run = await client.actor("parseforge/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 = {
    "maxItems": 10,
    "dataType": "drug_events",
}

# Run the Actor and wait for it to finish
run = client.actor("parseforge/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 '{
  "maxItems": 10,
  "dataType": "drug_events"
}' |
apify call parseforge/openfda-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,parseforge/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/GkG5h5kS8sWWhKPDu/builds/wcCjCofm55aEVhFf9/openapi.json
