API reference
NPI lookup
POST /npi checks a National Provider Identifier's check digit and reads its NPPES record: name, credential, specialty, license, addresses and status, or searches by name.
https://api.qelka.com/v1/npiLook up a National Provider Identifier (NPI), the 10-digit number every US health care provider uses on claims, or find one from a provider's name: you get the record the provider filed with NPPES, the national registry run by the Centers for Medicare & Medicaid Services (CMS), with name, credential, specialties, licenses, practice and mailing addresses, and status. Each lookup costs 1 credit, found or not; errors and test keys are never billed.
Request
Send either npi or name, never both.
npistringnamestringLast, First, or an organization. Up to 10 matches are returned, best first, and the full record of the best one.statestringname.provider_typestringDefault anyindividual searches NPI-1 records (people), organization searches NPI-2 records (organizations, groups, facilities), any searches both.freshbooleanDefault falsetrue skips the 7-day result cache and asks NPPES again.A body with both npi and name, with neither, or with state but no name is a 400 invalid_request. The call waits for the NPPES API, so every snippet sets a 30-second client timeout.
curl https://api.qelka.com/v1/npi \
--max-time 30 \
-H "Authorization: Bearer $QELKA_API_KEY" \
-H "Content-Type: application/json" \
-d '{"npi": "1003000126"}'
const response = await fetch('https://api.qelka.com/v1/npi', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.QELKA_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({ npi: '1003000126' }),
signal: AbortSignal.timeout(30_000),
})
const result = await response.json()
console.log(result)
import os
import requests
api_key = os.environ["QELKA_API_KEY"]
response = requests.post(
"https://api.qelka.com/v1/npi",
headers={"Authorization": f"Bearer {api_key}"},
json={"npi": "1003000126"},
timeout=30,
)
result = response.json()
print(result)
<?php
$ch = curl_init('https://api.qelka.com/v1/npi');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('QELKA_API_KEY'),
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode(['npi' => '1003000126']),
CURLOPT_TIMEOUT => 30,
]);
$result = json_decode(curl_exec($ch), true);
print_r($result);
package main
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
"os"
"time"
)
func main() {
payload, _ := json.Marshal(map[string]any{"npi": "1003000126"})
request, _ := http.NewRequest(http.MethodPost, "https://api.qelka.com/v1/npi", bytes.NewReader(payload))
request.Header.Set("Authorization", "Bearer "+os.Getenv("QELKA_API_KEY"))
request.Header.Set("Content-Type", "application/json")
client := &http.Client{Timeout: 30 * time.Second}
response, err := client.Do(request)
if err != nil {
panic(err)
}
defer response.Body.Close()
var result map[string]any
if err := json.NewDecoder(response.Body).Decode(&result); err != nil {
panic(err)
}
fmt.Println(result)
}
require 'json'
require 'net/http'
uri = URI('https://api.qelka.com/v1/npi')
request = Net::HTTP::Post.new(uri)
request['Authorization'] = "Bearer #{ENV.fetch('QELKA_API_KEY')}"
request['Content-Type'] = 'application/json'
request.body = JSON.generate({ npi: '1003000126' })
response = Net::HTTP.start(uri.host, uri.port, use_ssl: true, read_timeout: 30) do |http|
http.request(request)
end
result = JSON.parse(response.body)
puts result
Response
Every lookup gets a 200, found or not. Read status first: found, not_found or invalid.
idstringlkp_ followed by 26 characters.objectstringnpi.inputstringnpi or name you sent, without surrounding spaces.querystringnpi or name: how the lookup was made.validboolean or nulltrue when the NPI has 10 digits, starts with 1 or 2 and has a correct check digit, false when it does not. null for a name search.statusstringfound, not_found or invalid.reasonstring or nullinvalid_format, invalid_check_digit, not_in_nppes or no_match. null when one is found.providerobject or nullprovider.npistringprovider.typestringindividual for an NPI-1 (a person), organization for an NPI-2.provider.namestringprovider.first_namestring or nullprovider.middle_namestring or nullprovider.last_namestring or nullprovider.credentialstring or nullM.D. or RN. Individuals only.provider.organization_namestring or nullprovider.sole_proprietorboolean or nullnull for organizations or when not reported.provider.statusstringactive or deactivated. The NPPES API only publishes active NPIs, so a deactivated NPI is answered not_found.provider.enumeration_datestring or nullYYYY-MM-DD.provider.last_updatedstring or nullYYYY-MM-DD.provider.certification_datestring or nullYYYY-MM-DD.provider.primary_taxonomyobject or nullprovider.taxonomies.provider.taxonomiesarray of objectsprovider.taxonomies.codestring207R00000X.provider.taxonomies.descriptionstring or nullInternal Medicine.provider.taxonomies.primarybooleantrue for the primary specialty.provider.taxonomies.statestring or nullprovider.taxonomies.licensestring or nullprovider.location_addressobject or nullprovider.location_address.linesarray of stringsprovider.location_address.citystring or nullprovider.location_address.statestring or nullprovider.location_address.postal_codestring or null12345-6789 when NPPES has nine digits.provider.location_address.countrystring or nullprovider.location_address.phonestring or nullprovider.location_address.faxstring or nullprovider.mailing_addressobject or nulllocation_address.provider.practice_locationsintegerprovider.other_namesarray of objectsprovider.other_names.typestring or nullprovider.other_names.namestringprovider.authorized_officialobject or nullprovider.authorized_official.namestringprovider.authorized_official.titlestring or nullmatchesarray of objects or nullnull for a lookup by NPI.matches.npistringmatches.typestringindividual or organization.matches.namestringmatches.credentialstring or nullmatches.primary_taxonomystring or nullmatches.citystring or nullmatches.statestring or nullcredits_usedinteger0 with a test key.cachedbooleantrue when the answer came from the 7-day cache.The provider in this example reported five taxonomy and license pairs; two are shown.
{
"id": "lkp_01M8CFQ9KB0CNKCG2MQB3RDZ6N",
"object": "npi",
"input": "1003000126",
"query": "npi",
"valid": true,
"status": "found",
"reason": null,
"provider": {
"npi": "1003000126",
"type": "individual",
"name": "ARDALAN ENKESHAFI, M.D.",
"first_name": "ARDALAN",
"middle_name": null,
"last_name": "ENKESHAFI",
"credential": "M.D.",
"organization_name": null,
"sole_proprietor": false,
"status": "active",
"enumeration_date": "2007-08-31",
"last_updated": "2026-11-17",
"certification_date": "2026-11-17",
"primary_taxonomy": {
"code": "208M00000X",
"description": "Hospitalist",
"primary": true,
"state": "DC",
"license": "MD600003480"
},
"taxonomies": [
{
"code": "208M00000X",
"description": "Hospitalist",
"primary": true,
"state": "DC",
"license": "MD600003480"
},
{
"code": "207R00000X",
"description": "Internal Medicine",
"primary": false,
"state": "VA",
"license": "0101254037"
}
],
"location_address": {
"lines": ["6410 ROCKLEDGE DR STE 304"],
"city": "BETHESDA",
"state": "MD",
"postal_code": "20817-1841",
"country": "US",
"phone": "443-602-6207",
"fax": null
},
"mailing_address": {
"lines": ["601 MEMORY LN"],
"city": "YORK",
"state": "PA",
"postal_code": "17402-2231",
"country": "US",
"phone": "717-851-1405",
"fax": "717-851-6969"
},
"practice_locations": 4,
"other_names": [],
"authorized_official": null
},
"matches": null,
"credits_used": 1,
"cached": false
}
Act on the status
status |
reason |
What it means | What to do |
|---|---|---|---|
found |
null |
NPPES has a record for the NPI, or for the best match of the name. | Compare provider.name, provider.type and the licenses in provider.taxonomies with what the provider told you. After a name search, confirm that the record is the provider you meant: the other candidates are in matches. |
invalid |
invalid_format |
The value is not 10 digits once spaces and dashes are removed. NPPES is not called. | Ask for the NPI again. |
invalid |
invalid_check_digit |
The NPI has 10 digits but does not start with 1 or 2, or its last digit does not match the others. NPPES is not called. | Ask the provider to check each digit: it is usually a typo. |
not_found |
not_in_nppes |
The NPI is well formed but NPPES has no active record of it: it was never assigned, or it was deactivated. | Ask for the NPI again, or search by name. |
not_found |
no_match |
No provider matches the name, in the state when you sent one. matches is empty. |
Try the legal name as registered, without the credential, or drop state. |
Every status is billed 1 credit, because the lookup ran. Answers with status: "invalid" are never cached.
Test keys never call NPPES. They know two fictional providers: NPI 1234567893, JANE SAMPLE, M.D., an internal medicine physician in Springfield, IL, and NPI 1245319599, SAMPLE HEALTH CLINIC, an organization. A name search finds them when every word you send starts a word of their name, any other well-formed NPI is not_found with not_in_nppes, and NPIs with a wrong check digit are still invalid.
How the check digit works
An NPI is nine digits followed by a check digit. Put 80840 in front of the first nine digits, the prefix ISO 7812 gives to US health care identifiers, and compute the Luhn check digit of those 14 digits: it must equal the tenth digit of the NPI. NPIs also start with 1 or 2. A single mistyped digit always fails the check, so the API catches it before any call to NPPES.
How the name search works
A name with a comma is read as Last, First. Otherwise the first word is the first name and the last word the last name; a single word is a last name. An organization name matches the start of registered names, so a short name also finds the longer names that begin with it. With provider_type: "any", people and organizations are both searched, and a name with words such as Clinic, Hospital, Pharmacy or LLC searches organizations first. Candidates are ranked by how close their name is to the one you sent.
What the API keeps
The request log keeps the NPI with its middle digits hidden (100***26), or the first letter of a searched name, never the full name or the state.
Where the data comes from
Records come from the NPPES NPI Registry API of CMS, queried at request time. NPPES data is published by the U.S. Department of Health and Human Services for public use; works of the U.S. Government are in the public domain. Specialty descriptions are the ones NPPES returns for each taxonomy code. See the data sources page.
Search by name
Send name, and state to narrow the search. The best candidate's full record comes back, and every candidate is in matches, best first. With a test key in QELKA_API_KEY, this request returns:
curl https://api.qelka.com/v1/npi \
--max-time 30 \
-H "Authorization: Bearer $QELKA_API_KEY" \
-H "Content-Type: application/json" \
-d '{"name": "Jane Sample", "state": "IL"}'
const response = await fetch('https://api.qelka.com/v1/npi', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.QELKA_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({ name: 'Jane Sample', state: 'IL' }),
signal: AbortSignal.timeout(30_000),
})
const result = await response.json()
console.log(result)
import os
import requests
api_key = os.environ["QELKA_API_KEY"]
response = requests.post(
"https://api.qelka.com/v1/npi",
headers={"Authorization": f"Bearer {api_key}"},
json={"name": "Jane Sample", "state": "IL"},
timeout=30,
)
result = response.json()
print(result)
{
"id": "lkp_01M8CGA3WQ4T7N2B9XKD5RZ1HE",
"object": "npi",
"input": "Jane Sample",
"query": "name",
"valid": null,
"status": "found",
"reason": null,
"provider": {
"npi": "1234567893",
"type": "individual",
"name": "JANE SAMPLE, M.D.",
"first_name": "JANE",
"middle_name": null,
"last_name": "SAMPLE",
"credential": "M.D.",
"organization_name": null,
"sole_proprietor": false,
"status": "active",
"enumeration_date": "2010-05-12",
"last_updated": "2025-03-04",
"certification_date": "2025-03-04",
"primary_taxonomy": {
"code": "207R00000X",
"description": "Internal Medicine",
"primary": true,
"state": "IL",
"license": "TEST-0001"
},
"taxonomies": [
{
"code": "207R00000X",
"description": "Internal Medicine",
"primary": true,
"state": "IL",
"license": "TEST-0001"
}
],
"location_address": {
"lines": ["100 TEST AVENUE"],
"city": "SPRINGFIELD",
"state": "IL",
"postal_code": "62701-0000",
"country": "US",
"phone": "555-010-0100",
"fax": null
},
"mailing_address": {
"lines": ["PO BOX 100"],
"city": "SPRINGFIELD",
"state": "IL",
"postal_code": "62701",
"country": "US",
"phone": null,
"fax": null
},
"practice_locations": 0,
"other_names": [],
"authorized_official": null
},
"matches": [
{
"npi": "1234567893",
"type": "individual",
"name": "JANE SAMPLE",
"credential": "M.D.",
"primary_taxonomy": "Internal Medicine",
"city": "SPRINGFIELD",
"state": "IL"
}
],
"credits_used": 0,
"cached": false
}
Catch a mistyped NPI
The last digit is wrong, so the check digit fails and NPPES is not called. The answer is billed, because the check ran.
curl https://api.qelka.com/v1/npi \
--max-time 30 \
-H "Authorization: Bearer $QELKA_API_KEY" \
-H "Content-Type: application/json" \
-d '{"npi": "1234567890"}'
const response = await fetch('https://api.qelka.com/v1/npi', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.QELKA_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({ npi: '1234567890' }),
signal: AbortSignal.timeout(30_000),
})
const result = await response.json()
console.log(result)
import os
import requests
api_key = os.environ["QELKA_API_KEY"]
response = requests.post(
"https://api.qelka.com/v1/npi",
headers={"Authorization": f"Bearer {api_key}"},
json={"npi": "1234567890"},
timeout=30,
)
result = response.json()
print(result)
{
"id": "lkp_01M8CGA4E8YV6P0M3JQF2SN7TB",
"object": "npi",
"input": "1234567890",
"query": "npi",
"valid": false,
"status": "invalid",
"reason": "invalid_check_digit",
"provider": null,
"matches": null,
"credits_used": 1,
"cached": false
}
Errors
| Status | Type | When |
|---|---|---|
| 400 | invalid_request | Both or neither of npi and name, state without name, npi empty or longer than 20 characters, name shorter than 2 or longer than 120 characters, state not two letters, provider_type not any, individual or organization, a body that is not a JSON object, or a field the request table does not list |
| 401 | invalid_api_key | The key is missing, unknown or revoked |
| 402 | insufficient_credits | Your balance is less than 1 credit (live keys only) |
| 403 | forbidden | The key is restricted to other endpoints |
| 405 | invalid_request | The method is not POST |
| 422 | unprocessable_input | The name has no word of two letters or more |
| 429 | rate_limited | Too many requests: wait Retry-After seconds |
| 500 | internal_error | Unexpected error on our side: retry with backoff |
| 502 | upstream_unavailable | The NPPES API could not be reached, answered with an error or did not answer within 8 seconds: retry later |
No error is billed. An NPI that NPPES does not know is not an error: it is a 200 with status: "not_found".
Related
- NPI registry API
- Free tools: NPI lookup, NPI registry search
- OIG exclusion screening: check the same NPI against the HHS exclusion list
- Batch: up to 100 lookups in one call, each item with
type: "npi" - Bulk: a whole file of NPIs or names with
type=npi - Caching, Errors, Test mode