Skip to content
healthcare.dev

Build NPI verification for provider onboarding

Telehealth platforms, referral networks and credentialing tools need to know an NPI is real, active and belongs to the person signing up. One call answers the first two; the record answers the rest.
Data
NPI
Endpoints
/v1/providers/{npi}/validate
/v1/providers/{npi}
MCP tools
validate_npi, lookup_provider
Plan
Runs on the Free plan

How it works

  1. Validate the NPI: format, check digit, whether CMS issued it and its status.
  2. If it's active, fetch the record and compare the name to what the user entered.
  3. Show the primary taxonomy (specialty) and license state for review.

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, isValidNpi } from "@healthcare.dev/sdk";

const hdev = new HealthcareDev();

export async function verifyProvider(npi: string, lastName: string) {
  if (!isValidNpi(npi)) return { ok: false, reason: "check digit doesn't match" }; // offline
  const { data: v } = await hdev.providers.validate(npi);
  if (!v.exists) return { ok: false, reason: "CMS hasn't issued this NPI" };
  if (v.status !== "active") return { ok: false, reason: "NPI is deactivated" };

  const { data: p } = await hdev.providers.get(npi);
  const primary = p.taxonomies.find((t) => t.primary);
  return {
    ok: p.name.last?.toLowerCase() === lastName.toLowerCase(),
    name: p.name.display,
    specialty: primary?.display,
    licenseState: primary?.license_state,
  };
}

Or ask your agent

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

Prompt
Is NPI 1245319599 valid and active? Who is it registered to and what's their specialty?

Take it further

  • Search by name, state and taxonomy with GET /v1/providers to build a directory.
  • Re-validate stored NPIs monthly to catch deactivations.
  • Look up taxonomy codes with /v1/taxonomies to filter by specialty.

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

More examples