---
title: "Search CMS drug spending"
method: GET
path: "/v1/sources/cms-drug-spending/search"
tags: ["CMS drug spending"]
---

# Search CMS drug spending

`GET /v1/sources/cms-drug-spending/search`

## Request

- Base URL: `https://api.assyro.com`
- URL: `https://api.assyro.com/v1/sources/cms-drug-spending/search`
- Auth: none declared

Search US CMS drug spending data, from Assyro's copies of CMS's published files: part-d (Medicare Part D Spending by Drug: per brand and generic name, "Overall" across manufacturers and per manufacturer, five years of Tot_Spndng, Tot_Dsg_Unts, Tot_Clms, Tot_Benes, Avg_Spnd_Per_Dsg_Unt_Wghtd, Avg_Spnd_Per_Clm, Avg_Spnd_Per_Bene, Outlier_Flag, plus Chg_ and CAGR_ growth in spending per unit), part-b (Medicare Part B Spending by Drug: per HCPCS code with brand and generic names, the same five-year metrics as Avg_Spndng_*, and Avg_DY24_ASP_Price-style ASP payment price), nadac (the latest weekly NADAC: what retail pharmacies pay to acquire each NDC, nadac_per_unit per pricing_unit). Omit dataset to search all three. Find by brand ("Eliquis"), generic ("apixaban"), manufacturer (Part D), HCPCS code (Part B, "J9271"), NDC (NADAC, 11 digits) or words. Records carry CMS's column names and values exactly as published: quote them with their column name and year, and say Medicare spending is gross, before manufacturer rebates. Never compute a price, total or change CMS did not publish (no dividing spending by claims yourself). Medicaid spending, commercial prices and list prices (WAC) are not here. A dataset that is not loaded is reported as not searched: never read that as "no Medicare spending". Call read_cms_drug_spending for every year of one row.

## Query parameters

- `dataset` 'part-d' | 'part-b' | 'nadac': Search one dataset only. Omit for all three.
- `query` string: Words that must all appear in the brand, generic, manufacturer, HCPCS description or NDC description, e.g. "apixaban 5 mg".
- `brand` string: Brand name, substring match, e.g. "Humira" (in NADAC, matched against the NDC description).
- `generic` string: Generic name, substring match, e.g. "adalimumab" (in NADAC, matched against the NDC description).
- `manufacturer` string: Part D manufacturer, substring match (CMS cuts names to 15 characters), e.g. "AbbVie". Returns manufacturer rows, not "Overall".
- `manufacturers` boolean: Part D: true to return the per-manufacturer rows as well as "Overall". Default false (Overall rows only, so a drug is not counted twice).
- `hcpcs` string: Part B HCPCS code, exact, e.g. "J9271".
- `ndc` string: NADAC NDC, 11 digits; dashes ignored ("00003-0894-21").
- `year` string: The data year whose columns the records show (Part D and Part B), e.g. "2023". Default: the latest year in CMS's file.
- `sort` 'relevance' | 'spending' | 'name': relevance (default: exact name matches first), spending (CMS's Tot_Spndng for the year, highest first; Part D and Part B) or name.
- `limit` integer: Records to return, default 8. total reports every match.
- `offset` integer: Skip this many results (for paging), default 0.

## Response `200`

Matching records.

- SearchResponse
  - `version` unknown, required
  - `source` SourceRef, required
    - `id` string, required
    - `label` string, required
    - `authority` string, required
  - `total` integer, nullable, required: Total matches the source reports, when it says.
  - `records` Record[], required
    - `id` string, required: The source's own identifier for the record.
    - `title` string, required
    - `url` string, required: The record's page at the source, to verify it.
    - `authority` string, required: Who published the record.
    - `snippet` string, nullable, required: The part of the record that matched; null where the licence allows only a link.
    - `publishedDate` string, nullable, required
    - `version` string, nullable, required: The edition or revision read.
    - `fields` object, nullable, required: The source's own fields; null where the licence allows only a link.
    - `asOf` string, nullable, required: The day Assyro's copy of the source was read (YYYY-MM-DD).
    - `attribution` string: The attribution the source's licence requires, on sources that require one.
  - `note` string
  - `summary` string[]

## Other responses

- `400`: The request is not valid: an unknown parameter or an argument the source refuses.
- `404`: No such source or record.
- `429`: Rate limited; retry after the Retry-After header.
- `503`: The source cannot answer from Assyro's copy right now.

---

[API](https://skmtc.dev/assyro/apis/assyro-public-data-api.md) - [All operations](https://skmtc.dev/assyro/apis/assyro-public-data-api/llms.txt) - [OpenAPI document](https://skmtc.dev/assyro/apis/assyro-public-data-api/revisions/c861290c9f47?raw)
