Drugs

Overview

US drug labels by set id: what a drug is approved to do, and what it must warn about.

status
live
document id
set_id e.g. f5e548d0-cc79-4c34-a3f5-e20a5b8b6564
citation
[openFDA SPL f5e548d0…]
updated
2026-10

Common calls

Find labelsPOST /v1/drugs/search {"query": "GLP-1 受体激动剂 减重", "filters": {"has_boxed_warning": true}}
Read one labelGET /v1/drugs/read/<set_id>
Filter by classGET /v1/drugs/facets?field=pharm_class_epc
The fine print
  • 67% (171,903) are product_type=UNMAPPED: those SPLs have no openfda mapping block, so generic name / route / pharmacologic class may be empty — use spl_name for the product name.
  • Only the latest version per set_id is kept; no label history.
  • Indications and contraindications are extracted highlights; go back to the label for prescribing decisions.
  • Not medical advice.
  • The index holds no full text: level=full is not available yet (the label sections live on NAS (openfda/label); the index carries only section names and token counts).

Read

GET/v1/drugs/read/{set_id}
Three depths. detail is the default. Free sample: f5e548d0-cc79-4c34-a3f5-e20a5b8b6564.

Levels

levelcreditsreturns
brief1Card: the fields needed to triage, same as in search hits
detail (default)2Every structured field (rule-derived plus model-generated; model fields are listed in _enrich.fields)
full5Full text (not available yet: the label sections live on NAS (openfda/label); the index carries only section names and token counts)

Parameters

ParameterTypeDescription
set_id (path) REQUIRED string Document id (set_id).
level brief · detail · full= detail How deep to read.
format json · md · html= json Response shape.

Example

{ "domain": "drugs", "id": "f5e548d0-cc79-4c34-a3f5-e20a5b8b6564", "level": "detail", "view": "head", "data": { … } | "text": "…", "token_count": 1834, "meta": { … } }
The older GET /v1/drugs/doc/{id}?view=… still works.

Read many

POST/v1/drugs/read
Up to 50 ids, one level. Missing ids come back with error: "not_found" and are not charged.

Parameters

ParameterTypeDescription
ids REQUIRED string[] Document ids.
level brief · detail · full= detail Level for every id.

Example

{ "domain": "drugs", "level": "detail", "docs": [ { "id": "…", "data": { … } }, { "id": "…", "error": "not_found" } ], "meta": { … } }

Facets

GET/v1/drugs/facets?field={field}
Legal values for a filter field, so an agent never guesses; precomputed fields carry counts, declared enums come without. Free, no key.

Parameters

ParameterTypeDescription
field REQUIRED route · product_type · pharm_class_epc Filter field with facets.
limit integer= 50 Max values.

Example

{ "domain": "drugs", "field": "…", "values": [ { "value": "…", "count": 3120 } ], "meta": { … } }

Askregistered key+ /stream

