Skip to content
healthcare.dev

Build a drug price lookup with NADAC pharmacy costs

Price transparency apps, benefit tools and pharmacy software use NADAC as a public benchmark for what a drug actually costs a pharmacy, updated weekly by CMS.
Data
NDC
Endpoints
/v1/drugs/nadac
/v1/drugs/nadac/{ndc}
MCP tools
get_drug_price, search_drugs
Plan
Runs on the Free plan

How it works

  1. Search NADAC by drug name to list the packages and their current per-unit cost.
  2. Fetch one NDC for its price history to chart the trend.
  3. Multiply by quantity to estimate the pharmacy's cost for a fill.

The code

TypeScript with @healthcare.dev/sdk. Set HDEV_API_KEY to a free key and run it. Every response carries its source, release and license in meta.

TypeScript
import { HealthcareDev } from "@healthcare.dev/sdk";

const hdev = new HealthcareDev();

export async function priceOptions(name: string, quantity: number) {
  const { data } = await hdev.drugs.searchNadac({ q: name, limit: 10 });
  return data
    .map((p) => ({
      ndc: p.ndc,
      drug: p.ndc_description,
      type: p.classification_for_rate_setting, // brand or generic
      perUnit: Number(p.nadac_per_unit),
      unit: p.pricing_unit,
      estimate: Number(p.nadac_per_unit) * quantity,
      asOf: p.as_of_date,
    }))
    .sort((a, b) => a.estimate - b.estimate);
}

await priceOptions("atorvastatin 20 mg", 30);

Or ask your agent

Connect the MCP server and ask in plain language. It calls get_drug_price, search_drugs and cites what it found.

Prompt
What does a pharmacy pay for 30 tablets of atorvastatin 20 mg, by NADAC? Cheapest first.

Take it further

  • Pair with RxNorm to group every package of the same drug.
  • Use the Medicare ASP data for physician-administered (Part B) drugs.
  • Chart /v1/drugs/nadac/{ndc} history to show price changes over time.

Reference data only, not medical advice or a coverage determination. Send codes, NDCs and NPIs, never patient information.

More examples