
Openfda Database
Query FDA drug, device, and adverse-event datasets through the openFDA JSON API without hand-rolling auth, search syntax, and aggregation rules.
Overview
openFDA Database is an agent skill most often used in Idea (also Build integrations, Validate scope) that teaches agents how to query FDA open data via the official JSON API with correct search, count, and rate-limit han
Install
npx skills add https://github.com/google-deepmind/science-skills --skill openfda-databaseWhat is this skill?
- Documents base URL pattern `https://api.fda.gov/{category}/{endpoint}.json` with search, sort, and count aggregation syn
- Explains authenticated vs unauthenticated limits (240/min; 1,000/day per IP vs 120,000/day per API key) and `FDA_API_KEY
- Covers AND/OR queries, date ranges, quoted phrases, and `.exact` suffix for categorical fields like brand names and MedD
- Warns that automated agents can blow the 1,000/day cap in one session—multi-query workflows should always use a key
- 240 requests per minute with or without key
- 1,000 requests per day per IP without API key
- 120,000 requests per day per API key
Adoption & trust: 566 installs on skills.sh; 1.7k GitHub stars; 3/3 security scanners passed (skills.sh audits).
What problem does it solve?
You need trustworthy FDA drug and safety data in your agent workflow but keep mis-querying tokenized fields, hitting IP daily caps, or inventing non-standard API syntax.
Who is it for?
Solo builders prototyping pharmacovigilance dashboards, supplement or med-tech research agents, or compliance-oriented side projects that pull from openFDA during discovery and later in production integrations.
Skip if: Teams that need a managed commercial drug database, offline bulk ETL without HTTP discipline, or workflows where FDA API terms and clinical use require formal regulatory counsel instead of an API cheat sheet.
When should I use this skill?
You or your agent need to retrieve or aggregate FDA open datasets (drugs, devices, adverse events) via `api.fda.gov` with correct query, count, and authentication patterns.
What do I get? / Deliverables
Your agent runs structured openFDA searches and aggregations with `.exact` fields where needed, authenticated when doing multi-query automation, producing reproducible JSON result sets for downstream analysis or product
- Correctly formed openFDA query URLs or requests
- Aggregated count results or paginated JSON extracts
- Documented choice of `.exact` fields for categorical searches
Recommended Skills
Journey fit
Spans multiple journey phases - primary shelf plus alternate fits below.
Science and regulatory datasets are consulted earliest when validating hypotheses, safety signals, and market claims—before you wire FDA data into a product backend. Research is the canonical shelf because the skill documents endpoint patterns, `.exact` matching, and rate limits for exploratory evidence gathering, not for shipping schema DDL.
Where it fits
Count serious reaction terms for a competitor’s brand using `.exact` MedDRA fields before you commit to a niche product.
Pull label and enforcement references from openFDA to sanity-check positioning claims on a landing page draft.
Implement a backend job that pages through `search` + `sort` with `FDA_API_KEY` so daily automation stays under quota.
How it compares
Use as a procedural openFDA integration guide—not as a substitute for a curated commercial drug-data MCP server or a full pharmacovigilance platform.
Common Questions / FAQ
Who is openfda-database for?
Indie and solo developers building research agents, health-adjacent SaaS, or internal tools that must call the openFDA JSON API correctly from Claude Code, Cursor, Codex, or similar agents.
When should I use openfda-database?
During Idea research to count adverse reactions or compare labels; during Validate scope when grounding claims in public FDA records; and during Build integrations when wiring authenticated, rate-aware HTTP queries into your backend or agent tools.
Is openfda-database safe to install?
Treat it as documentation for external FDA endpoints: it implies network access and optional API keys. Review the Security Audits panel on this Prism page before enabling broad agent network permissions in production repos.
SKILL.md
READMESKILL.md - Openfda Database
# openFDA API Endpoints Reference ## Base URL All requests go to `https://api.fda.gov/{category}/{endpoint}.json`. ## Authentication - **Without API key**: 240 requests/min, 1,000/day per IP - **With API key**: 240 requests/min, 120,000/day per key Pass via `--api_key` flag or `FDA_API_KEY` environment variable. > **Important**: Without an API key you are capped at 1,000 requests/day. > An automated agent can easily exceed this in a single session. Always set a > key before running multi-query workflows. ## Query Syntax ### Search ``` search=field:term ``` - `search=field:term` — match a single term - `search=field:term+AND+field:term` — match ALL terms - `search=field:term+field:term` — match ANY term (OR) - `search=field:[20200101+TO+20201231]` — date range - `search=field:"exact+phrase"` — exact phrase matching ### Exact Matching (.exact) For categorical fields (drug names, reaction terms, manufacturer names), use the `.exact` suffix to match whole phrases rather than individual tokens: ``` search=openfda.brand_name.exact:"TYLENOL" count=patient.reaction.reactionmeddrapt.exact ``` Without `.exact`, the API tokenizes multi-word values and returns noisy partial matches. Always use `.exact` when: - Searching for a specific product by brand name - Counting reaction terms or manufacturer names - Querying any field that contains multi-word values ### Sort ``` sort=field:asc sort=field:desc ``` ### Count Use `count=field` to aggregate unique values. Add `.exact` suffix for whole-phrase counting: ``` count=patient.reaction.reactionmeddrapt.exact ``` ### Pagination - `limit=N` — number of results (max 1000) - `skip=N` — offset for pagination (max 25000) ### Date Formats openFDA requires dates in **YYYYMMDD** format (not ISO 8601). Date ranges use bracket syntax with `+TO+`: ``` search=receivedate:[20230101+TO+20231231] ``` **Common pitfalls:** | Format | Valid? | |---|---| | `20230101` | ✓ Correct | | `[20230101+TO+20231231]` | ✓ Correct range | | `2023-01-01` | ✗ Will cause an API error | | `2023/01/01` | ✗ Will cause an API error | | `January 1, 2023` | ✗ Will cause an API error | ## All Endpoints ### Drug (6 endpoints) | Endpoint | Path | Description | |---|---|---| | event | `/drug/event.json` | Adverse event reports (FAERS) | | label | `/drug/label.json` | Structured product labeling (SPL) | | ndc | `/drug/ndc.json` | National Drug Code directory | | enforcement | `/drug/enforcement.json` | Recall enforcement reports | | drugsfda | `/drug/drugsfda.json` | Drug approvals since 1939 | | shortages | `/drug/shortages.json` | Drug shortage reports | ### Device (9 endpoints) | Endpoint | Path | Description | |---|---|---| | 510k | `/device/510k.json` | 510(k) premarket clearances | | classification | `/device/classification.json` | Device classification data | | enforcement | `/device/enforcement.json` | Recall enforcement reports | | event | `/device/event.json` | Adverse event reports (MDR) | | pma | `/device/pma.json` | Premarket approval (Class III) | | recall | `/device/recall.json` | Device recall details | | registrationlisting | `/device/registrationlisting.json` | Facility registrations | | udi | `/device/udi.json` | Unique Device Identifiers (GUDID) | | covid19serology | `/device/covid19serology.json` | COVID-19 antibody test data | ### Food (2 endpoints) | Endpoint | Path | Description | |---|---|---| | enforcement | `/food/enforcement.json` | Food recall enforcement reports | | event | `/food/event.json` | CAERS adverse event reports | ### Tobacco (4 endpoints) | Endpoint | Path | Description | |---|---|---| | problem | `/tobacco/problem.json` | Tobacco product problem reports | | researchpreventionads | `/tobacco/researchpreventionads.json` | Prevention ads research | | researchdigitalads | `/tobacco/researchdigitalads.json` | Digital ads research | | researchsmokefree | `/tobacco/researchsmokefree.json` | Smokefree campaign research | ### Other (4 endpoints) | Endpoint | Path | Desc