Premium OpenFDA Aggregate
1 creditGET /api/premium/health/fda/aggregateHistogram-by-field across openFDA's drug, food, and device record sets (FAERS, MAUDE, structured product labels, enforcement reports). Uses openFDA's `count` parameter to return bucket counts in one call instead of paging.
When to use this endpoint
For top-N analyses (top drugs by adverse events, top reactions for one drug, top recalled food categories) where you do not want to ingest millions of individual records.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
| category* | query | string | drug/events | drug/labels | drug/recalls | food/recalls | device/eventse.g. drug/events |
| count_by* | query | string | openFDA field path to bucket one.g. patient.drug.medicinalproduct.exact |
| search | query | string | openFDA Lucene search to scope the aggregatione.g. patient.drug.medicinalproduct:aspirin |
| limit | query | number | Top-N buckets (1-1000)e.g. 100 |
* required
Example response
{ "ok": true, "category": "drug/events", "count_by": "patient.drug.medicinalproduct.exact", "buckets": [{ "term": "ASPIRIN", "count": 12345 }], "billing": { "credits_charged": 1, "credits_remaining": 49 } }Code samples
Python SDK
tf._get("/premium/health/fda/aggregate", category="drug/events", count_by="patient.drug.medicinalproduct.exact", limit=100)TypeScript SDK
await fetch("https://tensorfeed.ai/api/premium/health/fda/aggregate?category=drug/events&count_by=patient.drug.medicinalproduct.exact&limit=100", { headers: { Authorization: "Bearer tf_live_..." } });FAQ
License?
openFDA is CC0 1.0 Universal Dedication, FDA waiver of all copyright. Commercial redistribution permitted.