# FDA API Scraper - Drug Approvals, Recalls & Adverse Events (`captainhandsome/openfda-search`) Actor

Search official openFDA data: drug approvals (Drugs@FDA), adverse event reports, and drug, device and food recalls. Drug label data and recall records as flat, CSV-ready rows through one Actor, with no API key needed.

- **URL**: https://apify.com/captainhandsome/openfda-search.md
- **Developed by:** [Joseph McRell](https://apify.com/captainhandsome) (community)
- **Categories:** Other, Developer tools
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.40 / 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?

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 Search

Search official openFDA datasets for drug labels, approvals, adverse events, and drug, device, or food recalls. Receive normalized, CSV-ready records through one consistent Actor interface without supplying an API key. Set `max_items` before each run to keep output and cost predictable.

### What data can I extract?

138 declared columns across six official openFDA datasets, flattened to one row per record. Nested blocks and arrays are pulled apart into scalar columns, so a CSV export is usable as-is.

- **Identifiers on every dataset** - brand name, generic name, manufacturer, substance, route, product type, FDA application number and type, product and package NDC, RxCUI, UNII, UPC, SPL set id, and the four pharmacologic classes (EPC, MoA, CS, PE).
- **Drug labels** - effective date and SPL version plus every prescribing-information and OTC Drug Facts section: boxed warning, indications, dosage, dosage forms and strengths, active and inactive ingredients, warnings, warnings and precautions, precautions, contraindications, adverse reactions, drug interactions, overdosage, pregnancy, pediatric and geriatric use, description, clinical pharmacology, mechanism of action, how supplied, storage, do-not-use, ask-a-doctor, when-using, stop-use, keep-out-of-reach, questions and contact, package label panel, and recent major changes.
- **Drug approvals (Drugs@FDA)** - one row per product with sponsor, product number, strength, dosage form, marketing status, TE code, reference drug and reference standard flags, original approval date, review priority, submission and supplement counts, the latest submission's date, type, status and class, and direct links to the FDA label PDF, approval letter, and review document.
- **Adverse events (FAERS)** - report version and dates, report type, seriousness plus the six individual outcome flags (death, life threatening, hospitalization, disabling, congenital anomaly, other), expedited and duplicate flags, reporter country and qualification, sender organization, company case number, reactions with their outcomes, suspect and concomitant drugs, active substances, indications, drug and reaction counts, suspect drug start and end dates, patient sex, age, age unit, age group, weight, and the case narrative.
- **Drug, device, and food recalls** - recall number and event id, status, hazard classification, recalling firm with its full street address, reason, product description and quantity, lot and code info, distribution pattern, voluntary or mandated, initial notification method, and the initiation, classification, termination, and report dates.
- **Coded values are decoded.** FAERS ships seriousness, sex, age group, reporter type, and reaction outcome as bare digits. This Actor returns `serious`, `female`, `elderly`, `physician`, `not recovered/not resolved` - not `1`, `2`, `6`, `1`, `3`.
- **Optional NDC enrichment.** Turn on `include_details` to add labeler, marketing category, marketing start and end dates, listing expiration, DEA schedule, and package configurations from the FDA NDC Directory. Batched at one request per 20 records, not one per record.

Every result is written to the default dataset and can be downloaded as JSON, CSV, Excel, or XML.

#### All 138 columns

**Identity** — `application_number`, `brand_name`, `company_number`, `event_id`, `generic_name`, `id`, `labeler_name`, `product_number`, `spl_set_id`, `sponsor_name`

**Status** — `active_ingredient`, `active_substances`, `application_type`, `center_classification_date`, `classification`, `inactive_ingredient`, `is_original_packager`, `latest_submission_status`, `latest_submission_type`, `marketing_category`, `marketing_status`, `product_type`, `report_type`, `status`

**Dates** — `approval_date`, `latest_submission_date`, `listing_expiration_date`, `marketing_end_date`, `marketing_start_date`, `recall_date`, `receipt_date`, `receive_date`, `report_date`, `suspect_drug_end_date`, `suspect_drug_start_date`, `termination_date`, `transmission_date`, `voluntary_mandated`

**Location** — `address_1`, `address_2`, `city`, `country`, `occur_country`, `postal_code`, `reporter_country`, `state`

**Contact** — `approval_letter_url`, `label_url`, `review_url`

**Counts and measures** — `drug_count`, `product_count`, `reaction_count`, `submission_count`, `supplement_count`

**Other detail** — `adverse_reactions`, `ask_doctor`, `boxed_warning`, `case_narrative`, `clinical_pharmacology`, `code_info`, `concomitant_drugs`, `contraindications`, `dataset`, `dea_schedule`, `description`, `distribution`, `do_not_use`, `dosage`, `dosage_form`, `dosage_forms_and_strengths`, `drug_indications`, `drug_interactions`, `drugs`, `duplicate_report`, `effective_time`, `expedited`, `geriatric_use`, `how_supplied`, `indications`, `initial_firm_notification`, `keep_out_of_reach_of_children`, `label_version`, `latest_submission_class`, `manufacturer`, `mechanism_of_action`, `more_code_info`, `overdosage`, `package_label`, `package_ndc`, `packaging`, `patient_age`, `patient_age_group`, `patient_age_unit`, `patient_sex`, `patient_weight_kg`, `pediatric_use`, `pharm_class_cs`, `pharm_class_epc`, `pharm_class_moa`, `pharm_class_pe`, `precautions`, `pregnancy`, `product_description`, `product_ndc`, `product_quantity`, `purpose`, `questions`, `reaction_outcomes`, `reactions`, `reason`, `recalling_firm`, `recent_major_changes`, `reference_drug`, `reference_standard`, `report_version`, `reporter_qualification`, `review_priority`, `route`, `rxcui`, `sender_organization`, `serious`, `serious_congenital_anomaly`, `serious_death`, `serious_disabling`, `serious_hospitalization`, `serious_life_threatening`, `serious_other`, `stop_use`, `storage_and_handling`, `strength`, `substance`, `suspect_drugs`, `te_code`, `unii`, `upc`, `warnings`, `warnings_and_cautions`, `when_using`

### Input example

```json
{
  "dataset": "drug_approval",
  "search": "semaglutide",
  "max_items": 10
}
```

The default input is deliberately bounded and produces a small, useful Store test. `max_items` is a hard output ceiling.

### Output example

A real record returned by the input above, abridged to fit:

```json
{
  "dataset": "drug_approval",
  "id": "NDA213051",
  "application_number": "NDA213051",
  "application_type": "NDA",
  "brand_name": "OZEMPIC",
  "generic_name": "ORAL SEMAGLUTIDE",
  "manufacturer": "Novo Nordisk Pharmaceutical Industries, LP",
  "sponsor_name": "NOVO",
  "substance": "SEMAGLUTIDE",
  "strength": "9MG",
  "dosage_form": "TABLET",
  "route": "ORAL",
  "product_type": "HUMAN PRESCRIPTION DRUG",
  "marketing_status": "Prescription",
  "reference_drug": "Yes",
  "reference_standard": "Yes",
  "product_number": "006",
  "product_count": 6,
  "rxcui": "2200644, 2200650, 2200652, 2200654, 2200656, 2200658",
  "unii": "53AXN4NNHX",
  "spl_set_id": "27f15fac-7d98-4114-a2ec-92494a91da98",
  "pharm_class_epc": "GLP-1 Receptor Agonist [EPC]",
  "pharm_class_moa": "Glucagon-like Peptide-1 (GLP-1) Agonists [MoA]",
  "approval_date": "20190920",
  "review_priority": "PRIORITY",
  "latest_submission_date": "20260130",
  "latest_submission_type": "SUPPL",
  "latest_submission_class": "Labeling",
  "submission_count": 13,
  "supplement_count": 12,
  "label_url": "https://www.accessdata.fda.gov/drugsatfda_docs/label/2026/213051Orig1s030lbl.pdf",
  "approval_letter_url": "https://www.accessdata.fda.gov/drugsatfda_docs/appletter/2026/213051Orig1s030ltr.pdf"
}
```

Columns are the same for every row of a given dataset, so a CSV export never shifts. Fields the selected dataset does not carry - NDC on device recalls, for instance - are returned as null rather than dropped or merged into another column.

### Common use cases

- Drug and device safety research
- Recall monitoring
- Regulatory and product intelligence
- Building FDA reference datasets

### Use with AI agents and MCP

Apify's MCP server can discover and call this Actor from an AI workflow. Example intent:

> Return 10 FDA drug approval records matching semaglutide.

Use the JSON from **Input example** as the tool arguments. The strict input schema rejects unsupported parameters, and the documented dataset schema tells the agent how to interpret each returned field.

### Pricing and cost control

Output is billed per result at **$0.002 per result** (about $2.00 per 1,000 results), plus a $0.0005 Actor-start charge billed once per gigabyte of memory at run start. Use `max_items` to cap both output volume and charges. The price shown on the Apify Store listing is authoritative.

`max_items` limits both output volume and result-based charges. Start with 10 records, inspect them, and then scale deliberately.

### Reliability

The Actor validates input, bounds pagination, retries transient upstream failures, writes structured records, and fails explicitly when the source cannot produce usable output. A production default-input canary is monitored by the fleet.

### Limitations and responsible use

- Adverse-event reports do not establish causation.
- Fields vary by selected FDA dataset and can be absent.
- Search syntax and coverage are governed by openFDA.
- This is public data retrieval, not medical or regulatory advice.

Use the data lawfully, respect source terms, and independently validate records before making consequential decisions.

### FAQ

#### Does it need my own API key?

No, the default workflow does not require a customer-supplied API key.

#### Can I export the results?

Yes. Download the default dataset as JSON, CSV, Excel, or XML, or retrieve it through the Apify API.

#### How do I control cost?

Set `max_items` to the most records you want returned. Begin with the bounded default input.

#### Can an AI agent call it?

Yes. The Actor has strict input and semantic output schemas and can be called through Apify's MCP tooling.

#### What happens when a source field is missing?

The relevant field is returned as null or an empty normalized value rather than being merged into another field.

# Actor input Schema

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

Which FDA dataset to search.

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

openFDA query syntax. A plain word works, or target a field: openfda.manufacturer\_name:"Pfizer"

## `max_items` (type: `integer`):

Hard cap on records returned. Also caps your spend.

## `include_details` (type: `boolean`):

Look up each result's product NDC in the FDA NDC Directory to add labeler, marketing category, marketing start/end dates, listing expiration and DEA schedule. Costs one extra request per 20 records, not per record. Has no effect on drug approvals or device recalls, which carry no product-level NDC.

## Actor input object example

```json
{
  "dataset": "drug_approval",
  "search": "metformin",
  "max_items": 10,
  "include_details": false
}
```

# Actor output Schema

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

Structured records from the default dataset.

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

// Run the Actor and wait for it to finish
const run = await client.actor("captainhandsome/openfda-search").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 = { "search": "metformin" }

# Run the Actor and wait for it to finish
run = client.actor("captainhandsome/openfda-search").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 '{
  "search": "metformin"
}' |
apify call captainhandsome/openfda-search --silent --output-dataset

```

## MCP server setup

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

```

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/m8bcLVeTuEqTyNa3K/builds/s652WXlJPVLdIxv3d/openapi.json
