# /dailymed/labels/search

`POST /api/dailymed/labels/search`

Price: 20 credits

Search DailyMed drug labels by name, labeler, code or publication date

## How to use it

Finds SPL set ids to feed the label, packaging, history and image endpoints. Every filter is an exact code or name lookup, not free text: `drug_name` matches a catalogued brand or generic name and `label_title` matches the catalogue title, so a phrase like 'blood pressure tablets' returns nothing — start from an ingredient, an NDC, an RxCUI, a UNII or an FDA application number instead. The application number needs its prefix (NDA020702, not 020702). `name_type` only narrows `drug_name`. Results carry the set id, title, version and publication date; the label content itself needs the label endpoint.

## Parameters

- `access-token` (string, required)

## Request body

- `timeout` (integer) — Max scrapping execution timeout (in seconds) (default: 300; min: 20; max: 1500)
- `drug_name` (string, nullable) — Drug name, brand or generic (examples: "atorvastatin", "Dupixent")
- `name_type` (string, nullable) — Restricts drug_name to brand names or to generic names. Requires drug_name (one of: "generic", "brand")
- `label_title` (string, nullable) — Substring of the label title (examples: "LIPITOR")
- `labeler` (string, nullable) — Labeler organisation name (examples: "Teva Pharmaceuticals USA, Inc.")
- `ndc` (string, nullable) — NDC product or package code (examples: "0093-5056")
- `rxcui` (string, nullable) — RxNorm concept id (examples: "617314")
- `unii_code` (string, nullable) — UNII code of an active ingredient (examples: "A0JWA85V8F")
- `application_number` (string, nullable) — FDA application number, with its NDA/ANDA/BLA prefix (examples: "NDA020702")
- `marketing_category_code` (string, nullable) — SPL marketing category code (examples: "C73594", "C73584")
- `dea_schedule_code` (string, nullable) — DEA schedule of a controlled substance, as its SPL code: C48672 is schedule CI, C48675 CII, C48676 CIII, C48677 CIV, C48679 CV. The schedule name ('CII') is accepted and resolved to the code (one of: "C48672", "C48675", "C48676", "C48677", "C48679"; examples: "C48675", "CII")
- `drug_class_code` (string, nullable) — Pharmacologic class code from DailyMed's drug class list (examples: "N0000175836")
- `drug_class_system` (string) — Coding system the drug_class_code belongs to. EPC and MoA classes are ndfrt; PE and Chemical/Ingredient classes are nci_thesaurus (default: "ndfrt"; one of: "ndfrt", "nci_thesaurus")
- `doctype` (string, nullable) — LOINC document type code of the label (examples: "34391-3", "34390-5")
- `setid` (string, nullable) — SPL set id (examples: "595f437d-2729-40bb-9c62-c8ece1f82780")
- `published_date` (string, nullable) — Publication date, YYYY-MM-DD (examples: "2025-01-01")
- `published_date_comparison` (string) — How published_date is compared. Applies only when published_date is set (default: "eq"; one of: "eq", "lt", "lte", "gt", "gte")
- `count` (integer, required) — Number of labels to return (min: 1; max: 5000)

## Response

### 200 — Successful Response

- `@type` (string) (default: "DailymedLabelSummary")
- `setid` (string, required)
- `label_title` (string, nullable)
- `version` (integer, nullable)
- `published_at` (integer, nullable)
- `web_url` (string) (default: "")

## Errors

### 422 — Validation Error

The request body did not validate

What to do: Check the fields against this schema. A URN with the wrong prefix is the most common cause.

- `detail` (array)
  - `loc` (array, required)
  - `msg` (string, required)
  - `type` (string, required)
  - `input` (any)
  - `ctx` (object)

### 408

The request ran past its time limit

What to do: Raise `timeout` in the request body, up to the maximum this endpoint documents. Lowering `count` or turning off the `with_*` flags also helps, because less work finishes sooner.

### 412

The entity was not found, or a precondition failed

What to do: Retrying will not help: either the entity does not exist, or the input points at a different one.

### 429

Too many requests: a rate limit or a usage window is exhausted

What to do: When the response carries an X-Retry-After header, wait that many seconds and retry: the same number is in the body as `detail.retry_after`, and the limit clears once that window passes. The message in the body names the limit that was hit.

### 500

Something broke on our side

What to do: Retrying will not help. If it keeps happening, send us the X-Request-ID from the response headers.

### 529

Rate limit reached, or the endpoint is overloaded

What to do: Wait at least 30 seconds, then retry.

## Response envelope

Success: Array of objects (may be empty if no results)

Error: Error may coexist with partial results if it occurs mid-execution. Check X-Error header and status code.

Every response carries these headers:

- `X-Error` — Error message text (present only on error)
- `X-Request-ID` — Unique request identifier
- `X-Execution-Time` — Execution time in seconds
- `X-Result-Count` — How many records the body carries. 0 means an empty result, which is a normal answer and not by itself an error. A non-zero count can come back together with X-Error when the failure happened partway through — read this header and X-Error independently.
- `X-Total-Available-Results` — How many records exist for this query, when the endpoint can say. On a `dry_run` request this is the answer and the body is empty. It saturates: the endpoint's documented maximum means 'at least that many', any smaller number is exact.
- `X-Warning` — Present when the request body carried keys this endpoint does not document. They were ignored, so any filter you meant to apply through them did not apply. Check the spelling against this schema and retry.
- `X-Retry-After` — Seconds to wait before retrying. Present only on 429.

