# 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 setup.

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

## Pricing

from $0.0008 / 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.
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

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

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. Built for pharma, regulatory, pharmacovigilance and safety-research teams. Export to JSON, CSV or Excel.

![openFDA Scraper input — dataset, search terms and result limit in the Apify Console](https://api.apify.com/v2/key-value-stores/SUfvnaFLd9z9eBCtV/records/openfda-scraper-input.png?v=2)

### 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.

![openFDA Scraper output example — drug recalls with classification, reason, firm and dates as structured JSON](https://api.apify.com/v2/key-value-stores/SUfvnaFLd9z9eBCtV/records/openfda-scraper-output.png?v=5)

```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."]
}
```

#### Output schema

Fields vary by `dataset`; this table documents the `drug_recalls` shape shown above (labels and adverse-event runs return their own fields plus the shared `dataset`/`searchTerm` tags and the openFDA name arrays).

| Field | Type | Description |
| --- | --- | --- |
| `dataset` | string | Which openFDA dataset the record came from. |
| `searchTerm` | string | The search term that returned this record. |
| `title` | string | Product or record title. |
| `recallNumber` | string | FDA recall identifier. |
| `status` | string | Recall status (e.g. Ongoing, Completed, Terminated). |
| `classification` | string | Recall class indicating severity (Class I/II/III). |
| `reason` | string | Reason for the recall. |
| `firm` | string | Recalling firm. |
| `productDescription` | string | Full product description. |
| `productType` | string | Product category (e.g. Drugs, Devices, Food). |
| `distributionPattern` | string | Where the product was distributed. |
| `productQuantity` | string | Quantity of product involved. |
| `voluntaryMandated` | string | Whether the recall was voluntary or FDA-mandated. |
| `city` | string | Recalling firm's city. |
| `state` | string | Recalling firm's state. |
| `country` | string | Recalling firm's country. |
| `date` | string | Recall initiation date (YYYYMMDD). |
| `reportDate` | string | Recall report date (YYYYMMDD). |
| `brandNames` | array | Brand names from the openFDA block. |
| `genericNames` | array | Generic names from the openFDA block. |
| `manufacturers` | array | Manufacturer names from the openFDA block. |

### 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

**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.

**Can I connect this Actor to other apps?**
The openFDA Scraper can be connected with almost any cloud service or web app thanks to [integrations on the Apify platform](https://apify.com/integrations). It works with [Make](https://apify.com/integrations/make), [Zapier](https://apify.com/integrations/zapier), [Slack](https://docs.apify.com/platform/integrations/slack), [Airbyte](https://docs.apify.com/platform/integrations/airbyte), [GitHub](https://docs.apify.com/platform/integrations/github), [Google Drive](https://docs.apify.com/platform/integrations/drive) and [many more](https://apify.com/integrations), plus the [Apify API](https://docs.apify.com/api/v2), JavaScript/Python clients and MCP. Or use [webhooks](https://docs.apify.com/platform/integrations/webhooks) to trigger an action whenever a run finishes.

### 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. 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(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 '{
  "searchTerms": [
    "metformin"
  ]
}' |
apify call hipersoft/openfda-scraper --silent --output-dataset

```

## MCP server setup

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