# Harmoney OpenFDA Drug Recall Monitor (`tolvan/harmoney-openfda-recall-monitor`) Actor

Collect FDA drug recall enforcement records from the public openFDA API and output normalized recall items.

- **URL**: https://apify.com/tolvan/harmoney-openfda-recall-monitor.md
- **Developed by:** [Jesper Tolvers](https://apify.com/tolvan) (community)
- **Categories:** Automation, Developer tools
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.10 / 1,000 drug recall results

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/docs.md):

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

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python/docs.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/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

## OpenFDA Drug Recall Monitor

Export normalized **public FDA drug recall enforcement records** from the official openFDA API. The Actor is designed for bounded research, compliance monitoring, journalism, supply-chain checks, and automations that need structured JSON rather than a web page.

> **Not medical advice.** This Actor reports public enforcement data without interpreting clinical risk. Confirm decisions against the linked official FDA source and your qualified professional workflow.

### Why use it?

- Official public source: `api.fda.gov/drug/enforcement.json`
- Date, FDA status, classification, product/firm/reason phrase filters
- Newest report dates first
- Normalized JSON dataset plus a machine-readable `OUTPUT_SUMMARY`
- Hard maximum of 200 records per run
- No browser, proxy, account, API token, or paid source required
- Location fields are excluded by default for data minimization

### Input

```json
{
  "daysBack": 90,
  "status": "Any",
  "classification": "Class II",
  "searchText": "metformin",
  "includeLocation": false,
  "maxItems": 25
}
````

You can replace the rolling `daysBack` window with inclusive `startDate` and `endDate` values in `YYYY-MM-DD` format.

| Field | Default | Limits | Purpose |
|---|---:|---:|---|
| `daysBack` | `30` | 1–730 | Rolling UTC window when `startDate` is empty |
| `startDate` | calculated | valid date | Inclusive FDA report-date lower bound |
| `endDate` | today (UTC) | valid date | Inclusive FDA report-date upper bound |
| `status` | `Any` | fixed options | Any, Ongoing, Completed, or Terminated |
| `classification` | `Any` | fixed options | Any, Class I, Class II, or Class III |
| `searchText` | empty | 100 chars | Literal phrase in product, recalling firm, or recall reason |
| `includeLocation` | `false` | boolean | Include public city/state/country fields |
| `maxItems` | `50` | 1–200 | Hard dataset output cap |

Do not put credentials, secrets, or unnecessary personal data in `searchText`. Secret-like input is rejected and the literal search text is never written to Actor logs or the summary.

### Output

Each dataset item is one FDA drug enforcement record:

```json
{
  "recallNumber": "D-0643-2026",
  "reportDate": "2026-07-08",
  "classification": "Class II",
  "status": "Ongoing",
  "productType": "Drugs",
  "productDescription": "...",
  "reasonForRecall": "...",
  "recallingFirm": "...",
  "source": "openFDA Drug Enforcement API",
  "sourceUrl": "https://open.fda.gov/apis/drug/enforcement/",
  "fetchedAt": "2026-07-16T07:06:40.523Z",
  "disclaimer": "Public FDA enforcement data only; not medical advice and not a substitute for the official record."
}
```

The default key-value store also receives `OUTPUT_SUMMARY`, containing the item/request counts, effective date range, non-sensitive filter metadata, completion time, source, and disclaimer.

### Safety and reliability

- Requests can only go to the fixed HTTPS host `api.fda.gov`; users cannot supply URLs. This removes the usual SSRF route.
- Network calls time out after 20 seconds and retry transient HTTP 429/5xx failures at most twice.
- A response larger than 5 MB is rejected before data is saved.
- Input and output are bounded; there are no unbounded crawls or recursive schedules.
- Only selected public enforcement fields are emitted. Nested openFDA data is not copied wholesale.
- Location is opt-in. The Actor does not request patient records, adverse-event narratives, credentials, or private health data.
- Invalid input and upstream failures stop the run with an honest error. The Actor never fabricates records.

### Limitations

- Data availability, wording, and correction timing are controlled by FDA/openFDA.
- A recall may have several enforcement records. `recallNumber` is retained so downstream systems can deduplicate deliberately.
- No-match openFDA responses use HTTP 404; this Actor treats that specific response as a successful empty dataset.
- Search uses openFDA's documented query service. Phrase matching is not fuzzy semantic search.
- The Actor does not send alerts by itself. Use Apify schedules/webhooks or export the dataset into your monitoring system.
- Public data can still contain business names and addresses. Enable location output only when your purpose needs it.

### Run locally

```bash
npm ci
npm test
npm run build
apify validate-schema
apify run --purge --input-file examples/INPUT.json
```

### Source and freshness

- openFDA Drug Enforcement API documentation: https://open.fda.gov/apis/drug/enforcement/
- FDA recalls and safety alerts: https://www.fda.gov/safety/recalls-market-withdrawals-safety-alerts

Source availability and integration were last verified **2026-07-16 UTC**.

### Cost profile

The Actor uses direct JSON requests and no browser. A five-item local integration run on 2026-07-16 used one upstream request, completed in 4.27 seconds including Actor startup, and peaked at about 184 MiB RSS. Cloud usage varies by platform startup and load; the deployed smoke run is the authoritative per-run measurement.

# Actor input Schema

## `daysBack` (type: `integer`):

Rolling number of UTC days before endDate. Used only when startDate is empty.

## `startDate` (type: `string`):

Optional inclusive report date in YYYY-MM-DD. Leave empty to use daysBack.

## `endDate` (type: `string`):

Inclusive report date in YYYY-MM-DD. Defaults to the current UTC date.

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

Filter by the FDA enforcement status, or return any status.

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

Filter by the FDA recall classification, or return every class.

## `searchText` (type: `string`):

Optional literal phrase (maximum 100 characters). Do not enter personal data, credentials, or secrets.

## `includeLocation` (type: `boolean`):

Include city, state, and country from the public enforcement record. Disabled by default for data minimization.

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

Hard output cap. One dataset item represents one FDA enforcement record.

## Actor input object example

```json
{
  "daysBack": 30,
  "status": "Any",
  "classification": "Any",
  "includeLocation": false,
  "maxItems": 50
}
```

# 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("tolvan/harmoney-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("tolvan/harmoney-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 tolvan/harmoney-openfda-recall-monitor --silent --output-dataset

```

