# NPI Search ## Overview | Property | Value | |----------|-------| | **Status** | active | | **Method** | `GET` | | **Endpoint** | `/v2/npi/search` | | **Base URL** | `https://api.piloterr.com` | | **Credit Cost** | 1 credit per call | | **Documentation** | https://www.piloterr.com/library/npi-search | ## Description Search the NPPES NPI registry by person name, organization, or 10-digit NPI. With NPI-2, a text query is the organization name. total_results is null, and next is set only when the page is full. ## Authentication - **Key Name:** `x-api-key` - **Location:** HTTP Header - **Get an API key:** https://app.piloterr.com/register ## Example Request ```bash curl --location --request GET 'https://api.piloterr.com/v2/npi/search' \ --header 'Content-Type: application/json' \ --header 'x-api-key: YOUR_API_KEY' ``` ## Example Response ### Anthony Fauci ```json { "results": [ { "npi": "1972813608", "url": "https://npiregistry.cms.hhs.gov/provider-view/1972813608", "city": "WASHINGTON", "name": "Dr. ANTHONY STEPHEN FAUCI", "phone": "301-496-2263", "state": "DC", "status": "A", "address": "3012 - 43RD STREET, N.W.", "taxonomy": "Internal Medicine, Infectious Disease", "last_name": "FAUCI", "credential": "M.D.", "first_name": "ANTHONY", "middle_name": "STEPHEN", "postal_code": "200163547", "taxonomy_code": "207RI0200X", "enumeration_date": "2010-10-15", "enumeration_type": "NPI-1", "organization_name": null } ], "pagination": { "next": null, "page": 1, "per_page": 10, "total_pages": null, "total_results": null } } ``` ## Documentation ## Overview Search the public NPPES NPI registry. Call it with a person name, an organization name, a 10-digit NPI, or a search URL on npiregistry.cms.hhs.gov. ``` GET https://api.piloterr.com/v2/npi/search?query=Anthony%20Fauci ``` Header: `x-api-key`. A text `query` is split into a first name and a last name. `Anthony Fauci` searches first name Anthony and last name Fauci. A single word, such as `Smith`, is the last name. `enumeration_type=NPI-2` treats that text as an organization name. `query=Mayo Clinic&enumeration_type=NPI-2` searches for the organization Mayo Clinic. `NPI-1` is a person. If you omit `enumeration_type`, a text query is a person name. A provider-view URL belongs on `/v2/npi/provider`. On this endpoint it returns 400. Send at least one of `query`, `first_name`, `last_name`, `organization_name`, `city`, `state`, `postal_code`, or `taxonomy`. ## Parameters `query` is optional when another criterion is set. Example: `Anthony Fauci`. A 10-digit NPI such as `1972813608` is accepted, and so is a search URL such as `https://npiregistry.cms.hhs.gov/search?last_name=Fauci&state=DC`. With `enumeration_type=NPI-2`, the text is the organization name. `first_name` is optional. Example: `Anthony`. `last_name` is optional. Example: `Fauci`. `organization_name` is optional. Example: `Mayo Clinic`. `city` is optional. Example: `Washington`. `state` is optional. It must be two letters. Example: `DC`. `postal_code` is optional. Example: `20016`. `taxonomy` is optional. It is matched to the taxonomy description. Example: `Internal Medicine`. `enumeration_type` is optional. Use `NPI-1` or `NPI-2`. Example: `NPI-2`. `page` is optional and defaults to 1. Example: `2`. `limit` is optional, defaults to 10, and cannot exceed 200. Example: `10`. ## Response fields Each item in `results` is one provider card. `npi` is the 10-digit number. `url` points at the provider-view page. `name` is the display name. For a person it can include the prefix, for example `Dr. ANTHONY STEPHEN FAUCI`. For an organization, `name` and `organization_name` are the organization, and `first_name`, `middle_name`, `last_name`, and `credential` are null. `enumeration_type` is `NPI-1` or `NPI-2`. `status` is the registry status, often `A`. `taxonomy` and `taxonomy_code` come from the primary taxonomy. `address`, `city`, `state`, `postal_code`, and `phone` come from the location address. `enumeration_date` is `YYYY-MM-DD`. ## Pagination The registry does not publish a count. `pagination.total_results` and `pagination.total_pages` are null on every page. `pagination.page` starts at 1. `pagination.per_page` is the `limit` you sent, or 10. `pagination.next` is a URL only when the page is full, which means the row count equals `per_page`. A short page has `next` set to null. That includes the last page when it does not fill the limit. `Anthony Fauci` returns one row, so `next` is null. `Mayo Clinic` with `enumeration_type=NPI-2` and `limit=10` fills the page, so `next` is a URL. The next page of that search returned 4 rows and `next` was null. NPI values on one page do not repeat. Page 2 does not repeat page 1. Pass `page=2`, or open `pagination.next` and read its `page` parameter. ## Use cases - A credentialing team pages every NPI-2 record for Mayo Clinic until `next` is null, then opens each `npi` on the provider endpoint. - A health-plan directory lists Internal Medicine practices in DC with `taxonomy=Internal Medicine` and `state=DC`. - A staffing desk checks that a 10-digit NPI such as `1972813608` still resolves before it books a shift. ## Error codes - 400: no criterion, a state that is not two letters, a bad `enumeration_type`, `page` below 1, `limit` outside 1 to 200, or a provider-view URL sent to search. - 404: the registry returned no rows. - 401: missing API key.