# NPI Doctor Registry Scraper (`purethought/npi-doctor-registry`) Actor

Fetches US healthcare provider records from the public NPI Registry API. Returns NPI number, name, credential, specialty, city, and state.

- **URL**: https://apify.com/purethought/npi-doctor-registry.md
- **Developed by:** [Ganesh B](https://apify.com/purethought) (community)
- **Security:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 50.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $5.00 / 1,000 results

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 Doctor Registry Scraper

Fetches US healthcare provider records from the public NPI (National Provider Identifier) Registry API and returns structured data. Ideal for building provider directories, verifying credentials, or enriching healthcare datasets.

### What you get

- **npi**: 10-digit National Provider Identifier
- **first_name** / **last_name**: Provider name (individuals)
- **organization_name**: Organization name (if applicable)
- **credential**: Professional credential (MD, DO, NP, PA, etc.)
- **specialty**: Primary taxonomy / medical specialty
- **taxonomy_code**: NUCC taxonomy code
- **city** / **state** / **postal_code**: Practice location
- **phone**: Practice telephone number
- **status**: NPI status (A = Active)
- **last_updated**: Date the NPI record was last updated
- **scrapedAt**: ISO timestamp of when the record was fetched

### Input

| Field | Type | Default | Description |
|-------|------|---------|-------------|
| taxonomyDescription | String | `physician` | Medical specialty filter (e.g. `nurse practitioner`, `dentist`) |
| state | String | (all) | Two-letter state code (e.g. `CA`, `NY`) |
| city | String | (all) | City name filter |
| maxItems | Integer | 100 | Maximum number of records to return (0 = unlimited) |

### Quick Start

1. Find the actor in [Apify Store](https://apify.com/purethought)
2. Click **Try for free** and set your inputs
3. Click **Start** and wait for the run to finish
4. Download results as JSON, CSV, or via the API

### Sample Output

Each item in the dataset looks like this:

```json
{
  "npi": "1972634805",
  "enumeration_type": "NPI-1",
  "first_name": "Sarah",
  "last_name": "Chen",
  "organization_name": null,
  "credential": "MD",
  "specialty": "Internal Medicine",
  "taxonomy_code": "207R00000X",
  "city": "San Francisco",
  "state": "CA",
  "postal_code": "94102",
  "phone": "4155550182",
  "status": "A",
  "last_updated": "2024-09-10",
  "scrapedAt": "2024-11-01T10:00:00.000Z"
}
```

### Use cases

- Build a searchable provider directory for a region or specialty
- Verify provider credentials and NPI numbers
- Enrich patient-provider matching datasets
- Research specialty distribution across states

### Notes

- Uses the official CMS NPI Registry API — no login required, publicly available
- Supports filtering by specialty, state, and city
- Returns both individual (NPI-1) and organizational (NPI-2) providers
- Set `maxItems` to 0 for unlimited results (may take time for large queries)
- Data is updated by CMS weekly

# Actor input Schema

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

Filter by medical specialty (e.g. 'physician', 'nurse practitioner', 'dentist'). Leave empty to return all provider types.

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

Two-letter US state code to filter providers (e.g. 'CA', 'NY'). Leave empty for all states.

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

City name to filter providers. Leave empty for all cities.

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

Maximum number of provider records to return. Set to 0 for unlimited.

## Actor input object example

```json
{
  "taxonomyDescription": "physician",
  "state": "",
  "city": "",
  "maxItems": 100
}
```

# Actor output Schema

## `dataset` (type: `string`):

Scraped NPI provider records with NPI number, name, credential, specialty, city, and state

# 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": "physician",
    "state": "",
    "city": "",
    "maxItems": 100
};

// Run the Actor and wait for it to finish
const run = await client.actor("purethought/npi-doctor-registry").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": "physician",
    "state": "",
    "city": "",
    "maxItems": 100,
}

# Run the Actor and wait for it to finish
run = client.actor("purethought/npi-doctor-registry").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": "physician",
  "state": "",
  "city": "",
  "maxItems": 100
}' |
apify call purethought/npi-doctor-registry --silent --output-dataset

```

## MCP server setup

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

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/wCTi0n4wb2ncHkTLx/builds/pWEIWFymbKbdDzqag/openapi.json
