# openFDA Drug / Device / Food Recalls (`knotless_snowcrab/openfda-recalls`) Actor

Fetch FDA enforcement / recall reports from the public openFDA API (drug, device, food). Filter by product type, status, classification, firm, keyword, and report-date window. Structured JSON with recall numbers, reasons, and firm details. No API key required.

- **URL**: https://apify.com/knotless_snowcrab/openfda-recalls.md
- **Developed by:** [Yunus Vurgun](https://apify.com/knotless_snowcrab) (community)
- **Categories:** AI, News, Developer tools
- **Security:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 95.5% 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 / Device / Food Recalls

Fetches **FDA enforcement / recall** reports from the [public openFDA API](https://open.fda.gov/apis/drug/enforcement/) (drug, device, and food) and saves structured rows to the Actor dataset.

No API key required. Not Turkey/Türkiye-specific. Useful for compliance monitoring, supply-chain risk, and newsroom/health research workflows.

> Disclaimer (from openFDA): do not rely on openFDA alone for medical-care decisions; treat results as unvalidated public data.

### Also by this publisher

- [Federal Register Notices](https://apify.com/knotless_snowcrab/federal-register-notices) — US Federal Register documents via the public API
- [SEC EDGAR Company Filings](https://apify.com/knotless_snowcrab/sec-edgar-filings) — 10-K / 10-Q / 8-K / Form 4 metadata via public SEC APIs
- [NIST NVD CVE Feed](https://apify.com/knotless_snowcrab/nist-nvd-cves) — CVEs from the public NIST NVD API 2.0

### Input

| Field | Description |
|---|---|
| `productTypes` | One or more of `drug`, `device`, `food` (default: all three). |
| `status` | Optional: `Ongoing`, `Terminated`, `Completed`. |
| `classification` | Optional: `Class I`, `Class II`, `Class III`. |
| `recallingFirm` | Optional firm-name substring. |
| `keyword` | Optional free-text over product description / recall reason. |
| `reportStartDate` / `reportEndDate` | Report-date window (`YYYY-MM-DD`). Defaults to last 30 days (UTC). |
| `maxItems` | Cap on saved rows (1–5000, default 50). |
| `limitPerPage` | Page size 1–100 (default 100). |
| `requestDelayMs` | Pause between requests (default 250). |

### Output

Each dataset item includes: `productType`, `status`, `classification`, `recallNumber`, `eventId`, `recallingFirm`, `city`/`state`/`country`, `reportDate`, `recallInitiationDate`, `productDescription`, `reasonForRecall`, `productQuantity`, `voluntaryMandated`, `distributionPattern`, `codeInfo`, `openFdaUrl`.

### Local run

```bash
cd openfda-recalls
python3 -m venv .venv && .venv/bin/pip install -r requirements.txt
apify run --purge -i '{"productTypes":["drug"],"status":"Ongoing","classification":"Class I","maxItems":5,"requestDelayMs":100}'
```

### Rate limits

openFDA is public and free. Keep runs modest for demos; raise `requestDelayMs` if you see HTTP 429. An optional openFDA API key is **not** used by this Actor (no user signup required).

### Sources

- openFDA Drug Enforcement: https://open.fda.gov/apis/drug/enforcement/
- openFDA Device Enforcement: https://open.fda.gov/apis/device/enforcement/
- openFDA Food Enforcement: https://open.fda.gov/apis/food/enforcement/
- API base: https://api.fda.gov/{drug|device|food}/enforcement.json
- Apify publishing: https://docs.apify.com/platform/actors/publishing

# Actor input Schema

## `productTypes` (type: `array`):

Which openFDA enforcement endpoints to query. Default: drug, device, food.

## `status` (type: `string`):

Optional openFDA status filter (e.g. Ongoing, Terminated).

## `classification` (type: `string`):

Optional FDA class: Class I (most serious), Class II, Class III.

## `recallingFirm` (type: `string`):

Optional firm name search (openFDA field recalling_firm).

## `keyword` (type: `string`):

Optional free-text search across product_description and reason_for_recall.

## `reportStartDate` (type: `string`):

Inclusive report_date start. Defaults to 30 days ago (UTC).

## `reportEndDate` (type: `string`):

Inclusive report_date end. Defaults to today (UTC).

## `maxItems` (type: `integer`):

Maximum recall rows to save across all product types (1–5000).

## `limitPerPage` (type: `integer`):

openFDA page size (1–100). Default 100.

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

Polite pause between openFDA pages/endpoints. Default 250.

## Actor input object example

```json
{
  "productTypes": [
    "drug",
    "device",
    "food"
  ],
  "status": "Ongoing",
  "classification": "Class I",
  "recallingFirm": "",
  "keyword": "",
  "reportStartDate": "",
  "reportEndDate": "",
  "maxItems": 20,
  "limitPerPage": 100,
  "requestDelayMs": 250
}
```

# Actor output Schema

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

No description

# 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 = {
    "productTypes": [
        "drug",
        "device",
        "food"
    ],
    "status": "Ongoing",
    "classification": "Class I",
    "recallingFirm": "",
    "keyword": "",
    "reportStartDate": "",
    "reportEndDate": "",
    "maxItems": 20
};

// Run the Actor and wait for it to finish
const run = await client.actor("knotless_snowcrab/openfda-recalls").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 = {
    "productTypes": [
        "drug",
        "device",
        "food",
    ],
    "status": "Ongoing",
    "classification": "Class I",
    "recallingFirm": "",
    "keyword": "",
    "reportStartDate": "",
    "reportEndDate": "",
    "maxItems": 20,
}

# Run the Actor and wait for it to finish
run = client.actor("knotless_snowcrab/openfda-recalls").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 '{
  "productTypes": [
    "drug",
    "device",
    "food"
  ],
  "status": "Ongoing",
  "classification": "Class I",
  "recallingFirm": "",
  "keyword": "",
  "reportStartDate": "",
  "reportEndDate": "",
  "maxItems": 20
}' |
apify call knotless_snowcrab/openfda-recalls --silent --output-dataset

```

## MCP server setup

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

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/1mCrtqVSChGS3VMW5/builds/6d2P1KgCXb6XRjuYT/openapi.json
