# OpenFDA Drug Intelligence, Approvals, Recalls & Safety Scraper (`trusted_tech_spot/openfda-drug-approvals-recalls-safety-scraper`) Actor

Scrape official FDA drug labels, NDC numbers, active ingredients, clinical indications, adverse events, and ongoing enforcement recalls via openFDA API.

- **URL**: https://apify.com/trusted_tech_spot/openfda-drug-approvals-recalls-safety-scraper.md
- **Developed by:** [David Sandor](https://apify.com/trusted_tech_spot) (community)
- **Categories:** Business, Developer tools, AI
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

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

## 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 Drug Intelligence, Approvals, Recalls & Safety Scraper 💊

[![Apify Actor](https://img.shields.io/badge/Apify-Actor-orange.svg?style=flat-square)](https://apify.com/trusted_tech_spot/openfda-drug-approvals-recalls-safety-scraper)
[![Pay Per Event](https://img.shields.io/badge/Pricing-Pay%20Per%20Result%20\($0.002\)-green.svg?style=flat-square)](https://apify.com/trusted_tech_spot/openfda-drug-approvals-recalls-safety-scraper)
[![Zero Maintenance](https://img.shields.io/badge/Maintenance-Zero%20Maintenance-blue.svg?style=flat-square)](https://apify.com/trusted_tech_spot/openfda-drug-approvals-recalls-safety-scraper)
[![FDA Official](https://img.shields.io/badge/Data%20Source-Official%20openFDA%20API-red.svg?style=flat-square)](https://open.fda.gov)
[![RAG Ready](https://img.shields.io/badge/AI%20%2F%20RAG-Token%20Chunking%20Included-purple.svg?style=flat-square)](https://apify.com/trusted_tech_spot/openfda-drug-approvals-recalls-safety-scraper)
[![v3.0 Enriched](https://img.shields.io/badge/Data%20Enrichment-v3.0%20Enterprise%20\(20%2B%20Fields\)-success.svg?style=flat-square)](https://apify.com/trusted_tech_spot)

Instant, turnkey extraction of official **U.S. FDA Drug Labels**, **NDC package numbers**, **Active Ingredients**, **Clinical Indications**, **Boxed Warnings**, **FDA Adverse Event Reporting System (FAERS)** records, and **Enforcement Product Recalls** via the official openFDA regulatory database.

> ⚡ **Instant Data Scraper Guarantee (No Setup Required)**:
>
> - 🟢 **Zero-Config**: No proxies, FDA API keys, or browser setups required.
> - 🚀 **1-Click Free Test**: Just click the green **"Save & Start"** button with the pre-filled inputs to test live data extraction in < 2 seconds.
> - 📊 **Instant Export**: Download verified pharmaceutical intelligence directly to **Excel (.xlsx)**, **CSV**, or **JSON**.
> - 🇺🇸 **100% Official U.S. Federal Data**: Clean, structured regulatory datasets optimized for healthcare AI agents, clinical research, pharmacovigilance, and CRM pipelines.

***

#### ⚡ Ready-to-Run Input Preview (Zero Configuration Required)

You don't need to write code or configure complex parameters. The Actor comes completely pre-configured:

| Setting | What You Provide | Default Value (Ready to Run) | Quick Link |
| :--- | :--- | :--- | :--- |
| **Target Drug or Pharmaceutical Firm** | Brand name, generic compound, NDC, or firm | `"aspirin"` | [👉 Run with Default Values](https://console.apify.com/actors/trusted_tech_spot/openfda-drug-approvals-recalls-safety-scraper/input) |
| **Search Category** | Labels, Recalls, or Adverse Events | `"labels"` | [👉 Select FDA Category](https://console.apify.com/actors/trusted_tech_spot/openfda-drug-approvals-recalls-safety-scraper/input) |
| **Maximum Records** | Number of regulatory records to return | `20` (Sub-2s quick test) | [👉 Open Input Tab](https://console.apify.com/actors/trusted_tech_spot/openfda-drug-approvals-recalls-safety-scraper/input) |

> 💡 **Tip**: Click the green **"Start"** button in Apify Console to run your first test immediately with zero changes.

***

### 🔍 Click to View Live Sample Output Data (JSON Preview)

<details open>
<summary><strong>💊 1. Drug Label, Approvals & Clinical Safety (searchType: "labels")</strong></summary>

```json
{
  "query": "aspirin",
  "searchType": "labels",
  "totalExtracted": 1,
  "records": [
    {
      "id": "label-008ee85b-5cac-45a6-a857-a828f8125175",
      "brandName": "Low Dose Aspirin",
      "genericName": "ASPIRIN",
      "substanceName": "ASPIRIN",
      "activeIngredients": "Aspirin 81 mg (NSAID)* *nonsteroidal anti-inflammatory drug",
      "route": "ORAL",
      "dosageForm": "TABLET, DELAYED RELEASE",
      "manufacturerName": "P & L Development, LLC",
      "applicationNumber": "ANDA020456",
      "marketingCategory": "HUMAN OTC DRUG",
      "productNdc": "59726-065",
      "packageNdc": "59726-065-30",
      "indicationsAndUsage": "Temporarily relieves minor aches and pains or as recommended by your physician for adult cardiovascular regimen.",
      "warningsAndPrecautions": "Reye's syndrome warning: Children and teenagers who have or are recovering from chicken pox or flu-like symptoms should not use this product. Stomach bleeding warning: this product contains an NSAID.",
      "hasBoxedWarning": false,
      "contraindications": "Do not use if allergic to active compounds or contraindicated by primary care physician.",
      "pharmClass": "Platelet Aggregation Inhibitor [EPC]; Decreased Prostaglandin Production [PE]",
      "regulatoryRiskTier": "Low (Standard OTC / Rx Guidance)",
      "fdaComplianceBadge": "FDA Approved Application (ANDA020456)",
      "verificationUrl": "https://dailymed.nlm.nih.gov/dailymed/search.cfm?labeltype=all&query=59726-065",
      "_dataQualityScore": 100,
      "_deduplicationFingerprint": "sha256:7f83b1657ff1fc53b92dc18148a1d65dfc2d4b1fa3d677284addd200126d9069"
    }
  ]
}
```

</details>

<details>
<summary><strong>🚨 2. FDA Enforcement Actions & Product Recalls (searchType: "recalls")</strong></summary>

```json
{
  "query": "aspirin",
  "searchType": "recalls",
  "totalExtracted": 1,
  "records": [
    {
      "id": "recall-D-844-2013",
      "recallNumber": "D-844-2013",
      "classification": "Class II",
      "recallStatus": "Terminated",
      "recallingFirm": "Novartis Consumer Health",
      "productDescription": "Excedrin Migraine (Acetaminophen 250 mg, Aspirin (NSAID) 250 mg and Caffeine 65 mg), 2-count pouches.",
      "reasonForRecall": "Defective container: products are packaged in pouches which may not have been fully sealed.",
      "distributionPattern": "Nationwide: US, Puerto Rico, Brazil and Panama.",
      "voluntaryOrMandated": "Voluntary: Firm Initiated",
      "recallInitiationDate": "20130514",
      "terminationDate": "20140210",
      "brandName": "Excedrin Migraine",
      "genericName": "ACETAMINOPHEN, ASPIRIN, CAFFEINE",
      "productNdc": "0067-2000",
      "manufacturerName": "Novartis Consumer Health",
      "city": "Parsippany",
      "state": "NJ",
      "country": "US",
      "regulatoryRiskTier": "Substantial (Reversible Adverse Risk - Class II)",
      "fdaComplianceBadge": "Recall Closed / Resolved",
      "verificationUrl": "https://www.fda.gov/safety/recalls-market-withdrawals-safety-alerts"
    }
  ]
}
```

</details>

<details>
<summary><strong>⚠️ 3. FAERS Adverse Drug Reaction Reports (searchType: "adverse_events")</strong></summary>

```json
{
  "query": "aspirin",
  "searchType": "adverse_events",
  "totalExtracted": 1,
  "records": [
    {
      "id": "faers-10003304",
      "reportId": "10003304",
      "receiveDate": "20240312",
      "isSerious": false,
      "seriousnessCriteria": [],
      "primaryCountry": "US",
      "patientDemographics": {
        "age": "62 years",
        "sex": "Female"
      },
      "primaryDrug": "ASPIRIN",
      "drugCharacterization": "Suspect Drug",
      "indication": "Cardiovascular prophylaxis",
      "reportedReactions": [
        "Drug hypersensitivity",
        "Urticaria"
      ],
      "brandName": "ASPIRIN",
      "genericName": "ASPIRIN",
      "manufacturerName": "Bayer Healthcare LLC",
      "regulatoryRiskTier": "Standard Non-Serious Event",
      "fdaComplianceBadge": "FAERS Post-Market Safety Surveillance",
      "verificationUrl": "https://open.fda.gov/data/faers/"
    }
  ]
}
```

</details>

***

### 📊 Comprehensive Data Extraction Coverage

| Data Domain | Extracted Attribute | Business & Clinical Value |
|:---|:---|:---|
| 🏷️ **Product Identity** | `brandName`, `genericName`, `substanceName`, `activeIngredients` | Standardized molecular and chemical drug names for formulary matching. |
| 💊 **Formulation & Delivery** | `route`, `dosageForm` | Clarifies administration route (ORAL, TOPICAL, INTRAVENOUS) and form (TABLET, SOLUTION). |
| 🏛️ **Regulatory Approval** | `applicationNumber`, `marketingCategory`, `productNdc`, `packageNdc` | Identifies NDA (New Drug), ANDA (Generic), or BLA (Biologic) regulatory filing numbers. |
| 🏢 **Manufacturer & Labeler** | `manufacturerName`, `recallingFirm`, `city`, `state` | Corporate manufacturing entity identification for supply chain diligence. |
| 📋 **Clinical Indications** | `indicationsAndUsage`, `pharmClass` | Medical purpose, symptoms treated, and pharmacological class (EPC / MoA). |
| ⚠️ **Safety & Precautions** | `warningsAndPrecautions`, `hasBoxedWarning`, `contraindications` | Crucial safety disclosures, contraindications, and FDA Black Box warnings. |
| 🚨 **Recall & Enforcement** | `recallNumber`, `classification`, `recallStatus`, `reasonForRecall`, `distributionPattern` | Class I (critical), Class II (reversible), or Class III enforcement recall metrics. |
| 📉 **Adverse Drug Reactions** | `reportId`, `isSerious`, `seriousnessCriteria`, `reportedReactions`, `patientDemographics` | Post-market FAERS patient demographic data, seriousness outcomes, and adverse reactions. |
| 🛡️ **Pharma Intelligence** | `regulatoryRiskTier`, `fdaComplianceBadge`, `verificationUrl` | Derived risk classifications and direct links to DailyMed / FDA safety portals. |

***

### 📊 Export to CSV / Excel in 1-Click

Download clean, formatted data directly without writing a single line of code:

- **Microsoft Excel (.xlsx)**: Pivot-ready spreadsheet with verified formatting for regulatory affairs.
- **CSV Format**: Instantly upload into clinical databases, ERP systems, Salesforce Health Cloud, or Google Sheets.
- **JSON / API**: Feed real-time drug intelligence into your webhooks, n8n, Make, or custom microservices.

***

### ✨ Enterprise v3.0 Data Enrichment (Included Free)

This actor is powered by the **v3.0 Enterprise Data Enrichment Engine**. Every record is automatically validated, normalized, and enriched with **20+ derived high-value fields** at **zero additional cost and < 3ms execution overhead**:

| Enrichment Capability | What It Delivers | How It Helps Your Healthcare & Pharma Workflow |
|:---|:---|:---|
| 🛡️ **Data Quality Score (0–100%)** | `_dataQualityScore: 100` | Instantly filter out sparse records before ingestion into clinical databases. |
| 🔑 **Deduplication Fingerprint** | `_deduplicationFingerprint: "sha256:..."` | Cryptographic entity hash for 100% idempotent database upserts. |
| ⚖️ **Regulatory Risk Tier** | `regulatoryRiskTier` | Automatically flags Black Box warnings, Class I recalls, or serious adverse outcomes. |
| 🏅 **FDA Compliance Badge** | `fdaComplianceBadge` | Categorizes NDA vs ANDA vs OTC monograph vs active enforcement action. |
| 🧹 **Text Normalization** | Cleaned excerpts & Unicode | Strips broken HTML/XML tags and formatting artifacts from raw label text. |
| 🧠 **AI Vector & RAG Chunking** | `_rag: { estimatedTokens, chunksCount, chunks }` | Pre-chunked into semantic chunks ready for LangChain, LlamaIndex & Vector DBs. |
| ⚡ **3-Tier Configurable Depth** | `Enriched` (Default), `Standard`, `Basic` | Choose full enterprise enrichment, clean standard fields, or ultra-fast raw extract. |

***

### 📥 Input Parameters

All parameters come pre-filled with sensible defaults so you can run the Actor right away:

| Parameter | Type | Required | Default / Prefill | Description |
|:---|:---|:---:|:---:|:---|
| **Target Drug or Firm** (`drugNameOrFirm`) | `string` | No | `"aspirin"` | Brand name, generic molecule, substance, NDC, or recalling firm (e.g., "aspirin", "lipitor", "pfizer") |
| **Search Category** (`searchType`) | `string` | No | `"labels"` | FDA database: `"labels"` (Labels & Approvals), `"recalls"` (Enforcement Recalls), or `"adverse_events"` (FAERS) |
| **Max Records Limit** (`maxResults`) | `integer` | No | `20` | Maximum number of regulatory records to harvest (1 to 100) |
| **Include Keywords (Filter)** (`includeKeywords`) | `string` | No | `""` | Comma-separated terms to filter results (e.g., "tablets, oral, pain") |
| **Exclude Keywords (Filter)** (`excludeKeywords`) | `string` | No | `""` | Filter out results containing these comma-separated terms |
| **Enable AI / RAG Token Chunking** (`enableRagEnrichment`) | `boolean` | No | `true` | Generate semantic vector chunks and token counts for LLMs |
| **Data Enrichment Tier** (`enrichmentMode`) | `string` | No | `"Enriched"` | `Enriched` (20+ fields), `Standard` (core fields), or `Basic` (raw) |
| **Preferred Output Format** (`outputFormat`) | `string` | No | `"JSON"` | Output format preference: `JSON`, `Markdown`, or `Flat` |

***

### 🎯 Common High-Impact Use Cases

- 🏥 **Pharmacovigilance & Safety Monitoring**: Track post-market FAERS reports and adverse reactions for any medicinal product.
- 💊 **Competitive Intelligence & Generic Entry**: Monitor FDA approvals, ANDA applications, formulation routes, and NDC packaging.
- 🚨 **Supply Chain & Pharmacy Recall Alerts**: Instantly audit active Class I, Class II, and Class III FDA recalls by manufacturer firm or drug name.
- 🤖 **Healthcare AI & Clinical Decision Support (CDSS)**: Ingest structured indications, contraindications, and boxed warnings into RAG knowledge bases.
- 📋 **Formulary Management & PBM Audits**: Verify active NDC codes, labeler names, and marketing categories against payer master lists.

***

### 💻 Developer API & Workflow Integrations

#### 1. cURL / Direct API Execution

```bash
curl -X POST "https://api.apify.com/v2/acts/trusted_tech_spot~openfda-drug-approvals-recalls-safety-scraper/runs?token=YOUR_APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "drugNameOrFirm": "ibuprofen",
    "searchType": "labels",
    "maxResults": 10
  }'
```

***

#### 2. Node.js (`apify-client`)

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

const client = new ApifyClient({
    token: 'YOUR_APIFY_TOKEN',
});

// Run actor with custom parameters
const run = await client.actor('trusted_tech_spot/openfda-drug-approvals-recalls-safety-scraper').call({
    drugNameOrFirm: 'atorvastatin',
    searchType: 'labels',
    maxResults: 25
});

// Fetch structured items from the dataset
const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.log(`Extracted regulatory intelligence:`, items);
```

***

#### 3. Python (`apify-client`)

```python
from apify_client import ApifyClient

client = ApifyClient("YOUR_APIFY_TOKEN")

## Run actor to monitor active drug recalls
run = client.actor("trusted_tech_spot/openfda-drug-approvals-recalls-safety-scraper").call(run_input={
    "drugNameOrFirm": "metformin",
    "searchType": "recalls",
    "maxResults": 20
})

## Fetch dataset items
items = client.dataset(run["defaultDatasetId"]).list_items().items
for item in items:
    for record in item.get("records", []):
        print(f"Recall: {record.get('recallNumber')} | Firm: {record.get('recallingFirm')} | Risk: {record.get('regulatoryRiskTier')}")
```

***

#### 4. n8n Automation Workflow

Connect this Actor to your **n8n** automation pipeline to receive automated Slack, email, or webhook alerts whenever new FDA recalls or adverse events are reported:

```json
{
  "nodes": [
    {
      "parameters": {
        "method": "POST",
        "url": "https://api.apify.com/v2/acts/trusted_tech_spot~openfda-drug-approvals-recalls-safety-scraper/run-sync-get-dataset-items?token=YOUR_APIFY_TOKEN",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "{\n  \"drugNameOrFirm\": \"aspirin\",\n  \"searchType\": \"recalls\",\n  \"maxResults\": 10\n}"
      },
      "id": "1",
      "name": "Trigger OpenFDA Scraper",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [250, 300]
    }
  ]
}
```

***

#### 5. Make.com (Integromat) Workflow

1. Create a new scenario in **Make.com**.
2. Add an **HTTP — Make a request** module:
   - **URL**: `https://api.apify.com/v2/acts/trusted_tech_spot~openfda-drug-approvals-recalls-safety-scraper/run-sync-get-dataset-items?token=YOUR_APIFY_TOKEN`
   - **Method**: `POST`
   - **Body type**: `Raw (application/json)`
   - **Request content**: `{"drugNameOrFirm": "acetaminophen", "searchType": "labels", "maxResults": 15}`
3. Add a **Google Sheets — Add a row** or **Slack — Send message** module to auto-archive new drug safety updates!

***

#### 6. LangChain RAG & Vector Ingestion (Healthcare AI)

```python
from apify_client import ApifyClient
from langchain_community.vectorstores import Chroma
from langchain_openai import OpenAIEmbeddings
from langchain_core.documents import Document

## 1. Fetch pre-chunked dataset from Apify
client = ApifyClient("YOUR_APIFY_TOKEN")
run = client.actor("trusted_tech_spot/openfda-drug-approvals-recalls-safety-scraper").call(run_input={
    "drugNameOrFirm": "pembrolizumab",
    "searchType": "labels",
    "enableRagEnrichment": True
})
items = client.dataset(run["defaultDatasetId"]).list_items().items

## 2. Extract semantic chunks directly into LangChain documents
docs = []
for item in items:
    chunks = item.get("_rag", {}).get("chunks", [str(item)])
    for chunk in chunks:
        docs.append(Document(
            page_content=chunk,
            metadata={"source": "openfda-drug-intelligence", "query": item.get("query")}
        ))

## 3. Ingest into ChromaDB / Pinecone vector store
vector_store = Chroma.from_documents(docs, OpenAIEmbeddings())
print(f"Successfully indexed {len(docs)} clinical drug knowledge chunks into Vector DB!")
```

***

### ❓ Frequently Asked Questions (FAQ)

<details>
<summary><strong>Is the extracted drug data official and up to date?</strong></summary>
Yes. All data is queried live from the official U.S. Food and Drug Administration (openFDA) public API and cross-referenced with the National Library of Medicine (NLM) DailyMed regulatory indexes.
</details>

<details>
<summary><strong>Do I need an FDA API key or proxy subscription?</strong></summary>
No. The Actor handles all requests natively with zero API key configuration and zero proxy overhead required.
</details>

<details>
<summary><strong>Can I query by pharmaceutical firm name instead of drug name?</strong></summary>
Yes! In the `recalls` mode, entering a firm name (e.g., "Pfizer", "Novartis", "Teva") extracts all ongoing or completed enforcement recalls associated with that manufacturer.
</details>

<details>
<summary><strong>Can I schedule this Actor to run automatically every week?</strong></summary>
Yes. You can use Apify's built-in **Schedules** tab to run this Actor weekly or daily, sending fresh regulatory data directly to your webhook, email, or Google Drive.
</details>

***

### 💬 Technical Support & Custom Demands

Need specialized biomedical feeds, custom NDC mapping, EHR integrations, or enterprise SLA support?

- 🐛 **Open an Issue**: Open a ticket on the [Actor Issues Tab](https://console.apify.com/actors/trusted_tech_spot/openfda-drug-approvals-recalls-safety-scraper/issues) for 24-hour engineer response.
- ✉️ **Direct Email Support**: Reach out to **contact@trustedtechspot.com** for custom scraping jobs or dedicated endpoints.
- 💡 **Feature Requests**: Request new endpoints (medical devices, veterinary drugs, food recalls) anytime.

***

### 🔒 Privacy & Regulatory Disclaimer

- **OpenFDA Regulatory Notice**: Data sourced from official openFDA API. OpenFDA and FDA do not validate individual records for clinical liability. This tool is designed for research, compliance, and intelligence workflows and is not a substitute for professional medical advice.
- **Enterprise Grade Sanitization**: Automatically scrubs sensitive headers and tracking parameters before saving data.

***

#### 🏷️ Search & Discovery Keywords

`openfda scraper` • `fda drug recalls` • `drug label api` • `ndc code finder` • `faers adverse events` • `boxed warning database` • `pharmaceutical intelligence` • `clinical decision support` • `apify actor` • `healthcare data scraper 2026`

# Actor input Schema

## `drugNameOrFirm` (type: `string`):

Target drug brand name, active generic compound, substance, NDC, or recalling firm (e.g. "aspirin", "ibuprofen", "lipitor", "pfizer")

## `searchType` (type: `string`):

Select FDA database to query: 'labels' (Drug Labels, Active Ingredients, Indications, Boxed Warnings), 'recalls' (Enforcement Actions & Product Recalls), or 'adverse_events' (FAERS Adverse Reaction Reports)

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

Maximum number of regulatory records to return (1-100)

## `includeKeywords` (type: `string`):

Filter results to only include items containing these comma-separated keywords

## `excludeKeywords` (type: `string`):

Filter out results containing these comma-separated keywords

## `enableRagEnrichment` (type: `boolean`):

Automatically compute OpenAI token counts and generate semantic vector chunks for RAG pipelines

## `outputFormat` (type: `string`):

Format results for preferred downstream consumer (e.g. JSON, Markdown, Flat)

## `enrichmentMode` (type: `string`):

Choose enrichment depth: 'Enriched' adds 20+ derived fields (quality score, regulatory risk tier, deduplication fingerprint), 'Standard' includes core clean fields, 'Basic' is ultra-fast raw extract.

## Actor input object example

```json
{
  "drugNameOrFirm": "aspirin",
  "searchType": "labels",
  "maxResults": 20,
  "includeKeywords": "",
  "excludeKeywords": "",
  "enableRagEnrichment": true,
  "outputFormat": "JSON",
  "enrichmentMode": "Enriched"
}
```

# Actor output Schema

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

Structured output and extracted drug intelligence, recalls, and adverse event data from openFDA

# 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 = {
    "drugNameOrFirm": "aspirin",
    "searchType": "labels",
    "maxResults": 20,
    "includeKeywords": "",
    "excludeKeywords": "",
    "enableRagEnrichment": true,
    "outputFormat": "JSON",
    "enrichmentMode": "Enriched"
};

// Run the Actor and wait for it to finish
const run = await client.actor("trusted_tech_spot/openfda-drug-approvals-recalls-safety-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 = {
    "drugNameOrFirm": "aspirin",
    "searchType": "labels",
    "maxResults": 20,
    "includeKeywords": "",
    "excludeKeywords": "",
    "enableRagEnrichment": True,
    "outputFormat": "JSON",
    "enrichmentMode": "Enriched",
}

# Run the Actor and wait for it to finish
run = client.actor("trusted_tech_spot/openfda-drug-approvals-recalls-safety-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 '{
  "drugNameOrFirm": "aspirin",
  "searchType": "labels",
  "maxResults": 20,
  "includeKeywords": "",
  "excludeKeywords": "",
  "enableRagEnrichment": true,
  "outputFormat": "JSON",
  "enrichmentMode": "Enriched"
}' |
apify call trusted_tech_spot/openfda-drug-approvals-recalls-safety-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,trusted_tech_spot/openfda-drug-approvals-recalls-safety-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/OeAbS1P9W66Oq7rkS/builds/XgpCvVhbvIR5CA2Kz/openapi.json