POST/v1/drugs/ask
Agentic Q&A over this domain: the model turns the question into filters plus keywords from the domain's own self-description, reads the hits and answers with [drugs: ] citations; /stream is NDJSON with real token deltas. <code>effort</code> low / medium / high = 50 / 100 / 200 credits. Append <code>/stream</code> for NDJSON; the first event is always <code>billing</code>. A failure before the first <code>answer_delta</code> is refunded.</div> <h4>Parameters</h4> <div class="tblwrap"><table class="tbl t3 tparam"> <thead><tr><th>Parameter</th><th>Type</th><th>Description</th></tr></thead> <tbody> <tr> <td>query<span class="req"> REQUIRED</span></td> <td class="ty">string</td> <td>1–2000 characters. Be specific; ask for numbers if you want numbers.</td> </tr><tr> <td>effort</td> <td class="ty">low · medium · high<span class="def">= low</span></td> <td>Reading rounds, and the price: 50 / 100 / 200 credits. Your plan caps it.</td> </tr><tr> <td>verbose</td> <td class="ty">bool<span class="def">= false</span></td> <td>Include the tool-call trace (tool_call / tool_result / thinking events when streaming).</td> </tr><tr> <td>top_k</td> <td class="ty">integer<span class="def">= 10</span></td> <td>Speculative prefetch size.</td> </tr><tr> <td>stream_answer</td> <td class="ty">bool<span class="def">= true</span></td> <td>Streaming only: false emits one answer event instead of deltas.</td> </tr><tr> <td>max_rounds</td> <td class="ty">integer</td> <td>0–8, overrides the effort preset.</td> </tr><tr> <td>force_answer_after</td> <td class="ty">number</td> <td>Seconds; hard cutover into the answer phase.</td> </tr><tr> <td>max_answer_tokens</td> <td class="ty">integer<span class="def">= 4096</span></td> <td>Hitting it sets answer_truncated.</td> </tr><tr> <td>language</td> <td class="ty">string</td> <td>Answer language; defaults to the query’s.</td> </tr> </tbody> </table></div> <h4>Example</h4> <pre class="code">{ "answer": "… [openFDA SPL f5e548d0…] …", "sources": [ … ], "stats": { "rounds": 1, "elapsed_s": 6.2, "answer_truncated": false }, "coverage"?: { … }, "meta": { "credits": { "charged": 50, … } } }</pre> <div class="callout "><b>Citations are real</b> — every id in <code>answer</code> exists in this domain (format <code>[openFDA SPL f5e548d0…]</code>). <b><code>sources</code> is the retrieval set</b>, not the citation list. <b><code>answer_truncated</code> means incomplete.</b></div> </section> </div> </div> <aside class="pg" data-playground> <div class="pg-handle" data-pg-handle></div> <div class="pg-head"><b>Playground</b><span class="hint">Follows the section you are reading</span><button class="icon-btn" data-pg-close type="button" aria-label="Close">✕</button></div> <div class="pg-body" data-pg-body></div> <script type="application/json" data-pg-specs>[{"id":"drugs-search","domain":"drugs","method":"POST","path":"/v1/drugs/search","auth":"optional","status":"live","title":{"en":"Search","zh":"检索"},"summary":{"en":"Hybrid retrieval, one card per hit. 2 credits. Free sample: <code>semaglutide weight loss</code>.<h4 class=\"sub\">Filter fields</h4><div class=\"tblwrap\"><table class=\"tbl t3\"><thead><tr><th>field</th><th>type · ops</th><th>meaning</th></tr></thead><tbody><tr><td class=\"mono\">route</td><td class=\"mono dim\">keyword · eq any<span class=\"vals\">ORAL · TOPICAL · INTRAVENOUS · INTRAMUSCULAR · SUBCUTANEOUS · OPHTHALMIC <span class=\"dim\">… 13 values, /facets lists them all</span></span></td><td>Route of administration</td></tr><tr><td class=\"mono\">product_type</td><td class=\"mono dim\">keyword · eq any<span class=\"vals\">HUMAN PRESCRIPTION DRUG · HUMAN OTC DRUG · CELLULAR THERAPY · UNMAPPED</span></td><td>Product type; UNMAPPED = the SPL has no openfda mapping block</td></tr><tr><td class=\"mono\">is_rx</td><td class=\"mono dim\">bool · eq</td><td>Prescription-only</td></tr><tr><td class=\"mono\">has_boxed_warning</td><td class=\"mono dim\">bool · eq</td><td>Has a boxed warning</td></tr><tr><td class=\"mono\">pharm_class_epc</td><td class=\"mono dim\">keyword · eq any</td><td>Pharmacologic class (EPC)</td></tr><tr><td class=\"mono\">effective_year</td><td class=\"mono dim\">integer · eq range</td><td>Label version year, range</td></tr></tbody></table></div><details class=\"adv\"><summary>8 more, all usable</summary><div class=\"tblwrap\"><table class=\"tbl t3\"><thead><tr><th>field</th><th>type · ops</th><th>meaning</th></tr></thead><tbody><tr><td class=\"mono\">generic_name</td><td class=\"mono dim\">keyword · eq any</td><td>Generic name (exact)</td></tr><tr><td class=\"mono\">substance_names</td><td class=\"mono dim\">keyword · eq any</td><td>Active substances</td></tr><tr><td class=\"mono\">pharm_class_moa</td><td class=\"mono dim\">keyword · eq any</td><td>Pharmacologic class (mechanism of action)</td></tr><tr><td class=\"mono\">manufacturer</td><td class=\"mono dim\">keyword · eq any</td><td>Labeler / manufacturer (exact)</td></tr><tr><td class=\"mono\">rxcui</td><td class=\"mono dim\">keyword · eq any</td><td>RxNorm concept id</td></tr><tr><td class=\"mono\">unii</td><td class=\"mono dim\">keyword · eq any</td><td>Substance UNII</td></tr><tr><td class=\"mono\">product_ndc</td><td class=\"mono dim\">keyword · eq any</td><td>NDC product code</td></tr><tr><td class=\"mono\">application_number</td><td class=\"mono dim\">keyword · eq any</td><td>FDA application number (NDA / ANDA / BLA)</td></tr></tbody></table></div></details>","zh":"混合检索,每条命中一张卡片。2 credits。免费样例:<code>semaglutide weight loss</code>。<h4 class=\"sub\">过滤字段</h4><div class=\"tblwrap\"><table class=\"tbl t3\"><thead><tr><th>字段</th><th>类型 · op</th><th>含义</th></tr></thead><tbody><tr><td class=\"mono\">route</td><td class=\"mono dim\">keyword · eq any<span class=\"vals\">ORAL · TOPICAL · INTRAVENOUS · INTRAMUSCULAR · SUBCUTANEOUS · OPHTHALMIC <span class=\"dim\">…共 13 个,/facets 可列全</span></span></td><td>给药途径</td></tr><tr><td class=\"mono\">product_type</td><td class=\"mono dim\">keyword · eq any<span class=\"vals\">HUMAN PRESCRIPTION DRUG · HUMAN OTC DRUG · CELLULAR THERAPY · UNMAPPED</span></td><td>产品类型;UNMAPPED = 该 SPL 没有 openfda 映射块</td></tr><tr><td class=\"mono\">is_rx</td><td class=\"mono dim\">bool · eq</td><td>是否处方药</td></tr><tr><td class=\"mono\">has_boxed_warning</td><td class=\"mono dim\">bool · eq</td><td>是否有黑框警告</td></tr><tr><td class=\"mono\">pharm_class_epc</td><td class=\"mono dim\">keyword · eq any</td><td>药理类别(EPC,建立的疗效分类)</td></tr><tr><td class=\"mono\">effective_year</td><td class=\"mono dim\">integer · eq range</td><td>说明书版本年份区间</td></tr></tbody></table></div><details class=\"adv\"><summary>还有 8 个,照样能用</summary><div class=\"tblwrap\"><table class=\"tbl t3\"><thead><tr><th>字段</th><th>类型 · op</th><th>含义</th></tr></thead><tbody><tr><td class=\"mono\">generic_name</td><td class=\"mono dim\">keyword · eq any</td><td>通用名(精确)</td></tr><tr><td class=\"mono\">substance_names</td><td class=\"mono dim\">keyword · eq any</td><td>活性成分</td></tr><tr><td class=\"mono\">pharm_class_moa</td><td class=\"mono dim\">keyword · eq any</td><td>药理类别(MoA,作用机制)</td></tr><tr><td class=\"mono\">manufacturer</td><td class=\"mono dim\">keyword · eq any</td><td>标签持有人/厂商(精确)</td></tr><tr><td class=\"mono\">rxcui</td><td class=\"mono dim\">keyword · eq any</td><td>RxNorm 概念 id</td></tr><tr><td class=\"mono\">unii</td><td class=\"mono dim\">keyword · eq any</td><td>成分 UNII</td></tr><tr><td class=\"mono\">product_ndc</td><td class=\"mono dim\">keyword · eq any</td><td>NDC 产品码</td></tr><tr><td class=\"mono\">application_number</td><td class=\"mono dim\">keyword · eq any</td><td>FDA 申请号(NDA / ANDA / BLA)</td></tr></tbody></table></div></details>"},"params":[{"name":"query","type":"string","required":true,"in":"body","example":"semaglutide weight loss","desc":{"en":"1–1000 characters. Or an array of up to 5 (batch; hits become results[]).","zh":"1–1000 字符。也可以是最多 5 条的数组(批量,hits 变 results[])。"}},{"name":"top_k","type":"integer","default":"10","in":"body","desc":{"en":"1–100.","zh":"1–100。"}},{"name":"fields","type":"enum","options":["brief","head"],"default":"brief","in":"body","desc":{"en":"head costs one more credit and returns the head view per hit.","zh":"head 多扣 1 credit,每条附 head 视图。"}},{"name":"filters","type":"json","in":"body","example":"","desc":{"en":"Filter DSL object (see Getting started); declared fields are listed above.","zh":"过滤 DSL 对象(见快速开始);可用字段见上表。"}},{"name":"mode","type":"enum","options":["hybrid","dense","bm25"],"default":"hybrid","in":"body","advanced":false,"desc":{"en":"Retrieval mode. Leave it out to use the first.","zh":"检索模式。不传就用第一个。"}},{"name":"offset","type":"integer","default":"0","in":"body","advanced":true,"desc":{"en":"Pagination.","zh":"翻页。"}}],"example":"{ \"domain\": \"drugs\", \"query\": \"…\", \"hits\": [ { \"id\": \"f5e548d0-cc79-4c34-a3f5-e20a5b8b6564\", \"score\": 0.83, \"brief\": { … } } ], \"total\": null, \"coverage\": …, \"warnings\": [],\n \"meta\": { \"request_id\": \"req_…\", \"credits\": { \"charged\": 2, \"balance\": 1998, \"pool\": \"allowance\" }, \"latency_ms\": 41, \"cached\": false } }","notes":[{"html":{"en":"<b>Undeclared filter fields return 400</b> rather than being ignored silently. Filters combine with AND; <code>_or</code> / <code>_not</code> are available.","zh":"<b>用了未声明的过滤字段返回 400</b>,不会静默忽略。过滤条件是 AND;可用 <code>_or</code> / <code>_not</code>。"}}]},{"id":"drugs-read","domain":"drugs","method":"GET","path":"/v1/drugs/read/{set_id}","auth":"optional","status":"live","title":{"en":"Read","zh":"读"},"summary":{"en":"Three depths. <code>detail</code> is the default. Free sample: <code>f5e548d0-cc79-4c34-a3f5-e20a5b8b6564</code>.<h4 class=\"sub\">Levels</h4><div class=\"tblwrap\"><table class=\"tbl t3 tnum\"><thead><tr><th>level</th><th>credits</th><th>returns</th></tr></thead><tbody><tr><td class=\"mono\">brief</td><td class=\"mono num\">1</td><td>Card: the fields needed to triage, same as in search hits</td></tr><tr><td class=\"mono\">detail <span class=\"dim\">(default)</span></td><td class=\"mono num\">2</td><td>Every structured field (rule-derived plus model-generated; model fields are listed in _enrich.fields)</td></tr><tr><td class=\"mono\">full</td><td class=\"mono num\">5</td><td>Full text (not available yet: the label sections live on NAS (openfda/label); the index carries only section names and token counts)</td></tr></tbody></table></div>","zh":"三档深浅,不传就是 <code>detail</code>。免费样例:<code>f5e548d0-cc79-4c34-a3f5-e20a5b8b6564</code>。<h4 class=\"sub\">三档</h4><div class=\"tblwrap\"><table class=\"tbl t3 tnum\"><thead><tr><th>深浅</th><th>credits</th><th>返回</th></tr></thead><tbody><tr><td class=\"mono\">brief</td><td class=\"mono num\">1</td><td>卡片:做取舍够用的字段(检索结果里那张)</td></tr><tr><td class=\"mono\">detail <span class=\"dim\">(默认)</span></td><td class=\"mono num\">2</td><td>全部结构化字段(规则字段 + 模型字段,模型字段在 _enrich.fields 里列名)</td></tr><tr><td class=\"mono\">full</td><td class=\"mono num\">5</td><td>全文(建设中:说明书各节原文在 NAS openfda/label,检索库里只有节名与 token 数(sections))</td></tr></tbody></table></div>"},"params":[{"name":"set_id","type":"string","required":true,"in":"path","example":"f5e548d0-cc79-4c34-a3f5-e20a5b8b6564","desc":{"en":"Document id (set_id).","zh":"文档 id(set_id)。"}},{"name":"level","type":"enum","options":["brief","detail","full"],"default":"detail","desc":{"en":"How deep to read.","zh":"读多深。"}},{"name":"format","type":"enum","options":["json","md","html"],"default":"json","desc":{"en":"Response shape.","zh":"响应形态。"}}],"example":"{ \"domain\": \"drugs\", \"id\": \"f5e548d0-cc79-4c34-a3f5-e20a5b8b6564\", \"level\": \"detail\", \"view\": \"head\", \"data\": { … } | \"text\": \"…\", \"token_count\": 1834, \"meta\": { … } }","notes":[{"html":{"en":"The older <code>GET /v1/drugs/doc/{id}?view=…</code> still works.","zh":"旧写法 <code>GET /v1/drugs/doc/{id}?view=…</code> 仍然可用。"}}]},{"id":"drugs-read-batch","domain":"drugs","method":"POST","path":"/v1/drugs/read","auth":"token","status":"live","title":{"en":"Read many","zh":"批量读"},"summary":{"en":"Up to 50 ids, one level. Missing ids come back with <code>error: \"not_found\"</code> and are not charged.","zh":"最多 50 个 id,同一档。查不到的 id 返回 <code>error: \"not_found\"</code>,不扣费。"},"params":[{"name":"ids","type":"array","list":true,"required":true,"in":"body","example":"f5e548d0-cc79-4c34-a3f5-e20a5b8b6564","desc":{"en":"Document ids.","zh":"文档 id 列表。"}},{"name":"level","type":"enum","options":["brief","detail","full"],"default":"detail","in":"body","desc":{"en":"Level for every id.","zh":"所有 id 共用的档。"}}],"example":"{ \"domain\": \"drugs\", \"level\": \"detail\", \"docs\": [ { \"id\": \"…\", \"data\": { … } }, { \"id\": \"…\", \"error\": \"not_found\" } ], \"meta\": { … } }"},{"id":"drugs-facets","domain":"drugs","method":"GET","path":"/v1/drugs/facets","auth":"none","status":"live","title":{"en":"Facets","zh":"Facets"},"summary":{"en":"Legal values for a filter field, so an agent never guesses; precomputed fields carry counts, declared enums come without. Free, no key.","zh":"某个过滤字段的合法值,agent 不用猜;预聚合字段带计数,声明的枚举没有。免费、不需要 key。"},"params":[{"name":"field","type":"enum","options":["route","product_type","pharm_class_epc"],"required":true,"example":"route","desc":{"en":"Filter field with facets.","zh":"有 facets 的过滤字段。"}},{"name":"limit","type":"integer","default":"50","advanced":true,"desc":{"en":"Max values.","zh":"最多返回多少个值。"}}],"example":"{ \"domain\": \"drugs\", \"field\": \"…\", \"values\": [ { \"value\": \"…\", \"count\": 3120 } ], \"meta\": { … } }"},{"id":"drugs-ask","domain":"drugs","method":"POST","path":"/v1/drugs/ask","auth":"registered","status":"live","stream":true,"agentic":true,"title":{"en":"Ask","zh":"问"},"summary":{"en":"Agentic Q&A over this domain: the model turns the question into filters plus keywords from the domain's own self-description, reads the hits and answers with [drugs:<set_id> <title>] citations; /stream is NDJSON with real token deltas. <code>effort</code> low / medium / high = 50 / 100 / 200 credits. Append <code>/stream</code> for NDJSON; the first event is always <code>billing</code>. A failure before the first <code>answer_delta</code> is refunded.","zh":"本域的 agentic 问答:模型按自描述把问题翻成检索(筛选 + 关键词),读详情后作答,引用写成 [drugs:<set_id> <标题>];/stream 为 NDJSON,answer_delta 是边生成边发的真实片段。<code>effort</code> low / medium / high 对应 50 / 100 / 200 credits。加 <code>/stream</code> 走 NDJSON,第一个事件一定是 <code>billing</code>。首个 <code>answer_delta</code> 之前失败会退款。"},"params":[{"name":"query","type":"string","required":true,"in":"body","example":"semaglutide weight loss","desc":{"en":"1–2000 characters. Be specific; ask for numbers if you want numbers.","zh":"1–2000 字符。问得具体;要数字就直接问数字。"}},{"name":"effort","type":"enum","options":["low","medium","high"],"default":"low","in":"body","desc":{"en":"Reading rounds, and the price: 50 / 100 / 200 credits. Your plan caps it.","zh":"检索轮数,也决定价格:50 / 100 / 200 credits。套餐限制最高档。"}},{"name":"verbose","type":"bool","default":"false","in":"body","desc":{"en":"Include the tool-call trace (tool_call / tool_result / thinking events when streaming).","zh":"返回工具调用轨迹(流式时多 tool_call / tool_result / thinking 事件)。"}},{"name":"top_k","type":"integer","default":"10","in":"body","advanced":true,"desc":{"en":"Speculative prefetch size.","zh":"预取候选数。"}},{"name":"stream_answer","type":"bool","default":"true","in":"body","advanced":true,"desc":{"en":"Streaming only: false emits one answer event instead of deltas.","zh":"仅流式:false 时只发一个 answer 事件。"}},{"name":"max_rounds","type":"integer","in":"body","advanced":true,"desc":{"en":"0–8, overrides the effort preset.","zh":"0–8,覆盖 effort 预设。"}},{"name":"force_answer_after","type":"number","in":"body","advanced":true,"desc":{"en":"Seconds; hard cutover into the answer phase.","zh":"秒;强制切入作答阶段。"}},{"name":"max_answer_tokens","type":"integer","default":"4096","in":"body","advanced":true,"desc":{"en":"Hitting it sets answer_truncated.","zh":"触顶时置 answer_truncated。"}},{"name":"language","type":"string","in":"body","advanced":true,"desc":{"en":"Answer language; defaults to the query’s.","zh":"回答语言,默认跟随 query。"}}],"example":"{ \"answer\": \"… [openFDA SPL f5e548d0…] …\", \"sources\": [ … ], \"stats\": { \"rounds\": 1, \"elapsed_s\": 6.2, \"answer_truncated\": false }, \"coverage\"?: { … }, \"meta\": { \"credits\": { \"charged\": 50, … } } }","notes":[{"html":{"en":"<b>Citations are real</b> — every id in <code>answer</code> exists in this domain (format <code>[openFDA SPL f5e548d0…]</code>). <b><code>sources</code> is the retrieval set</b>, not the citation list. <b><code>answer_truncated</code> means incomplete.</b>","zh":"<b>引用是真的</b>——<code>answer</code> 里的每个 id 都存在于本垂域(格式 <code>[openFDA SPL f5e548d0…]</code>)。<b><code>sources</code> 是召回集</b>,不是引用列表。<b><code>answer_truncated</code> 表示不完整。</b>"}}]}]</script> <script type="application/json" data-pg-strings>{"title":"Playground","hint":"Follows the section you are reading","token":"API token","tokenHint":"fa_live_… key · optional for free samples · stored in this browser only","tokenReq":"API key required (fa_live_…)","send":"Send request","stream":"Stream","response":"Response","events":"Events","answer":"Answer","sources":"Sources","cited":"cited","retrieved":"retrieved","stats":"Stats","coming":"This domain is still building. The request shape is final; sending is disabled until it is live.","open":"Playground","close":"Close","tokens":"tokens","chars":"characters","truncated":"answer truncated","code":"Code","openTab":"Open in a new tab","report":"This one is wrong — report it","quotaHit":"Daily quota used up ({used} / {limit}, resets {reset}). It is a quota, not a rate limit, so retrying will not help: write to {mail} about {grant}.","rateHit":"Over your rpm. Retry in {n} s.","lang":"en","apiBase":"https://api.1stauthor.com","codeBase":"https://api.1stauthor.com","keys":"/dashboard/keys/","fb":"/feedback/","contact":"tommy@chien.io"}</script> </aside> <button class="btn btn-primary pg-fab" data-pg-open type="button">Playground</button> <script type="module" src="/_astro/DocsShell.astro_astro_type_script_index_0_lang.cOZozF12.js"></script> </main> <script type="module" src="/_astro/Base.astro_astro_type_script_index_0_lang.B9qjIrvh.js"></script> </body> </html>