# FDA Adverse Event Aggregate (`zinin/fda-adverse-event-aggregate`) Actor

Aggregate openFDA adverse-event report counts and reported reaction counts by drug brand or generic name and date period. Official API, no key required.

- **URL**: https://apify.com/zinin/fda-adverse-event-aggregate.md
- **Developed by:** [Tim Zinin](https://apify.com/zinin) (community)
- **Categories:** Business
- **Features:** Limited permissions
- **Stats:** 4 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.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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

## FDA Adverse Event Aggregate

Aggregate reported reaction counts from the official **openFDA drug adverse event API** by drug brand or generic name and an inclusive date period. Each successful row contains the total matching reports and ranked reaction terms.

> **Important:** These are spontaneous report counts—not patient counts, incidence, or risk estimates. A report naming a drug does **not** establish that the drug caused the event. This Actor provides **no medical advice**; consult a qualified healthcare professional for medical decisions.

### Use cases

- Prepare reproducible pharmacovigilance monitoring inputs by drug and period.
- Compare reporting patterns across brand or generic names for market research.
- Feed dashboards with ranked reaction terms and an independent report total.
- Export source-attributed snapshots for trend analysis.

### Input

```json
{"drugNames":["Advil"],"nameType":"brand","startDate":"2023-01-01","endDate":"2023-12-31","maxReactions":10}
```

- `drugNames`: 1–20 names, de-duplicated and hard-capped in code.
- `nameType`: `brand` or `generic`.
- `startDate` / `endDate`: inclusive `YYYY-MM-DD` dates, at most 10 years apart.
- `maxReactions`: 1–100 top reaction terms per drug.

The prefill works without a key. Optional secret `OPENFDA_API_KEY` can increase the source allowance and is never output or logged. Requests are sequential, use an identifying User-Agent, timeouts, pauses, and bounded retries for 429/5xx. The Actor uses no proxy and scrapes no HTML.

### Output

```json
{
  "drugName":"Advil", "nameType":"brand", "periodStart":"2023-01-01", "periodEnd":"2023-12-31",
  "found":true, "reportTotal":1234,
  "reactions":[{"rank":1,"reaction":"DRUG INEFFECTIVE","reportCount":210}],
  "source":"openFDA drug adverse event API (U.S. Food and Drug Administration)",
  "sourceUrl":"https://api.fda.gov/drug/event.json?...",
  "retrievedAt":"2026-11-10T12:00:00.000Z",
  "disclaimer":"Reported events do not establish that the drug caused the event and do not measure incidence or risk. Not medical advice."
}
```

Every row, including a no-match/source-failure row, carries the no-causality and non-medical-advice disclaimer. No-match/source failures are `found:false` free rows with an error and the same attribution. Successful rows are delivered and charged atomically as `result-found`; the Actor stops before a paid push if remaining buyer budget cannot cover it.

### Pricing

**$0.03 per aggregated reaction count row (`result-found`) on the Free plan, with automatic discounts on paid Apify plans: Bronze −5%, Silver −10%, Gold −15%, Platinum −18%, Diamond −20%. A small Actor start event ($0.002) applies per run** per successful `result-found` row, plus the platform start event. No-match and source-error rows are not charged as results.

### Limitations

FAERS/openFDA reports can be duplicated, updated, incomplete, miscoded, or affected by reporting bias. A report can list multiple products and reactions; presence of the searched drug does not identify it as causal or necessarily suspect. Reaction counts overlap and must not be summed as a report total. There is no denominator, so results cannot measure frequency, incidence, or risk. Aliases may require separate searches. FDA controls availability, limits, coverage, and refresh timing; source failures are reported rather than converted to zero.

### Source, terms, and attribution

Data comes from the FDA [openFDA drug adverse event API](https://open.fda.gov/apis/drug/event/), subject to [openFDA terms](https://open.fda.gov/terms/) and [license/attribution guidance](https://open.fda.gov/license/). FDA says openFDA data is unvalidated and must not be relied on for medical-care decisions. Every row includes source attribution, exact key-free source URL, and retrieval time.

### Related Actors

- [fda-ndc-product-directory](https://apify.com/zinin/fda-ndc-product-directory)
- [fda-food-recall-monitor](https://apify.com/zinin/fda-food-recall-monitor)
- [fda-approval-feed](https://apify.com/zinin/fda-approval-feed)

# Actor input Schema

## `drugNames` (type: `array`):

Brand or generic drug names. Choose which kind in Name type. One name per line.

## `nameType` (type: `string`):

Search the openFDA brand-name or generic-name field.

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

Inclusive start date (YYYY-MM-DD).

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

Inclusive end date (YYYY-MM-DD).

## `maxReactions` (type: `integer`):

Return the most frequently reported reaction terms, up to this limit.

## Actor input object example

```json
{
  "drugNames": [
    "Advil"
  ],
  "nameType": "brand",
  "startDate": "2023-01-01",
  "endDate": "2023-12-31",
  "maxReactions": 10
}
```

# Actor output Schema

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

API URL for this run's default dataset items.

# 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 = {
    "drugNames": [
        "Advil"
    ],
    "nameType": "brand",
    "startDate": "2023-01-01",
    "endDate": "2023-12-31",
    "maxReactions": 10
};

// Run the Actor and wait for it to finish
const run = await client.actor("zinin/fda-adverse-event-aggregate").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 = {
    "drugNames": ["Advil"],
    "nameType": "brand",
    "startDate": "2023-01-01",
    "endDate": "2023-12-31",
    "maxReactions": 10,
}

# Run the Actor and wait for it to finish
run = client.actor("zinin/fda-adverse-event-aggregate").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 '{
  "drugNames": [
    "Advil"
  ],
  "nameType": "brand",
  "startDate": "2023-01-01",
  "endDate": "2023-12-31",
  "maxReactions": 10
}' |
apify call zinin/fda-adverse-event-aggregate --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,zinin/fda-adverse-event-aggregate"
        }
    }
}
```

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/CCEB4JtO9sfA0sIo8/builds/8g5H6cZpHx6QykhHS/openapi.json
