Docs · Validators
npi validator
US National Provider Identifier — 10 digits, Luhn check on `80840` prefix.
Reference
Format
Matches `/^\d{10}$/`, then runs the CMS-specified Luhn check: compute Luhn on `"80840" + value.slice(0, 9)`, then the trailing digit of `value` must be the Luhn check digit.
Examples
- 1234567893
- 1003000126
- 1467560003
How it runs
Implementation
Faithful summary of lib/validators.ts. Validators are pure functions and run identically in the worker, the Workbench, and the MCP server.
function validNpi(value) {
if (!/^\d{10}$/.test(value)) return fail('npi_format', 'expected 10 digits')
const target = ('80840' + value.slice(0, 9)).split('').map(Number)
let sum = 0
for (let i = target.length - 1; i >= 0; i--) {
let d = target[i]
if ((target.length - i) % 2 === 1) { d *= 2; if (d > 9) d -= 9 }
sum += d
}
return (sum + Number(value[9])) % 10 === 0
? OK
: fail('npi_checksum', 'NPI Luhn check failed')
}Config
Use in a template
Validators attach to a field on a custom template. The cascade runs them after mapping but before commit; failures surface in the per-row validation report.
fields:
- column: npi
type: string
validators:
- type: npiWatch out
Common gotchas
- The `80840` prefix is per CMS NPI specification — do NOT pass an 80840-prefixed string in; pass the bare 10-digit NPI.
- Type 1 (individual) and Type 2 (organisation) NPIs use the same checksum — we do not infer or check the entity type.
- NPPES registry lookup is not performed. A syntactically valid NPI may be deactivated.
Catalogue
Related templates
- Provider directory
provider_directory_v1Providers with NPI/GLN/license metadata.
Fields:
npi
Pricing
Validators run on every committed row
Validators add no AI cost — they are pure functions. Every map bills a small flat per-map fee from your prepaid token wallet ($10 minimum, shared across our suite); only columns that reach the metered LLM layer, plus any-to-any convert and reshape, bill real AI tokens. See pricing →
Explore
Other validators
Back to the documentation index or browse the template catalogue.
Ready when you are
Validate every row — before it lands.
Attach checksum-strict validators to any field, and gate risky commits with the requires_hitl flag. One key runs the whole cascade.