Drug Label Search API: openFDA, DailyMed and the Gaps Between Them

TLDR: For most teams, a drug label search API means two free sources: openFDA's drug/label endpoint to search label text by section, and DailyMed's web services for the current version of each label. Check freshness before you trust openFDA. On November 6, 2026 it held an older version, or no record, for 690 of 707 prescription and OTC labels whose current version DailyMed published on six dates in September and October.
Developers who search for a drug label search API usually need one of four things. They want to find labels whose text mentions something specific, such as a boxed warning, an interaction or a dosing rule. They want the current label for a product. They want to know when a label changes, and they want to know why. Public FDA and NLM data covers all four at no cost. The catch is that the two main APIs disagree with each other, and openFDA's own disclaimer says its labeling "may not be the labeling on currently distributed products." We tested both on November 6, 2026, and every count below comes from that day.
Drug label data sources compared
Every US source below starts from the same raw material: the Structured Product Labeling (SPL) documents that manufacturers submit to FDA.
| Source | Access | Limits | What you get | Watch out for |
|---|---|---|---|---|
| openFDA drug/label | REST and JSON. The docs call the free key required, but calls without one worked in our tests | 240 requests a minute. Without a key, 1,000 a day per IP; with one, 120,000 a day per key (openFDA) | Labels split into section fields you can search, with tables as HTML in *_table fields | One record per label, no history, and versions can trail DailyMed by weeks |
| DailyMed web services v2 | REST, GET only, no key | Up to 100 records a page. We found no published rate limit | Label lists, filters for boxed warning, publish date, RxCUI and NDC, version history per set ID | The full label comes only as SPL XML. A JSON request for it returned HTTP 415 |
| FDALabel | Web application | None stated | Full-text search across more than 160,000 labeling documents, by section, with spreadsheet export. Updated weekly | The page documents no API |
| FDA SrLC database | Web search and download | None stated | Safety-related labeling changes by section, from January 2016 on | Prescription drugs under NDAs and BLAs only: no generics (ANDAs), no OTC drugs and no CBER-regulated products |
| RxNorm API | REST, no key | 20 requests a second per IP, or 100 with a free UMLS API key | Drug names normalized to RxCUIs, which DailyMed accepts as a filter | NLM recommends caching results for 12 to 24 hours |
| EMA ePI API | FHIR, no key | None stated | EU product information: SmPC, labelling and package leaflet | Covers only ePI published during the EMA-HMA-EC pilot |
Commercial wrappers repackage SPL data with friendlier search. FHIRfly's FDA labels search adds filters like RxCUI and a current-labels-only flag that defaults to on, with up to 100 results a page. scite and Anysite expose similar label search endpoints. They can save you parsing work, but ask each vendor which source it syncs from and how it keeps labels current. The first two problems below come from openFDA's data. The third comes from the SPL files, so any wrapper that maps sections by code inherits it.
Three things we found testing openFDA's label endpoint
Most records have no openfda block
openFDA attaches an openfda object to each record, with harmonized fields such as generic_name, brand_name, rxcui and spl_set_id, but only where they apply. Of 262,908 label records, 181,838 (69%) have no openfda block at all. The common tutorial pattern searches openfda.generic_name, which silently skips every one of them. For metformin, openfda.generic_name:metformin returns 349 labels. A search of spl_product_data_elements, a section all but 298 records carry, returns 1,071, and 722 of those have no openfda block. DailyMed lists 559 current metformin labels.
The block works as a rough flag for whether a label is current. We looked up all 1,071 metformin records on DailyMed by set ID. Of the 349 with a block, 348 are listed there at the same version and 1 is not listed. Of the 722 without one, 520 are no longer listed, 159 are current and 43 are listed at a newer version than openFDA holds. Filtering on _exists_:openfda.spl_set_id removes 520 of the 521 retired labels, but it also drops 202 current ones, among them all 43 that openFDA holds at an older version. Search the section fields, then check each label against DailyMed.
One version per label, and it can be weeks behind
openFDA keeps one record per set ID, the stable identifier that survives label revisions, so it has no label history. DailyMed's /spls/{SETID}/history endpoint lists each published version with its publish date. openFDA's docs say the label endpoint updates weekly, and meta.last_updated read 2026-11-06 on the day we tested. The records told a different story. We took every human prescription and OTC label whose current version DailyMed published on one of six dates (September 15 and 23, and October 1, 8, 14 and 20), 707 in all, and looked each one up in openFDA by set ID. openFDA held the same version for 17, an older version for 457 and no record at all for 233. All 457 of the outdated records lacked an openfda block.
The counts by effective date show the same thing. openFDA holds between 3,419 and 3,797 label versions for each month from February to August 2026, then 1,173 for September and 73 for October. Take Adzynma: FDA announced a new boxed warning for it on September 23. DailyMed published version 8 of its label on October 1 and version 10 on November 5, but openFDA still serves version 7, effective August 20. Both version 7 and version 8 carry the warning, but version 8 dates the change 9/2026 where version 7 says 8/2026. We found no openFDA notice explaining the gap, and it may close. Either way, measure freshness yourself rather than trusting last_updated.
Field names follow the labeler's section codes
Each SPL section carries a LOINC code that the labeler assigns, and openFDA names its fields after those codes. In the current Ascend metformin label (set ID 0ff1ba75), subsection 8.2 Lactation carries 34079-4, which is the Labor and Delivery code. Subsection 8.3, Females and Males of Reproductive Potential, carries the Nursing Mothers code. As a result, openFDA files the lactation text under labor_and_delivery. Warnings follow the same pattern: 209,089 records have a warnings field, which also holds OTC Drug Facts warnings, while 47,173 use warnings_and_cautions. Search a list of fields, not one.
Search label text, then confirm it is current
A typical job comes from a pharmacovigilance or medical information team that wants every label with a boxed warning that mentions suicidal thoughts. openFDA finds 3,467 such labels, but only 1,580 of them have an openfda block. The script below searches the section directly and pages with the Link header, which follows openFDA's search_after mechanism. Skip-based paging stops at 26,000 records (skip tops out at 25,000 plus a final limit of 1,000), and this approach has no such cap. The script then asks DailyMed for each label's current version. It retries on 429 and 5xx responses and sends the optional key as a basic-auth username, so the key never ends up in a logged URL.
One encoding trap to know: openFDA's query syntax page writes queries as field:value+AND+field:value, where each plus stands for a space. If your client sends a literal plus, encoded as %2B, openFDA returns HTTP 500. We reproduced that. Pass spaces and let the client encode them.
import base64
import json
import os
import re
import time
import urllib.error
import urllib.parse
import urllib.request
OPENFDA = "https://api.fda.gov/drug/label.json"
DAILYMED = "https://dailymed.nlm.nih.gov/dailymed/services/v2"
KEY = os.environ.get("OPENFDA_API_KEY") # optional: without one you get 1,000 requests a day per IP
def fetch(url, retries=4):
"""GET JSON. Retries 429 and 5xx with backoff. A 404 means no matches."""
headers = {}
if KEY: # openFDA accepts the key as a basic-auth username, which keeps it out of Link URLs
headers["Authorization"] = "Basic " + base64.b64encode((KEY + ":").encode()).decode()
for attempt in range(retries):
try:
req = urllib.request.Request(url, headers=headers)
with urllib.request.urlopen(req, timeout=60) as resp:
return json.load(resp), resp.headers
except urllib.error.HTTPError as err:
if err.code == 404: # openFDA answers 404 when nothing matches
return None, err.headers
if err.code not in (429, 500, 502, 503, 504) or attempt == retries - 1:
raise
wait = err.headers.get("Retry-After")
time.sleep(float(wait) if wait and wait.isdigit() else 2 ** attempt)
def search_labels(query, page_size=100, max_records=500):
"""Yield label records for an openFDA search, following the Link header (no 26,000 cap)."""
params = {"search": query, "limit": page_size, "sort": "effective_time:desc"}
# urlencode turns spaces into "+", which openFDA reads as spaces. A literal %2B returns 500.
url = OPENFDA + "?" + urllib.parse.urlencode(params)
seen = 0
while url and seen < max_records:
body, headers = fetch(url)
if not body:
return
for rec in body["results"]:
yield rec
seen += 1
if seen >= max_records:
return
match = re.search(r'<([^>]+)>;\s*rel="next"', headers.get("Link") or "")
url = match.group(1) if match else None
def dailymed_version(set_id):
"""Current SPL version on DailyMed, or None if the set ID is no longer listed."""
body, _ = fetch(DAILYMED + "/spls.json?" + urllib.parse.urlencode({"setid": set_id}))
rows = (body or {}).get("data") or []
return int(rows[0]["spl_version"]) if rows else None
def freshness(rec):
held = int(rec["version"])
current = dailymed_version(rec["set_id"])
if current is None:
return "not listed on DailyMed"
if current > held:
return "stale (DailyMed has v%d, openFDA v%d)" % (current, held)
return "current"
def label_name(rec):
names = rec.get("openfda", {}).get("brand_name")
if names:
return names[0]
# Records with no openfda block still carry the product data section
return " ".join((rec.get("spl_product_data_elements") or ["(unnamed)"])[0].split()[:4])
if __name__ == "__main__":
query = 'boxed_warning:"suicidal thoughts"'
tally = {}
for rec in search_labels(query, max_records=60):
status = freshness(rec).split(" (")[0]
tally[status] = tally.get(status, 0) + 1
mapped = "mapped" if rec.get("openfda") else "unmapped"
print(rec["effective_time"], mapped, status, "|", label_name(rec))
time.sleep(0.25) # stay polite to DailyMed, which publishes no rate limit
print(tally)
On November 6, the 60 most recent matches gave 50 labels current on DailyMed, 6 behind DailyMed and 4 no longer listed. All 50 current labels had an openfda block, and none of the other 10 did. The DailyMed check costs one request per label, so store versions by set ID and recheck only what you show to users.
Watch for label changes with DailyMed
For change alerts, DailyMed is the better primary source. Its about page describes its contents as the most recent labeling companies submitted to FDA that is currently in use. The /spls endpoint filters by published_date with a gte comparison, so a daily job can ask what changed since yesterday. Each result carries a set ID and version. When the version moves, pull the SPL XML and compare the sections you care about, located by their LOINC codes. For the previous version, DailyMed documents a ZIP download by set ID and version number.
The section worth watching first is Recent Major Changes (43683-2). It lists the label sections that changed recently, with a month and year. In version 29 of the Ascend metformin label it reads "Boxed Warning 06/2026", which tells a reviewer where to look before any diff runs. Not every label has this section, so the watcher compares others too. The watcher below records a baseline on its first run. On later runs it prints each watched section that changed, along with the first new sentence.
import json
import pathlib
import re
import sys
import time
import urllib.parse
import urllib.request
import xml.etree.ElementTree as ET
DAILYMED = "https://dailymed.nlm.nih.gov/dailymed/services/v2"
STATE = pathlib.Path("label_state.json")
NS = {"v3": "urn:hl7-org:v3"}
# LOINC section codes used in SPL. Labelers assign them, so subsections can carry the wrong one.
WATCHED = {
"43683-2": "Recent major changes",
"34066-1": "Boxed warning",
"34067-9": "Indications and usage",
"34070-3": "Contraindications",
"43685-7": "Warnings and precautions",
"34084-4": "Adverse reactions",
"34073-7": "Drug interactions",
}
def get(url):
with urllib.request.urlopen(url, timeout=60) as resp:
return resp.read()
def published_since(drug, since):
"""SPLs for a drug name that DailyMed published on or after `since` (YYYY-MM-DD)."""
page = 1
while True:
params = {"drug_name": drug, "published_date": since,
"published_date_comparison": "gte", "pagesize": 100, "page": page}
body = json.loads(get(DAILYMED + "/spls.json?" + urllib.parse.urlencode(params)))
yield from body["data"]
if page >= body["metadata"]["total_pages"]:
return
page += 1
def sections(set_id):
"""Version and watched section text from the current SPL XML (DailyMed serves no JSON here)."""
root = ET.fromstring(get(DAILYMED + "/spls/%s.xml" % set_id))
version = int(root.find("v3:versionNumber", NS).get("value"))
found = {}
for sec in root.iter("{urn:hl7-org:v3}section"):
code = sec.find("v3:code", NS)
name = WATCHED.get(code.get("code") if code is not None else None)
if name:
text = " ".join("".join(sec.itertext()).split())
found[name] = (found.get(name, "") + " " + text).strip()
return version, found
def new_sentences(old, new):
before = set(re.split(r"(?<=[.!?])\s+", old))
return [s for s in re.split(r"(?<=[.!?])\s+", new) if s and s not in before]
def run(watchlist, since):
state = json.loads(STATE.read_text()) if STATE.exists() else {}
for drug in watchlist:
for spl in published_since(drug, since):
set_id, listed, title = spl["setid"], int(spl["spl_version"]), spl["title"]
prev = state.get(set_id)
if prev and prev["version"] >= listed:
continue
version, now = sections(set_id)
time.sleep(0.25)
if prev is None:
print("BASELINE v%d %s" % (version, title[:80]))
else:
for name in sorted(set(now) | set(prev["sections"])):
old, new = prev["sections"].get(name, ""), now.get(name, "")
if old != new:
added = new_sentences(old, new)
print("CHANGED v%d->v%d %s | %s | +%d sentences: %s" % (
prev["version"], version, title[:60], name, len(added),
(added[0][:140] if added else "(text removed or reworded)")))
state[set_id] = {"version": version, "title": title, "sections": now}
STATE.write_text(json.dumps(state))
if __name__ == "__main__":
# python3 label_watch.py 2026-10-01 adzynma metformin
run(sys.argv[2:], sys.argv[1])
We ran it against live DailyMed data for Adzynma and metformin labels published since November 1, then rolled one stored version back to confirm that it reports the changed sections. A third run with nothing new printed nothing. For prescription drugs under NDAs and BLAs, cross-check what you find against SrLC, which records FDA-approved safety changes by section. A new version means the text moved. It does not, on its own, mean anything clinically new happened.
Where labels stop, and where You.com fits
A label shows what the text says now. It does not show why it changed, what FDA said about the change, or whether a recall or safety communication came with it. That context lives on fda.gov pages and in announcements, which makes it a web retrieval problem rather than a label query. You.com is not a label database. It cannot list every label with a boxed warning, and you should not use it for that. Use openFDA and DailyMed to decide which labels matter, then use the Research API to ask what FDA has published about a drug since a given date.
Two Research API features fit this job, and the API reference marks both as beta. The first is source_control, which takes an allowlist of up to 500 domains and a date range. The second is output_schema, which returns typed JSON and works on every tier except lite. Our walkthrough of the Research API controls covers both. The docs say the API does not add citation fields to your schema, so the script asks for a source URL per event. It then checks each URL against the pages the API actually read, which is the kind of check that gives LLM citations their value. For retries and background mode, see our Research API in Python guide.
import datetime
import json
import os
import sys
import urllib.request
RESEARCH = "https://api.you.com/v1/research"
# The docs do not say whether a domain matches its subdomains, so list the hosts you rely on
SOURCES = ["fda.gov", "www.fda.gov", "accessdata.fda.gov", "dailymed.nlm.nih.gov"]
SCHEMA = {
"type": "object",
"properties": {
"events": {
"type": "array",
"items": {
"type": "object",
"properties": {
"date": {"type": ["string", "null"]},
"kind": {"type": "string", "enum": [
"boxed_warning", "contraindication", "warning_or_precaution",
"safety_communication", "recall", "other"]},
"summary": {"type": "string"},
"source_url": {"type": ["string", "null"]},
},
"required": ["date", "kind", "summary", "source_url"],
"additionalProperties": False,
},
},
"nothing_reported": {"type": "boolean"},
},
"required": ["events", "nothing_reported"],
"additionalProperties": False,
}
def safety_brief(drug, since, today=None):
today = today or datetime.date.today().isoformat()
body = json.dumps({
"input": (f"What safety-related labeling changes, Drug Safety Communications or recalls has "
f"FDA published for {drug} between {since} and {today}? Give the date and the "
f"FDA or DailyMed page for each. If nothing was published, say so."),
"research_effort": "standard", # output_schema is not supported on "lite"
"source_control": {"include_domains": SOURCES, "freshness": f"{since}to{today}"},
"output_schema": SCHEMA,
}).encode()
req = urllib.request.Request(RESEARCH, data=body, method="POST", headers={
"X-API-Key": os.environ["YDC_API_KEY"],
"Content-Type": "application/json",
"User-Agent": "my-app/1.0",
})
with urllib.request.urlopen(req, timeout=90) as resp: # standard runs take about 10 to 30 s
return json.load(resp)["output"]
def checked_events(output):
"""Keep only events whose source_url is one of the pages the API actually read."""
read = {s["url"] for s in output.get("sources", [])}
for event in output["content"]["events"]:
event["verified_source"] = event["source_url"] in read
yield event
if __name__ == "__main__":
out = safety_brief(sys.argv[1], sys.argv[2])
if out["content"]["nothing_reported"]:
print("Nothing reported in the window")
for e in checked_events(out):
flag = "" if e["verified_source"] else " [CHECK: URL not in sources]"
print(e["date"], e["kind"], "|", e["summary"][:100], "|", e["source_url"], flag)
We tested this offline against a fixture shaped like the documented response, with output.content as the schema object and output.sources listing the URLs the API read. The test confirmed the request body, the schema rules from the docs, and that an event citing an unread URL gets flagged. Keep the User-Agent header: in our tests on November 20, 2026, api.you.com answered Python's default urllib one with a 403 (Cloudflare error 1010). To keep a record of what a cited FDA page said on the day you checked it, pass the URL to the Contents API with max_age set to 0, which skips cached copies and re-fetches the page. It reads only the URLs you give it, up to 10 per request. The same detect-then-explain pattern drives our CVE monitoring pipeline.
What a label monitoring stack costs
The label data costs nothing to call: the openFDA key is free, NLM's terms say the RxNorm API may be used free of charge, and DailyMed needs no key. You pay for the explanation layer. You.com list prices as of November 2026, from the billing docs:
| Call | Price per 1,000 | Use it for |
|---|---|---|
| Research API, standard | $50 | Structured safety brief when the watcher fires |
| Research API, lite | $12 | Quick yes or no triage, in Markdown only, because lite has no output_schema |
| Contents API | $1.00 (per 1,000 pages) | Archiving the FDA pages a brief cites |
| Web Search API | $5.00 | Daily fda.gov news check, up to 100 results per call |
Here is a worked example for a 200-drug watchlist. A weekly standard brief for every drug comes to about 870 calls a month, or roughly $43. Run the brief only when DailyMed reports a new version, and the bill shrinks to the number of labels that actually changed. Archiving three cited pages per brief adds about $2.60 a month at that volume.
What to test before you ship
- Coverage. For your own drug list, compare counts from
openfda.*filters with counts from section fields. The gap is the set of labels your app would miss. - Freshness. Each day, compare openFDA's version with DailyMed's for a sample of labels you care about, and alert when openFDA falls behind. Do not rely on
meta.last_updated. - Paging. Use the
Linkheader for anything that can pass 26,000 records, and stop when the header disappears. - Encoding. Assert that your client sends spaces rather than
%2B. - Section mapping. Check your field list against a few labels you know, because labelers sometimes put text under the wrong code.
- Rate limits. Without a key, openFDA allows 1,000 requests a day per IP address, which a shared address can exhaust. The free key raises the limit to 120,000 a day. Cache RxNorm lookups for 12 to 24 hours, as NLM recommends.
- Clinical use. openFDA's own disclaimer says not to rely on it to make decisions about medical care. Present output for professional review.
Get those right, and two free federal APIs plus a cited web layer cover label search, change alerts and the reasons behind them.
Frequently Asked Questions
Yes. openFDA's drug label endpoint costs nothing. The docs call the API key required but free, and they also list limits for calls without one: 240 requests a minute and 1,000 a day per IP address. Calls without a key worked in our tests on November 6, 2026. With a key, the daily limit rises to 120,000. openFDA's own disclaimer says not to rely on it for medical care decisions.
Both are built from FDA's SPL label documents. openFDA turns labels into searchable JSON section fields, but keeps one record per label with no history. On November 6, 2026 it held an older version or no record for 690 of 707 labels whose current version DailyMed published on six dates in September and October. DailyMed lists the labeling currently in use, offers version history for each set ID, and serves the full label as SPL XML. Use openFDA to search text and DailyMed to confirm currency.
Searches on openfda.generic_name only match records that have an openfda block, and 69% of the 262,908 label records we checked have none. For metformin, that field returned 349 labels, while a search of spl_product_data_elements returned 1,071. Search the label sections or product data directly, then check each result against DailyMed to drop retired labels.
Ask DailyMed. Its /spls endpoint with a setid filter returns the current version number. /spls/{SETID}.xml returns the full current label as SPL XML, and /spls/{SETID}/history lists each published version with its publish date. Compare that version with the one openFDA returns before you show openFDA text, because openFDA can serve an older version without saying so.
Query DailyMed's /spls endpoint daily with published_date set to your last run and the gte comparison. For each set ID whose version moved, pull the SPL XML and compare the sections you care about by LOINC code, starting with Recent Major Changes. For prescription drugs under NDAs and BLAs, FDA's SrLC database records approved safety labeling changes by section from January 2016 onward.
Yes. openFDA lets you search individual sections, for example boxed_warning:"suicidal thoughts", which matched 3,467 labels in our test. Field names follow the section codes labelers assign, so search a list of fields, such as warnings and warnings_and_cautions, rather than one. For one-off research, FDA's FDALabel web application offers full-text search by section with spreadsheet export.
LI Test
LI Test
Share Article:
Related resources.
.webp)
Search 1B+ professional profiles, 100M+ companies with Knowledge Pro
December 2, 2026
Product Updates

Introducing the You.com Extract API: fetch and parse any URL, with 80% higher accuracy on PDFs
November 17, 2026
Product Updates

FDA Approval Monitoring API: Sources, Lag and a Working Pipeline
November 15, 2026
Blog

Equity Research Automation API: What to Automate and How to Check the Numbers
November 14, 2026
Blog

Retail Assortment Monitoring API: How to Track What Competitors Add, Drop, and Carry
November 13, 2026
Blog