## MCP server setup

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

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Harmoney OpenFDA Drug Recall Monitor",
        "description": "Collect FDA drug recall enforcement records from the public openFDA API and output normalized recall items.",
        "version": "1.0",
        "x-build-id": "4GcoXvc7vRCZyiyu6"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/tolvan~harmoney-openfda-recall-monitor/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-tolvan-harmoney-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/tolvan~harmoney-openfda-recall-monitor/runs": {
            "post": {
                "operationId": "runs-sync-tolvan-harmoney-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/tolvan~harmoney-openfda-recall-monitor/run-sync": {
            "post": {
                "operationId": "run-sync-tolvan-harmoney-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": [
                    "maxItems"
                ],
                "properties": {
                    "daysBack": {
                        "title": "Days back",
                        "minimum": 1,
                        "maximum": 730,
                        "type": "integer",
                        "description": "Rolling number of UTC days before endDate. Used only when startDate is empty.",
                        "default": 30
                    },
                    "startDate": {
                        "title": "Start date",
                        "type": "string",
                        "description": "Optional inclusive report date in YYYY-MM-DD. Leave empty to use daysBack."
                    },
                    "endDate": {
                        "title": "End date",
                        "type": "string",
                        "description": "Inclusive report date in YYYY-MM-DD. Defaults to the current UTC date."
                    },
                    "status": {
                        "title": "Recall status",
                        "enum": [
                            "Any",
                            "Ongoing",
                            "Completed",
                            "Terminated"
                        ],
                        "type": "string",
                        "description": "Filter by the FDA enforcement status, or return any status.",
                        "default": "Any"
                    },
                    "classification": {
                        "title": "FDA classification",
                        "enum": [
                            "Any",
                            "Class I",
                            "Class II",
                            "Class III"
                        ],
                        "type": "string",
                        "description": "Filter by the FDA recall classification, or return every class.",
                        "default": "Any"
                    },
                    "searchText": {
                        "title": "Product, firm, or reason contains",
                        "type": "string",
                        "description": "Optional literal phrase (maximum 100 characters). Do not enter personal data, credentials, or secrets."
                    },
                    "includeLocation": {
                        "title": "Include public firm location",
                        "type": "boolean",
                        "description": "Include city, state, and country from the public enforcement record. Disabled by default for data minimization.",
                        "default": false
                    },
                    "maxItems": {
                        "title": "Maximum dataset items",
                        "minimum": 1,
                        "maximum": 200,
                        "type": "integer",
                        "description": "Hard output cap. One dataset item represents one FDA enforcement record.",
                        "default": 50
                    }
                }
            },
            "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
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
