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

Search FDA open data: drug/device/food recalls, drug labels and adverse-event reports by drug, manufacturer or keyword. Get classification, reason, firm, dates and details. For pharma, regulatory and safety research. No key.

- **URL**: https://apify.com/hipersoft/openfda-scraper.md
- **Developed by:** [hiper soft](https://apify.com/hipersoft) (community)
- **Categories:** Developer tools
- **Stats:** 3 total users, 2 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.0016 / record scraped

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/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## openFDA Scraper — Drug Recalls, Labels & Adverse Events, structured JSON, no API key

Search FDA open data across five datasets — drug recalls, device recalls, food recalls, drug labels and drug adverse-event reports — straight from the **openFDA API** and get back clean, structured JSON: classification, recall reason, recalling firm, dates, product details and more. Search by drug name, manufacturer or keyword, or use advanced openFDA field syntax, and collect up to 25,000 records per term. **No account, no API key.** Built for pharma, regulatory, pharmacovigilance and safety-research teams.

### Features

- 🗃️ **Five datasets, one Actor** — choose `dataset`: `drug_recalls`, `device_recalls`, `food_recalls`, `drug_labels` or `drug_adverse_events`.
- 🔎 **Multi-term search** — pass any number of `searchTerms` (drug, manufacturer or keyword); each runs separately and every row is tagged with its `dataset` and `searchTerm`.
- 🧪 **Advanced query syntax** — use native openFDA field filters like `classification:"Class I"` or `recalling_firm:"Pfizer"` directly in a search term.
- ⚠️ **Recall detail** — classification, status, reason for recall, recalling firm, distribution pattern, quantity and initiation/report dates for enforcement records.
- 💊 **Labels & events too** — drug-label runs return purpose, indications, warnings and dosage; adverse-event runs return reactions, seriousness flags and patient demographics.
- 🏭 **openFDA enrichment** — brand names, generic names and manufacturer names pulled from the embedded `openfda` block.
- 📈 **Scales deep** — collect up to 25,000 records per term with automatic pagination and retries.

### What you get

Each dataset row is one FDA record. Fields depend on the chosen `dataset`; here's a `drug_recalls` example:

```json
{
  "dataset": "drug_recalls",
  "searchTerm": "metformin",
  "title": "Metformin Hydrochloride Extended-Release Tablets, USP 500 mg",
  "recallNumber": "D-1234-2023",
  "status": "Ongoing",
  "classification": "Class II",
  "reason": "Presence of N-Nitrosodimethylamine (NDMA) above the acceptable limit.",
  "firm": "Example Pharmaceuticals Inc.",
  "productDescription": "Metformin Hydrochloride Extended-Release Tablets, USP 500 mg, 100-count bottle",
  "productType": "Drugs",
  "distributionPattern": "Nationwide in the United States",
  "productQuantity": "12,000 bottles",
  "voluntaryMandated": "Voluntary: Firm initiated",
  "city": "Trenton",
  "state": "NJ",
  "country": "United States",
  "date": "20230115",
  "reportDate": "20230201",
  "brandNames": ["Metformin"],
  "genericNames": ["metformin hydrochloride"],
  "manufacturers": ["Example Pharmaceuticals Inc."]
}
```

### Input

```json
{
  "dataset": "drug_recalls",
  "searchTerms": ["metformin", "valsartan"],
  "maxResultsPerTerm": 100
}
```

| Field | Description |
| --- | --- |
| `dataset` | Which FDA dataset to search: `drug_recalls`, `device_recalls`, `food_recalls`, `drug_labels` or `drug_adverse_events`. |
| `searchTerms` | Drug name, manufacturer or keyword. Advanced openFDA field syntax (e.g. `classification:"Class I"`) also works. |
| `maxResultsPerTerm` | Maximum records to collect per search term (1–25,000). |

### Use cases

- Monitor drug or device recalls by manufacturer and classification for regulatory compliance.
- Pull adverse-event reports for a drug to support pharmacovigilance and safety signal review.
- Extract label content (indications, warnings, dosage) for a portfolio of products.
- Track food-safety recalls by firm, reason or distribution region.

### Pricing

Pay-per-event: you're billed a small amount per run and per item scraped — you only pay for what you get. See the **Pricing** tab for current rates.

### FAQ

**Do I need an API key or account?**
No. The Actor uses the public [openFDA](https://open.fda.gov) API, which is free and open — no login and no key required.

**How many records can I get per run?**
Up to 25,000 records per search term, collected with automatic pagination and retries. Pass multiple `searchTerms` and each one runs separately, tagged with its own `dataset` and `searchTerm`.

**How fresh is the data?**
Records reflect openFDA's published data at run time. The FDA updates each dataset on its own schedule, so recency varies by dataset; data may also be incomplete or revised over time.

**Is the data official?**
Yes — the Actor returns the FDA's own open data as-is. It is an independent tool and is not affiliated with or endorsed by the U.S. Food and Drug Administration; consult official FDA sources for regulatory decisions.

**What's the output format?**
Flat JSON, one record per FDA entry, with fields that depend on the chosen dataset (recalls, labels or adverse events) plus enriched brand, generic and manufacturer names. Export as JSON, CSV or Excel.

### Related Actors

More government and regulatory data scrapers from the same publisher:

- [ClinicalTrials Scraper](https://apify.com/hipersoft/clinicaltrials-scraper) — clinical study records from ClinicalTrials.gov.
- [USASpending.gov Scraper](https://apify.com/hipersoft/usaspending-scraper) — US federal contracts, grants, loans and awards.
- [SEC EDGAR Filings Scraper](https://apify.com/hipersoft/sec-edgar-scraper) — 10-K, 10-Q and 8-K filings by ticker or CIK.
- [Brazil CNPJ Scraper](https://apify.com/hipersoft/brazil-cnpj-scraper) — official Brazilian company records from Receita Federal.

### Notes

This Actor uses the public openFDA API and returns the FDA's own open data as-is, over openly available records with no login required. It is an independent tool and is not affiliated with, endorsed by, or sponsored by the U.S. Food and Drug Administration. FDA data may be incomplete or updated over time; consult official FDA sources for regulatory decisions.

# Actor input Schema

## `dataset` (type: `string`):

Which FDA dataset to search.

## `searchTerms` (type: `array`):

Drug name, manufacturer or keyword. Advanced openFDA field syntax (e.g. classification:"Class I") also works.

## `maxResultsPerTerm` (type: `integer`):

Maximum records to collect per search term.

## Actor input object example

```json
{
  "dataset": "drug_recalls",
  "searchTerms": [
    "valsartan",
    "recalling_firm:\"Pfizer\""
  ],
  "maxResultsPerTerm": 100
}
```

# 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 = {
    "searchTerms": [
        "metformin"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("hipersoft/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 = { "searchTerms": ["metformin"] }

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

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

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

```

## CLI example

```bash
echo '{
  "searchTerms": [
    "metformin"
  ]
}' |
apify call hipersoft/openfda-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=hipersoft/openfda-scraper",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

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