# openFDA Recalls & Adverse Events (`tidydata69/openfda-recalls-events`) Actor

Fetch FDA recall/enforcement reports and optional FAERS adverse events via openFDA (api.fda.gov). Public domain (CC0) with attribution.

- **URL**: https://apify.com/tidydata69/openfda-recalls-events.md
- **Developed by:** [Bryce](https://apify.com/tidydata69) (community)
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.00 / 1,000 fda records

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/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 Recalls & Adverse Events

Fetch **FDA recall / enforcement reports** and optional **FAERS adverse events** via the official **[openFDA](https://open.fda.gov/)** API (`https://api.fda.gov/`).

This Actor is an **API client only**. Data is generally **public domain / CC0** — each row includes an `attribution` field.

### Endpoints

| Dataset input | Endpoint |
| --- | --- |
| `food-enforcement` | `/food/enforcement.json` |
| `drug-enforcement` | `/drug/enforcement.json` |
| `device-enforcement` | `/device/enforcement.json` |
| `faers` | `/drug/event.json` |

### Input

- **datasets** (required) — one or more endpoint keys above
- **search** — openFDA search string (e.g. `status:Ongoing`)
- **limit** / **pageSize** / **skip** — pagination
- **apiKey** — optional openFDA key for higher rate limits
- **requestDelayMs** — polite delay (default 500)

#### Example

```json
{
  "datasets": ["food-enforcement", "drug-enforcement"],
  "search": "status:Ongoing",
  "limit": 25,
  "pageSize": 25
}
```

### Pricing (pay-per-event)

| Event | Price | Notes |
| --- | --- | --- |
| `apify-actor-start` | **$0.002** | Synthetic Actor start |
| `record` | **$0.001** | One enforcement or FAERS row |

### Licensing & attribution

openFDA content is generally available under **CC0 / public domain**. Reusers should still cite openFDA / FDA. See https://open.fda.gov/license/ and https://open.fda.gov/terms/. **Not for medical decision-making.**

### Limitations & rules

- No HTML scraping; API only.
- Anonymous rate limits apply; supply `apiKey` for production volume.
- openFDA `skip` is capped (~25,000); use `search` to narrow.
- FAERS rows are summarized (counts + key ids) to keep dataset size practical; full nested patient/drug blobs are truncated in mapped fields.

### Use cases

- Monitor ongoing FDA recalls by firm or product
- Build compliance / safety research datasets
- Optional FAERS adverse-event sampling

# Actor input Schema

## `datasets` (type: `array`):

Which openFDA endpoints to query. Enforcement = recalls. faers = FAERS adverse events (drug/event).

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

openFDA search syntax (Lucene-like). Example: recalling_firm:"Pfizer" or status:Ongoing. Leave empty for unfiltered (recent) pages.

## `limit` (type: `integer`):

Hard cap across all selected datasets.

## `pageSize` (type: `integer`):

openFDA limit per request (1–1000; practical default 100).

## `skip` (type: `integer`):

Starting skip offset for the first page of each dataset.

## `apiKey` (type: `string`):

Optional api.fda.gov key for higher rate limits. Leave empty for anonymous access.

## `requestDelayMs` (type: `integer`):

Polite delay. Anonymous openFDA is rate-limited; default 500ms.

## Actor input object example

```json
{
  "datasets": [
    "food-enforcement",
    "drug-enforcement"
  ],
  "search": "status:Ongoing",
  "limit": 25,
  "pageSize": 25,
  "skip": 0,
  "requestDelayMs": 500
}
```

# Actor output Schema

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

Enforcement (recall) and optional FAERS adverse-event records from openFDA. CC0 — see attribution field.

# 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 = {
    "datasets": [
        "food-enforcement",
        "drug-enforcement"
    ],
    "search": "status:Ongoing",
    "limit": 25,
    "pageSize": 25,
    "requestDelayMs": 500
};

// Run the Actor and wait for it to finish
const run = await client.actor("tidydata69/openfda-recalls-events").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 = {
    "datasets": [
        "food-enforcement",
        "drug-enforcement",
    ],
    "search": "status:Ongoing",
    "limit": 25,
    "pageSize": 25,
    "requestDelayMs": 500,
}

# Run the Actor and wait for it to finish
run = client.actor("tidydata69/openfda-recalls-events").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 '{
  "datasets": [
    "food-enforcement",
    "drug-enforcement"
  ],
  "search": "status:Ongoing",
  "limit": 25,
  "pageSize": 25,
  "requestDelayMs": 500
}' |
apify call tidydata69/openfda-recalls-events --silent --output-dataset

```

## MCP server setup

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

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/o2W7zXi1fI2A1uYC4/builds/7BaX05H1PYsB0j7J0/openapi.json
