# FDA Recall Monitor (Drug + Device + Food) (`mooseandraven/openfda-recall-monitor`) Actor

Monitors FDA recalls across drugs, medical devices, and food, via the official openFDA API — no account required, no scraping. Optional free API key only raises rate limits.

- **URL**: https://apify.com/mooseandraven/openfda-recall-monitor.md
- **Developed by:** [Moose & Raven](https://apify.com/mooseandraven) (community)
- **Categories:** Business, Automation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $4.00 / 1,000 recall 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/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
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.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use 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

## FDA Recall Monitor (Drug + Device + Food)

Monitors FDA recalls across drugs, medical devices, and food, via the official openFDA API — no
account required, no scraping. Optional incremental monitor mode tracks new recalls across
scheduled runs.

### What makes this different

**Bundles three separate recall categories nobody else bundles**: drug, device, and food recalls
in one actor with one consistent schema and one monitor-mode checkpoint system. A compliance
team watching a supplier or distributor typically cares about all three, not just one.

**Zero account friction for normal use** — openFDA works with no API key at all (240
requests/minute, 1,000/day per IP). An optional free key (`apiKey` input) only raises the daily
cap to 120,000 for high-volume scheduled monitoring; it's never required to get started.

### How it works

- Choose which `categories` to check (`drug`, `device`, `food` — default all three).
- Optionally filter by `companies` (recalling-firm name) and/or `classification` (Class I/II/III
  severity — **drug and food only**; device recalls have no comparable field, confirmed live).
- Optional **incremental monitor mode**: remembers which recalls it has already delivered per
  category (by the source's own stable ID) and only reports genuinely NEW recalls on later runs.
  Charges one `monitor-run` event in addition to per-recall events.
- **A confirmed zero-match result is treated as a real, good outcome, not an error.** openFDA
  returns a distinguishable `404` with a specific `NOT_FOUND` error code for a well-formed query
  with no matches (e.g. "this company has a clean recall record") — separate from a genuinely
  broken request (`500`). This actor tells these apart explicitly rather than treating every
  non-2xx response the same way.
- **A failed fetch is never silently treated as "nothing new."** Each category's failure pushes
  an explicit `fetch-failed` (or `rate-limited`, if openFDA's rate limit was tripped) status
  record — one category's problem doesn't hide results from the others, matching this fleet's
  established per-item isolation pattern.
- `maxRecordsPerCategory` (default 500) is applied **independently per category**, not shared —
  a large drug-recall pull can't silently starve the device/food categories of any processing. If
  a category's real total (openFDA's own count) exceeds the cap, an explicit `category-truncated`
  record surfaces the true total.
- **`monitor-run` is billed only when nothing was compromised** (no fetch failures, no rate-limit
  hits) — a disclosed truncation still bills normally (it's a known, surfaced cap, not a blind
  spot), but a run that couldn't reliably confirm what it checked does not.

### ⚠️ Limitations

- **`device` recalls come from a genuinely different openFDA dataset than `drug`/`food`.**
  `drug` and `food` both use openFDA's "enforcement" endpoints
  (`api.fda.gov/drug/enforcement.json`, `api.fda.gov/food/enforcement.json`) — the same
  underlying data model. `device` uses a separate database, the CDRH recall database
  (`api.fda.gov/device/recall.json`), with its own field names and no classification concept.
  This actor's field mapping is fully consistent with that distinct source (confirmed live), but
  it's worth knowing "device" isn't just "drug/food's enforcement data, filtered to devices" —
  it's a structurally different dataset FDA maintains separately.
- **Device recalls have no severity classification field at all** — FDA doesn't publish a
  Class I/II/III equivalent for devices the way it does for drug/food. The `classification`
  filter has no effect on the device category, and every device `recall` record's
  `classification` field is `null`.
- **`companies`/`classification` filters use TOKENIZED PHRASE matching** against openFDA's own
  search syntax (e.g. `recalling_firm:"Pfizer"` matches "Pfizer Inc.", "Pfizer Laboratories",
  etc. — any record containing that phrase) — not a literal exact-string match, and not fuzzy
  matching either. A misspelled company name, or one phrased very differently from openFDA's own
  `recalling_firm` value, will not match.

### Pricing

Pay per event:
- `recall-record` — per new recall delivered
- `monitor-run` — per scheduled monitor-mode run, in addition to per-record charges

### Input

Key fields (see the Input tab for the full form): `categories` (defaults to all three),
`companies`, `classification`, `monitorMode`, `maxRecordsPerCategory`, `apiKey` (optional).

### Output

Each dataset item has a `recordType` of `"recall"`, `"category-truncated"`, `"fetch-failed"`, or
`"rate-limited"`. See the Output tab for the full field reference.

### Local development

````

npm install
npm test                # recorded-fixture unit tests, no network needed
npx apify-cli run       # local end-to-end run — works immediately, no key/account needed

````

### Support

Built and maintained by Moose & Raven. Questions or issues: support@mooseandraven.com.

# Actor input Schema

## `categories` (type: `array`):

Which openFDA recall categories to check. "drug" and "food" both carry an official Class I/II/III severity classification; "device" recalls do not (FDA doesn't publish a comparable classification field for devices — see README).
## `companies` (type: `array`):

Recalling-firm names to filter by — a tokenized phrase match against the official recalling_firm field (e.g. "Pfizer" matches "Pfizer Inc.", "Pfizer Laboratories", etc.), not a literal exact-string match. Leave empty to fetch all recent recalls in each selected category instead (subject to maxRecordsPerCategory).
## `classification` (type: `array`):

Optional filter to Class I / Class II / Class III recalls. Has no effect on the "device" category, which doesn't have this field.
## `monitorMode` (type: `boolean`):

When on, the actor remembers which recalls it has already delivered per category (Apify key-value store) and only reports genuinely NEW recalls on later runs. Charges one monitor-run PPE event in addition to per-recall events.
## `maxRecordsPerCategory` (type: `integer`):

Applied INDEPENDENTLY to each category in `categories` (not shared across them). Default 500. If a category has more matching recalls than this, the actor emits a loud `category-truncated` record with the real total — it never reports a capped pull as a complete one.
## `apiKey` (type: `string`):

Optional free openFDA API key (register at open.fda.gov/apis/authentication). Without a key: 240 requests/minute, 1,000/day, per IP address. With a free key: same 240/minute, but 120,000/day. Not required for normal use — only matters for high-volume scheduled monitoring.

## Actor input object example

```json
{
  "categories": [
    "drug",
    "device",
    "food"
  ],
  "companies": [],
  "classification": [],
  "monitorMode": false,
  "maxRecordsPerCategory": 500
}
````

# 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 = {};

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

# Run the Actor and wait for it to finish
run = client.actor("mooseandraven/openfda-recall-monitor").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{}' |
apify call mooseandraven/openfda-recall-monitor --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=mooseandraven/openfda-recall-monitor",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "FDA Recall Monitor (Drug + Device + Food)",
        "description": "Monitors FDA recalls across drugs, medical devices, and food, via the official openFDA API — no account required, no scraping. Optional free API key only raises rate limits.",
        "version": "0.1",
        "x-build-id": "dq3tMAod3ep7fKXZo"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/mooseandraven~openfda-recall-monitor/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-mooseandraven-openfda-recall-monitor",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/mooseandraven~openfda-recall-monitor/runs": {
            "post": {
                "operationId": "runs-sync-mooseandraven-openfda-recall-monitor",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/mooseandraven~openfda-recall-monitor/run-sync": {
            "post": {
                "operationId": "run-sync-mooseandraven-openfda-recall-monitor",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "required": [
                    "categories"
                ],
                "properties": {
                    "categories": {
                        "title": "Recall categories to check",
                        "type": "array",
                        "description": "Which openFDA recall categories to check. \"drug\" and \"food\" both carry an official Class I/II/III severity classification; \"device\" recalls do not (FDA doesn't publish a comparable classification field for devices — see README).",
                        "items": {
                            "type": "string",
                            "enum": [
                                "drug",
                                "device",
                                "food"
                            ]
                        },
                        "default": [
                            "drug",
                            "device",
                            "food"
                        ]
                    },
                    "companies": {
                        "title": "Company/firm names to watch (optional)",
                        "type": "array",
                        "description": "Recalling-firm names to filter by — a tokenized phrase match against the official recalling_firm field (e.g. \"Pfizer\" matches \"Pfizer Inc.\", \"Pfizer Laboratories\", etc.), not a literal exact-string match. Leave empty to fetch all recent recalls in each selected category instead (subject to maxRecordsPerCategory).",
                        "default": [],
                        "items": {
                            "type": "string"
                        }
                    },
                    "classification": {
                        "title": "Severity classification filter (drug/food only)",
                        "type": "array",
                        "description": "Optional filter to Class I / Class II / Class III recalls. Has no effect on the \"device\" category, which doesn't have this field.",
                        "items": {
                            "type": "string",
                            "enum": [
                                "Class I",
                                "Class II",
                                "Class III"
                            ]
                        },
                        "default": []
                    },
                    "monitorMode": {
                        "title": "Incremental monitor mode",
                        "type": "boolean",
                        "description": "When on, the actor remembers which recalls it has already delivered per category (Apify key-value store) and only reports genuinely NEW recalls on later runs. Charges one monitor-run PPE event in addition to per-recall events.",
                        "default": false
                    },
                    "maxRecordsPerCategory": {
                        "title": "Max recalls per category per run",
                        "minimum": 1,
                        "type": "integer",
                        "description": "Applied INDEPENDENTLY to each category in `categories` (not shared across them). Default 500. If a category has more matching recalls than this, the actor emits a loud `category-truncated` record with the real total — it never reports a capped pull as a complete one.",
                        "default": 500
                    },
                    "apiKey": {
                        "title": "openFDA API key (optional)",
                        "type": "string",
                        "description": "Optional free openFDA API key (register at open.fda.gov/apis/authentication). Without a key: 240 requests/minute, 1,000/day, per IP address. With a free key: same 240/minute, but 120,000/day. Not required for normal use — only matters for high-volume scheduled monitoring."
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
