# openFDA Drug Safety Profile (`a.jonzy/openfda-drug-safety-profile`) Actor

Per-drug openFDA profile: reported adverse events, boxed warning and recalls by class. Reports do not show a drug caused an event. Not medical advice. Official API.

- **URL**: https://apify.com/a.jonzy/openfda-drug-safety-profile.md
- **Developed by:** [Aidan Jones](https://apify.com/a.jonzy) (community)
- **Categories:** Other, Agents, Automation
- **Security:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per event

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 Drug Safety Profile

> **Read this first.** This actor returns public FDA data. It is not medical advice. Adverse event reports are unverified, can be duplicated, and do not show that a drug caused an event. Counts are not rates and cannot be compared across drugs. Do not start, stop or change a medicine because of this data; ask a clinician or pharmacist.

Give it drug names and get one structured safety profile per drug from the official openFDA API: adverse event report counts and the most reported reactions, the share of serious reports and reports with death, the current label's boxed warning, indications and contraindications, and recall counts by class with the most recent recall reports. No scraping.

Use it for monitoring what has been reported about a drug, label and recall lookup across a list of drugs, or to feed a dashboard or an AI agent with FDA facts that carry their own caveats.

### What you get

- `adverseEvents` (FDA Adverse Event Reporting System via openFDA): total reports, serious reports and share, reports with a death outcome, top reactions (MedDRA preferred terms) with counts and share of reports, optional received-date window
- `label`: newest single-ingredient label that names the drug: boxed warning (`hasBoxedWarning`), indications, contraindications (each capped at 3000 characters, flagged when cut), brand and generic names, manufacturer, route, pharmacologic class, effective date
- `recalls`: total drug enforcement reports, counts by class (Class I is the most serious), the most recent reports with reason, firm, product and dates
- The date window (`receivedFrom`, `receivedTo`) filters adverse event reports only; label and recall data are not date-filtered
- A `notice` on every profile, and a `status` of `found`, `not_found` or `error`

### Price

Pay per event. You pay for each drug profile stored with data.

| Event | Price |
|---|---|
| Actor start | $0.005 per start event. Apify bills one start event per GB of memory; the default run uses 512 MB, so one event. |
| Drug safety profile returned | $0.03 |

20 drugs cost about $0.61. Drugs with no match (`not_found`) and drugs that hit an error are not charged. If any requested section fails for a drug, that drug is an uncharged `error` item.

### Example input

```json
{
    "drugs": ["metformin", "atorvastatin"],
    "sections": ["events", "label", "recalls"],
    "receivedFrom": "2023-01-01",
    "topReactions": 10,
    "recentRecalls": 3
}
```

### Example output

```json
{
    "status": "found",
    "drug": "metformin",
    "sectionsRequested": ["events", "label", "recalls"],
    "adverseEvents": {
        "totalReports": 445561,
        "seriousReports": 298459,
        "seriousShare": 0.6698,
        "deathReports": 36734,
        "receivedFrom": null,
        "receivedTo": null,
        "topReactions": [{ "reaction": "FATIGUE", "reports": 21809, "shareOfReports": 0.0489 }]
    },
    "label": {
        "matchingLabels": 351,
        "effectiveDate": "2026-09-09",
        "hasBoxedWarning": true,
        "boxedWarning": "BOXED WARNING WARNING: LACTIC ACIDOSIS Postmarketing cases of metformin-associated lactic acidosis have resulted in death...",
        "textTruncated": false
    },
    "recalls": {
        "totalRecalls": 33,
        "byClassification": { "Class II": 30, "Class III": 3 },
        "recent": [{ "recallNumber": "D-0292-2025", "classification": "Class II", "reason": "Presence of Foreign Tablets/Capsules.", "reportDate": "2025-04-02" }]
    },
    "dataLastUpdated": "2026-10-28",
    "notice": "Not medical advice. ..."
}
```

Real values from a live run, shortened. A run summary (profiles returned, not found, errors) is saved under the key-value store key `SUMMARY`.

### FAQ

**Where does the data come from?** The openFDA API (api.fda.gov) of the U.S. Food and Drug Administration: the FDA Adverse Event Reporting System, drug labeling (SPL) and drug enforcement (recall) reports. See open.fda.gov/terms. openFDA itself says not to rely on it for medical care decisions and that results are unvalidated.

**Does a high report count mean a drug is dangerous?** No. Reports mention a drug as suspect, concomitant or interacting, come from patients, clinicians and manufacturers, and reflect how widely a drug is used and how much attention it gets. The match is on the name, so a search for a single ingredient also counts reports for products that contain it. Use the counts to see what has been reported, not to compare drugs or estimate risk.

**What does a name match?** Generic, brand and substance names, as phrases. If a name finds nothing, try the generic or the brand name.

**What are the request limits?** openFDA allows 240 requests per minute and 1,000 per day per IP address without a key, 120,000 per day with a free key from open.fda.gov. The actor keeps 300 ms between requests, retries 429 and 5xx errors honoring `Retry-After`, and stops with a clear message if the daily limit is hit. A profile uses up to 7 requests (4 events, 1 label, 2 recalls), so choose `sections` and `recentRecalls: 0` to use fewer. Apify IPs are shared, so add your own key (the input field is secret) for larger runs.

**Why was the label not the one I use?** The actor takes the newest single-ingredient label that names the drug; many repackagers publish labels, and `matchingLabels` shows how many matched.

### Data and limits

- Source: openFDA (FDA). Data updates on FDA's schedule; `dataLastUpdated` is the events dataset date.
- Up to 200 drugs per run.
- Recall data covers FDA drug enforcement reports, not every market withdrawal or shortage.
- This is a research aid. It is not medical advice.

# Actor input Schema

## `drugs` (type: `array`):

Generic, brand or substance names, one per entry, for example metformin or Lipitor. One profile is returned per drug. Up to 200 per run.

## `sections` (type: `array`):

What to include. Allowed values: events (FAERS adverse event counts), label (boxed warning, indications, contraindications), recalls (FDA drug enforcement reports). Defaults to all three. Fewer sections use fewer of the openFDA daily request allowance.

## `receivedFrom` (type: `string`):

Optional start date for adverse event reports, YYYY-MM-DD. Applies to the events section only.

## `receivedTo` (type: `string`):

Optional end date for adverse event reports, YYYY-MM-DD. Applies to the events section only.

## `topReactions` (type: `integer`):

How many of the most reported reactions (MedDRA preferred terms) to list, 1 to 100.

## `recentRecalls` (type: `integer`):

How many of the most recent recall reports to list, 0 to 50. Recall totals by class are always included.

## `openFdaApiKey` (type: `string`):

A free key from open.fda.gov raises the limit from 1,000 to 120,000 requests per day. Without one, openFDA allows 1,000 requests per day per IP address, shared with other users of the same Apify IP, and a profile uses up to 7 requests.

## Actor input object example

```json
{
  "drugs": [
    "metformin",
    "atorvastatin"
  ],
  "topReactions": 15,
  "recentRecalls": 5
}
```

# Actor output Schema

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

One item per drug. status is found, not_found or error; only found profiles are charged.

## `summary` (type: `string`):

Counts of profiles returned, drugs not found and errors, plus the not-medical-advice notice.

# 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 = {
    "drugs": [
        "metformin",
        "atorvastatin"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("a.jonzy/openfda-drug-safety-profile").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 = { "drugs": [
        "metformin",
        "atorvastatin",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("a.jonzy/openfda-drug-safety-profile").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 '{
  "drugs": [
    "metformin",
    "atorvastatin"
  ]
}' |
apify call a.jonzy/openfda-drug-safety-profile --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,a.jonzy/openfda-drug-safety-profile"
        }
    }
}
```

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/RvppsbnVuEbDHCqRF/builds/6aXtwpanZ5pUSAtmW/openapi.json
