FDA adverse event counts
Counts of drug adverse event reports grouped by a field: the top reactions, drugs, brands, generics, substances, manufacturers, indications, pharmacologic classes, routes, outcomes, sexes, age groups, countries, reporter types or seriousness for the reports matching the filters, or a timeline by day (by=date) or year (by=year). Takes every filter of /openfda/v1/adverse-events.
Every response includes credits_used: the credits this call cost.
Parameters
| name | type | description |
|---|---|---|
by | reaction | drug | brand | generic | substance | manufacturer | indication | pharm_class | outcome | sex | age_group | country | reporter | serious | route | year | date | Field to count by. Example: reaction |
generic | string | Generic name. Example: metformin |
brand | string | Brand name. |
drug | string | Drug name as reported. |
reaction | string | Reaction term. |
serious | true | false | Serious reports only. |
sex | male | female | unknown | Patient sex. |
country | string | Two-letter country. |
from | string | Earliest receive date (YYYY-MM-DD). |
to | string | Latest receive date (YYYY-MM-DD). |
search | string | An openFDA query expression added with AND. |
limit | integer | Number of top terms (up to 1000; for date, the latest days). |
Every endpoint also takes fresh, raw, fields (see lean responses and caching).
Example
curl "https://api.api.sh/openfda/v1/adverse-events/stats?by=reaction" \
-H "x-api-key: $APISH_KEY" import os, requests
res = requests.get(
"https://api.api.sh/openfda/v1/adverse-events/stats",
params={"by": "reaction"},
headers={"x-api-key": os.environ["APISH_KEY"]},
timeout=120,
)
res.raise_for_status()
data = res.json() const url = new URL("https://api.api.sh/openfda/v1/adverse-events/stats");
url.searchParams.set("by", "reaction");
const res = await fetch(url, { headers: { "x-api-key": process.env.APISH_KEY } });
if (!res.ok) throw new Error(`${res.status} ${await res.text()}`);
const data = await res.json(); Response
A JSON object with the fields described above, plus raw (the source's own data), cached, fetched_at and credits_used. Errors return {"success": false, "error": "…"} with the HTTP status (see errors). A lookup that ran but found nothing (404) costs the price above; refused calls and errors on our side are free (what's charged).