# NPI Registry Scraper: US Healthcare Providers (`winterlock/npi-registry-scraper`) Actor

Look up US doctors, clinics and hospitals in the official NPPES NPI Registry by number, name, speciality or location. Flattens addresses, taxonomies and licences into clean columns. No key, no login, no scraping.

- **URL**: https://apify.com/winterlock/npi-registry-scraper.md
- **Developed by:** [Alex Burton](https://apify.com/winterlock) (community)
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$10.00 / 1,000 provider records

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## NPI Registry Scraper: US Healthcare Providers

Look up any US doctor, clinic, hospital, pharmacy or lab in the official NPPES NPI Registry — the national directory every American healthcare provider is required to be listed in. Search by name, speciality or location, or resolve a list of NPI numbers.

Two modes:

| Mode | What you get |
|---|---|
| **Search the registry** | Every provider matching a name, speciality, city, state or ZIP, with addresses, licences and specialities flattened into columns |
| **Look up NPI numbers** | Full records for a list of ten-digit NPI numbers |

### Why use this one

- **Official API only.** This reads `npiregistry.cms.hhs.gov/api/`, the endpoint CMS publishes for exactly this purpose. No HTML parsing, no key, no login, and nothing that breaks when the website is redesigned.
- **The nested arrays are flattened for you.** NPPES buries the practice address, mailing address, primary speciality and state licence inside three separate arrays. This Actor lifts them into plain columns like `practiceCity`, `primaryTaxonomy` and `licenseNumber`, while keeping the full arrays if you need them.
- **It tells you when a query is rejected.** NPPES refuses searches it considers too broad and replies with an error object instead of results. Most scrapers report that as "0 results". Here the run stops and shows the API's own message as its status, so you know to add a city or a speciality rather than assuming nobody matched.
- **Check-digit validation.** NPI numbers carry a Luhn check digit. A mistyped number is flagged in the log before the request goes out.

### How to use it

1. Choose **What to do**.
2. For a search, fill in at least one of **Last name**, **Organization name**, **City**, **Postal code** or **Speciality**. NPPES will not accept a state on its own.
3. Click **Start**, then download results as JSON, CSV, Excel or HTML, or fetch them through the Apify API.

#### Example input: pediatricians in Wichita

```json
{
  "mode": "search",
  "providerType": "individual",
  "taxonomyDescription": "Pediatrics",
  "city": "Wichita",
  "state": "KS",
  "maxResults": 200
}
```

#### Example input: resolve a batch of NPI numbers

```json
{
  "mode": "lookup",
  "npiNumbers": ["1073554416", "1013973775"]
}
```

### Output

Every item has `type: "provider"`. The dataset has ready-made **Providers** and **Full detail** table views.

```json
{
  "type": "provider",
  "npi": "1073554416",
  "enumerationType": "NPI-1",
  "isOrganization": false,
  "name": "JANE A SMITH",
  "credential": "M.D.",
  "sex": "F",
  "status": "A",
  "primaryTaxonomyCode": "208000000X",
  "primaryTaxonomy": "Pediatrics",
  "licenseNumber": "04-12345",
  "licenseState": "KS",
  "practiceAddress": "1010 N MAIN ST, WICHITA, KS, 672031234",
  "practiceCity": "WICHITA",
  "practiceState": "KS",
  "practicePhone": "3165551212",
  "enumerationDate": "2006-05-23",
  "lastUpdated": "2024-02-11",
  "url": "https://npiregistry.cms.hhs.gov/provider-view/1073554416"
}
```

Organization records fill `organizationName`, `authorizedOfficialName` and `authorizedOfficialTitle` instead of the personal name fields.

### Pricing

Pay only for results:

| Result | Price |
|---|---|
| Provider record | $10.00 per 1,000 |

Set a maximum spend per run in the run options and the Actor stops cleanly when it's reached.

### Limits to know about

These come from NPPES, not from this Actor:

- **1,200 records per query.** The API returns at most 200 per page and refuses to skip past 1,000. To cover a whole state, split the search by city, ZIP prefix or speciality.
- **A state alone is not a valid search.** NPPES answers `Field state requires additional search criteria`. Pair it with a city, name, ZIP or speciality.
- **Wildcards need at least two characters** before the `*`, and only work at the end of a value.
- **The registry updates weekly**, so a very recent enumeration or address change may not appear yet.
- **Deactivated providers** stay in the registry with a different `status`, so filter on that if you only want active ones.

### A note on responsible use

These records are published by CMS and are public by law, but they describe real named people and include their practice addresses and phone numbers. You are responsible for how you use them. US marketing and privacy rules — including the TCPA for calls and texts, CAN-SPAM for email, and state laws — apply to you, not to the registry. Some states also restrict commercial use of licence data. This Actor is built for research, directory building, credential verification and data cleaning; please don't treat it as a cold-call list.

### FAQ

**Do I need an account or API key?** No. The NPPES API is open and keyless.

**What is a taxonomy code?** The standard code for a provider's speciality, like `208000000X` for Pediatrics. Each record carries one or more, and the one marked primary is lifted into `primaryTaxonomy`.

**Why does a search return fewer results than the registry website?** The website and the API apply matching rules slightly differently, and the API caps a query at 1,200 records. Narrowing by city or speciality usually closes the gap.

**Can I monitor for new providers in an area?** Yes. Schedule the Actor in Apify Console and compare runs on the `enumerationDate` field. The registry refreshes weekly, so a daily schedule is more often than needed.

**Is this legal?** The NPI Registry is public data published by the US government with no authentication. Collecting it is fine; what you then do with it is governed by the marketing and privacy laws above.

### Feedback

Found a bug or need a field that's missing? Open an issue on the Actor's **Issues** tab.

# Actor input Schema

## `mode` (type: `string`):

Search the registry by name, speciality or location, or look up specific NPI numbers.

## `npiNumbers` (type: `array`):

For Look up. Ten-digit NPI numbers, one per line. A registry URL containing the number works too.

## `providerType` (type: `string`):

Individuals are NPI-1 records (doctors, nurses, therapists). Organizations are NPI-2 records (clinics, hospitals, pharmacies, labs).

## `lastName` (type: `string`):

Individual providers only. A trailing \* works as a wildcard, for example smit\*.

## `firstName` (type: `string`):

Individual providers only.

## `organizationName` (type: `string`):

Organizations only. A trailing \* works as a wildcard.

## `taxonomyDescription` (type: `string`):

The provider's speciality as NPPES describes it, such as Pediatrics, Internal Medicine, Pharmacy or Physical Therapist.

## `city` (type: `string`):

For Search. Practice-location city, matched exactly the way NPPES stores it, for example 'KANSAS CITY'. Combine with State for a precise match.

## `state` (type: `string`):

Two-letter state code such as KS, CA, NY. NPPES will not accept a state on its own, so pair it with a city, name or speciality.

## `postalCode` (type: `string`):

A 5-digit ZIP, or a prefix with a trailing \* such as 672\*.

## `countryCode` (type: `string`):

Two-letter code. Defaults to all countries; use US to limit to the United States.

## `maxResults` (type: `integer`):

NPPES returns at most 200 per page and stops paging after 1,200 records for a single query.

## `maxItems` (type: `integer`):

Stop the run after saving this many items. Leave empty for no limit.

## `maxConcurrency` (type: `integer`):

The registry paginates in order, so this mostly matters when looking up many NPI numbers at once.

## `proxyConfiguration` (type: `object`):

Not needed. The NPPES API is open to datacenter traffic.

## Actor input object example

```json
{
  "mode": "search",
  "providerType": "any",
  "taxonomyDescription": "Family Medicine",
  "state": "KS",
  "maxResults": 100,
  "maxConcurrency": 2,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

## `results` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "taxonomyDescription": "Family Medicine",
    "state": "KS"
};

// Run the Actor and wait for it to finish
const run = await client.actor("winterlock/npi-registry-scraper").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "taxonomyDescription": "Family Medicine",
    "state": "KS",
}

# Run the Actor and wait for it to finish
run = client.actor("winterlock/npi-registry-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "taxonomyDescription": "Family Medicine",
  "state": "KS"
}' |
apify call winterlock/npi-registry-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,winterlock/npi-registry-scraper"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/KTgs806JNj7zJhkkZ/builds/TIn76nwgXnn226Zyt/openapi.json
