FDA NDC directory lookup
GET /api/drug-ndcLook up the FDA National Drug Code directory (openFDA) by NDC or by brand or generic name: product NDC, labeler, dosage form, routes, active ingredients with strengths...
Details
Look up the FDA National Drug Code directory (openFDA) by NDC or by brand or generic name: product NDC, labeler, dosage form, routes, active ingredients with strengths, marketing category and application number, pharmacologic class, marketing and listing dates, and the package NDCs with their descriptions. The answer says how many products matched. Live FDA data, no key.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
ndc | string | no | Product NDC (e.g. 58151-155) or package NDC (e.g. 58151-155-77), hyphenated The example sends 58151-155. |
name | string | no | Brand or generic name, used when no ndc is given (e.g. lipitor) Up to 100 characters. |
limit | number | no | Products to return, 1-20 (default 5) |
Example request
curl -i "https://agent402.tools/api/drug-ndc?ndc=58151-155"
Watch a call get paid
GET /api/drug-ndc$0.004 USDCPAYMENT-SIGNATUREon 14 chains200 OKAgent402-ReceiptEd25519Example response
{
"query": {
"ndc": "58151-155",
"name": null
},
"count": 1,
"products": [
{
"productNdc": "58151-155",
"brandName": "Lipitor",
"genericName": "atorvastatin calcium",
"labeler": "Viatris Specialty LLC",
"dosageForm": "TABLET, FILM COATED",
"routes": [
"ORAL"
],
"productType": "HUMAN PRESCRIPTION DRUG",
"marketingCategory": "NDA",
"applicationNumber": "NDA020702",
"activeIngredients": [
{
"name": "ATORVASTATIN CALCIUM TRIHYDRATE",
"strength": "10 mg/1"
}
],
"pharmClass": [
"HMG-CoA Reductase Inhibitor [EPC]"
],
"marketingStartDate": "2024-05-01",
"listingExpirationDate": "2027-12-31",
"finished": true,
"packaging": [
{
"packageNdc": "58151-155-77",
"description": "90 TABLET, FILM COATED in 1 BOTTLE (58151-155-77)",
"marketingStartDate": "2024-05-01",
"sample": false
}
],
"packagingCount": 1
}
],
"returned": 1,
"matched": 1,
"complete": true,
"truncated": false,
"disclaimer": "openFDA data is unvalidated and is not medical advice; do not rely on it to make decisions regarding medical care.",
"source": "api.fda.gov (openFDA NDC directory, public domain)",
"credit": "Data provided by the U.S. Food and Drug Administration (https://open.fda.gov)."
}| Field | Type | Always present | In the example |
|---|---|---|---|
query | object | yes | 2 fields: ndc, name |
count | number | yes | 1 |
products | array of objects | yes | 1 item in the example |
returned | number | yes | 1 |
matched | number | yes | 1 |
complete | boolean | yes | true |
truncated | boolean | yes | false |
disclaimer | string | yes | openFDA data is unvalidated and is not medical advice; do not rely on it to m... |
source | string | yes | api.fda.gov (openFDA NDC directory, public domain) |
credit | string | yes | Data provided by the U.S. Food and Drug Administration (https://open.fda.gov). |
From an MCP client
catalog.call {
"slug": "drug-ndc",
"params": {
"ndc": "58151-155"
}
}Hosted connector (https://agent402.tools/mcp): paid in the call. Stdio package (npx -y agent402-mcp@0.17.2): pays from a wallet or an AGENT402_CREDITS_KEY issued earlier.
Errors and behavior
- Pay $0.004 per call over x402 or MPP. Wallet-only: this tool reaches the network or stored state, so it has no proof-of-work tier. A card-credits key issued earlier (
Authorization: Bearer a402_...) also pays it. - Every field is optional; a rejected input answers 4xx with
error,tool,expected,requiredandexample. - On this route, a call ending in any status of 400 or above is not charged over x402, MPP or a credits key. A Tempo push credential pays before the call; a failure is a refund owed.
- A
POSTwith a JSON body is served as this GET. - An
Idempotency-Keyreplays the first 200 uncharged (an answer larger than 1 MB is not replayed).
Paid call (JavaScript agent)
import { wrapFetchWithPayment } from "@x402/fetch";
import { x402Client } from "@x402/core/client";
import { registerExactEvmScheme } from "@x402/evm/exact/client";
import { privateKeyToAccount } from "viem/accounts";
const client = new x402Client();
client.setSpendControls?.({ maxAmountPerPayment: "$0.004" }); // refuse any quote above this tool's price
registerExactEvmScheme(client, { signer: privateKeyToAccount(process.env.AGENT_KEY) });
const payFetch = wrapFetchWithPayment(fetch, client);
const res = await payFetch("https://agent402.tools/api/drug-ndc?ndc=58151-155");Get a wallet or run npx -y agent402-mcp@0.17.2 wallet new.
The quote (Python)
import base64, json, urllib.error, urllib.request
req = urllib.request.Request("https://agent402.tools/api/drug-ndc?ndc=58151-155", method="GET", headers={})
try:
urllib.request.urlopen(req)
except urllib.error.HTTPError as e:
quote = json.loads(base64.b64decode(e.headers["PAYMENT-REQUIRED"]))
print(e.code, [(a["network"], a["amount"]) for a in quote["accepts"]]) # the price, per chain, in base units