Drug markets
These two endpoints size a drug’s market beyond the prescriber-level Part D data on Providers. One gives volume by state in two public programs side by side. The other gives national spending per year, with the manufacturer and the unit price trend.
Both cost 1 credit, charged only when the call succeeds. A 400 is free.
Three rules apply to both:
drugis required and must equal a brand name or a generic name, ignoring case. It is not a substring search. A generic name covers every brand of it. A name that matches nothing returns an emptyrowsand is still charged.- Query parameters the endpoint does not know are ignored.
- None of this is commercial insurance.
Get a drug’s market by state
Section titled “Get a drug’s market by state”GET /api/market/drugsReturns one row per state for one drug: Medicare Part D claims, cost and patients for 2024 next to Medicaid prescriptions and reimbursement. Costs 1 credit.
Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
drug |
string | Required. Brand or generic name, exact, 2 to 80 characters. For example Eliquis or apixaban. |
state |
string | Two-letter state code. Omit for every state. |
medicaid_year |
number | 2024 or 2025. Default 2025. The Part D columns are always 2024. |
There is no paging. At most 70 rows come back, largest combined volume first.
Example
Section titled “Example”curl "$OPH_API/api/market/drugs?drug=Eliquis&state=TX" \ -H "Authorization: Bearer $OPH_KEY"{ "rows": [ { "state": "TX", "partd_claims": "1400866", "partd_drug_cost": "1219765992", "partd_patients": "288812", "partd_claims_named_prescribers": "1330168", "medicaid_prescriptions": "51917", "medicaid_reimbursed": "28940660", "medicaid_ffs_prescriptions": "1706", "medicaid_mco_prescriptions": "50211", "medicaid_suppressed_cells": "11" } ], "sql": "WITH d AS (SELECT state, sum(total_claims) AS partd_claims, ... FROM rollup_drug_state WHERE (lower(brand_name) = lower($1) OR lower(generic_name) = lower($1)) AND ($2::text IS NULL OR state = $2) GROUP BY state), m AS (SELECT state, sum(prescriptions) AS medicaid_prescriptions, ... FROM rollup_medicaid_drug_state WHERE year = $3 AND ...) SELECT ... FROM d FULL JOIN m ON m.state = d.state ORDER BY ... LIMIT 70", "params": ["Eliquis", "TX", 2025], "sources": ["rollup_drug_state", "rollup_medicaid_drug_state"], "ms": 308, "years": { "partd": 2024, "medicaid": 2025 }, "population": { "partd": "Medicare Part D (stand-alone and Medicare Advantage drug plans), 2024. No commercial or Medicaid.", "medicaid": "Medicaid, fee-for-service plus managed care, all ages. Amounts are before manufacturer rebates. Cells under 11 prescriptions are withheld and not in the sums." }, "note": "drug matches a brand name or a generic name exactly, ignoring case; a generic name covers every brand. NULL means not published, not zero. partd_patients counts a patient once per brand.", "usage": { "credits": 1, "creditsUsed": 1664, "creditsLimit": 5000, "txid": "11175" }}Columns
Section titled “Columns”| Field | Meaning |
|---|---|
partd_claims, partd_drug_cost, partd_patients |
CMS’s own state totals over every Part D prescriber, 2024. Use these for market size. |
partd_claims_named_prescribers |
Claims summed from the prescriber-level file, which leaves out any prescriber with 10 or fewer claims of the drug. It is lower than partd_claims; the gap is the volume written by low-volume prescribers. |
medicaid_prescriptions, medicaid_reimbursed |
Medicaid prescriptions and the amount reimbursed to pharmacies in medicaid_year, fee-for-service and managed care together. |
medicaid_ffs_prescriptions, medicaid_mco_prescriptions |
The same prescriptions split by delivery system. |
medicaid_suppressed_cells |
Number of withheld Medicaid cells that are missing from the sums. |
Every figure is a sum and arrives as a JSON string. sql is the statement the server ran, as a read-only receipt. years and population repeat which year and which patients each half covers.
The Medicaid year defaults to 2025 and Part D is 2024. To compare like with like, send medicaid_year=2024, or say that the years differ.
Get a drug’s national spending by year
Section titled “Get a drug’s national spending by year”GET /api/market/drugs/spendingReturns national spending on one drug per year, 2020 to 2024, in Medicare Part D, Medicare Part B and Medicaid. Costs 1 credit.
Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
drug |
string | Required. Brand or generic name, exact, 2 to 80 characters. |
program |
string | part_d, part_b or medicaid. Omit for all three. |
manufacturers |
string | true for one row per manufacturer. Default false: one row per brand and year across all manufacturers. |
There is no paging. At most 500 rows come back, ordered by program, brand, manufacturer and year.
Example
Section titled “Example”curl "$OPH_API/api/market/drugs/spending?drug=Eliquis&program=part_d" \ -H "Authorization: Bearer $OPH_KEY"{ "rows": [ { "program": "part_d", "brand_name": "Eliquis", "generic_name": "Apixaban", "manufacturer": "Overall", "hcpcs_code": null, "year": 2024, "total_spending": "20774929225", "claims": "24061332", "patients": "4424796", "avg_spend_per_unit": 9.6370356894, "avg_spend_per_claim": 863.41559248, "unit_price_change_1y": -0.011048166, "unit_price_cagr": 0.0510230439 } ], "sql": "SELECT program, brand_name, generic_name, manufacturer, hcpcs_code, year, round(total_spending::numeric, 0) AS total_spending, ... FROM drug_spending WHERE (lower(brand_name) = lower($1) OR lower(generic_name) = lower($1)) AND ($2::text IS NULL OR program = $2) AND (program = 'part_b' OR ($3::boolean AND manufacturer <> 'Overall') OR (NOT $3::boolean AND manufacturer = 'Overall')) ORDER BY program, brand_name, manufacturer, year LIMIT 500", "params": ["Eliquis", "part_d", false], "sources": ["drug_spending"], "ms": 161, "population": "National totals per program: Medicare Part D, Medicare Part B fee-for-service, Medicaid; 2020 to 2024, before rebates. No commercial.", "note": "By default one row per brand and year across all manufacturers. manufacturers=true returns the per-manufacturer rows instead; do not add the two together.", "usage": { "credits": 1, "creditsUsed": 1665, "creditsLimit": 5000, "txid": "11177" }}The call returns five rows, 2020 to 2024. The example shows the last.
Things to know:
manufacturerisOverallon the default rows. Withmanufacturers=truetheOverallrows are replaced by one row per manufacturer. Never add the two sets together: that doubles the drug.- Part B rows are per HCPCS code and have no manufacturer. They come back the same way whatever
manufacturersis, with the code inhcpcs_code. unit_price_change_1yis the change in average spending per unit from 2023 to 2024, as a fraction:-0.011is a fall of 1.1%.unit_price_cagris the yearly growth rate from 2020 to 2024. Both are repeated on every year’s row of a drug. They do not describe that row’s year.- A drug with no spending in a year has no row for that year.
patientsisnullfor Medicaid, which publishes no patient counts.total_spending,claimsandpatientsarrive as JSON strings.
Caveats
Section titled “Caveats”Three populations, none of them commercial
Section titled “Three populations, none of them commercial”| Columns | Population | Period |
|---|---|---|
partd_* and program part_d |
Medicare Part D: stand-alone drug plans and Medicare Advantage drug plans together | By state: 2024. Spending: 2020 to 2024. |
program part_b |
Medicare Part B fee-for-service: drugs given in a clinic or outpatient department | 2020 to 2024 |
medicaid_* and program medicaid |
Medicaid, fee-for-service and managed care, all ages | By state: 2024 or 2025. Spending: 2020 to 2024. |
Commercial insurance and self-pay are in none of them. Do not add the programs together and call the sum a market total.
Amounts are before rebates
Section titled “Amounts are before rebates”Medicaid amounts are what Medicaid and other payers reimbursed pharmacies, before manufacturer rebates. Rebates are large in Medicaid. Do not read the amounts as net spending. Part D and Part B spending is gross as well.
Small cells are withheld
Section titled “Small cells are withheld”- Medicaid. A cell is one product in one state, quarter and delivery system. A cell with fewer than 11 prescriptions is suppressed. Suppressed cells are left out of the sums, and
medicaid_suppressed_cellscounts them. When every cell is suppressed the figures arenull, not zero. - Part D. The state totals are
nullwhere CMS suppressed the cell.partd_claims_named_prescribersisnullwhere no prescriber in the state reached 11 claims.
null means not published. It never means zero.
Coverage
Section titled “Coverage”- The Medicaid data covers outpatient drugs that states report for the Medicaid Drug Rebate Program, calendar years 2024 and 2025, both updated July 2026. Drugs outside that program are missing. No prescriber or pharmacy is identified.
- Medicaid drug names come from the FDA NDC Directory and are spelled like the Part D names where the drug exists there. That is 87% of prescriptions in 2025. The rest carry the FDA name in title case, or the source’s name cut to 10 characters, and match only under that spelling.
- Part D by state is the 2024 release (RY26).
partd_patientscounts a patient once per brand, so a generic name that covers several brands counts some patients more than once. - Spending by year comes from the CMS drug spending dashboards, 2024 release (RY26). It is national only: no state and no prescriber.