# CMS Physician Compare Scraper (`crawlergang/cms-physician-compare-scraper`) Actor

Search and extract Medicare physician and healthcare provider data from the CMS Physician Compare dataset. Search by name, specialty, state, or NPI number. Covers 2M+ providers. No API key required.

- **URL**: https://apify.com/crawlergang/cms-physician-compare-scraper.md
- **Developed by:** [Crawler Gang](https://apify.com/crawlergang) (community)
- **Categories:** Automation, Lead generation, Developer tools
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 11 bookmarks
- **User rating**: 5.00 out of 5 stars

## Pricing

from $3.00 / 1,000 results

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## CMS Physician Compare Scraper

Extract physician and healthcare provider data from the **CMS Physician Compare** dataset — the official Medicare provider database maintained by the Centers for Medicare & Medicaid Services. Search by name, specialty, state, or NPI number across 2 million+ providers. No API key or account required.

Whether you are building provider directories, conducting healthcare market research, or verifying practitioner credentials, this actor delivers structured, export-ready data from CMS's public API.

***

### What You Can Scrape

- **Physician profiles** — Name, specialty, credentials, graduation year, medical school
- **Practice location** — Address, city, state, zip code, phone number
- **Medicare participation** — Whether the provider accepts Medicare assignment
- **Telehealth availability** — Providers offering telemedicine services
- **Secondary specialties** — Additional board certifications beyond the primary specialty
- **NPI lookup** — Direct lookup by 10-digit National Provider Identifier

***

### Key Features

- Search by last name and/or first name
- Filter by medical specialty (65+ specialties as dropdown)
- Filter by US state or territory (all 50 states + DC, PR, GU, VI, AS, MP)
- Filter by gender
- Filter to providers accepting Medicare assignment
- Direct NPI number lookup (getByNPI mode)
- Browse all providers in a specialty (searchBySpecialty mode)
- No authentication or API key required

***

### Input Parameters

| Parameter | Type | Description | Default |
|-----------|------|-------------|---------|
| `mode` | Select | What to search: by name/filters, by NPI, or by specialty | `searchPhysicians` |
| `lastName` | Text | Provider last name to search | — |
| `firstName` | Text | Provider first name filter | — |
| `specialty` | Select | Medical specialty (65+ options) | — |
| `state` | Select | US state or territory (2-letter code) | — |
| `npi` | Text | 10-digit NPI number (getByNPI mode) | — |
| `gender` | Select | Provider gender: Any, Male, Female | — |
| `acceptsMedicare` | Boolean | Only show providers accepting Medicare | `false` |
| `maxItems` | Integer | Maximum records to return (1–200) | `50` |

#### Supported Medical Specialties (sample)

Addiction Medicine · Anesthesiology · Cardiac Surgery · Cardiovascular Disease (Cardiology) · Chiropractic · Clinical Psychologist · Dermatology · Emergency Medicine · Endocrinology · Family Practice · Gastroenterology · General Surgery · Hematology/Oncology · Infectious Disease · Internal Medicine · Nephrology · Neurology · Neurosurgery · Nurse Practitioner · Obstetrics/Gynecology · Ophthalmology · Orthopedic Surgery · Pain Management · Pediatric Medicine · Psychiatry · Pulmonary Disease · Radiation Oncology · Rheumatology · Urology · Vascular Surgery · and 35+ more

***

### Output Fields

| Field | Type | Description |
|-------|------|-------------|
| `npi` | String | National Provider Identifier (10 digits) |
| `lastName` | String | Provider last name |
| `firstName` | String | Provider first name |
| `middleName` | String | Provider middle name |
| `suffix` | String | Name suffix (e.g. MD, DO) |
| `credentials` | String | Professional credentials (e.g. MD, FACC) |
| `gender` | String | Provider gender (Male / Female) |
| `medicalSchool` | String | Medical school attended |
| `graduationYear` | Integer | Year of graduation |
| `specialty` | String | Primary medical specialty |
| `secondarySpecialties` | Array | Additional specialties (when available) |
| `offersTelemedicine` | Boolean | Whether the provider offers telemedicine |
| `facilityName` | String | Practice facility or group name |
| `address` | String | Street address |
| `city` | String | City or town |
| `state` | String | State code (e.g. CA, NY) |
| `zipCode` | String | 5-digit ZIP code |
| `phone` | String | Phone number (formatted as (XXX) XXX-XXXX) |
| `acceptsMedicareAssignment` | Boolean | Individual Medicare assignment status |
| `groupAcceptsMedicareAssignment` | Boolean | Group/practice Medicare assignment status |
| `sourceUrl` | String | Link to provider profile on CMS Provider Data |
| `recordType` | String | Always `physician` |
| `scrapedAt` | String | ISO timestamp when the record was scraped |

***

### Example Use Cases

1. **Provider directory building** — Find all cardiologists in California by setting `specialty=CARDIOVASCULAR DISEASE (CARDIOLOGY)` and `state=CA`.
2. **Credential verification** — Look up a specific provider by NPI number to verify their specialty and Medicare participation status.
3. **Healthcare market research** — Count providers by specialty and state to analyze market density.
4. **Medicare network analysis** — Filter by `acceptsMedicare=true` to identify Medicare-participating providers in a region.
5. **Telehealth provider discovery** — Find telemedicine-capable providers in a specialty by combining `specialty` and `acceptsMedicare` filters.

***

### Data Source

This actor uses the **CMS Provider Data Catalog** (Physician Compare dataset, resource ID `mj5m-pzi6`), maintained by the Centers for Medicare & Medicaid Services. Data covers Medicare-enrolled physicians and other eligible professionals. The dataset is updated regularly by CMS and is freely available without registration.

***

### Frequently Asked Questions

**Do I need an API key or CMS account?**
No. The CMS Provider Data Catalog is a public API that does not require authentication.

**What is an NPI number?**
The National Provider Identifier (NPI) is a unique 10-digit identification number for covered healthcare providers. It is required for electronic transactions and uniquely identifies each provider.

**How many providers are in the database?**
The Physician Compare dataset covers over 2 million Medicare-enrolled healthcare providers.

**Can I filter by city?**
The CMS API supports filtering by state and zip code, but not directly by city name. Use the `state` filter to narrow results geographically.

**What does "accepts Medicare assignment" mean?**
A provider who accepts Medicare assignment agrees to accept Medicare's approved payment amount as full payment. This means lower out-of-pocket costs for patients.

**Are all doctor types included?**
The dataset includes physicians and other eligible professionals: nurse practitioners, physician assistants, chiropractors, physical therapists, psychologists, and many other healthcare provider types.

**Why might a provider not appear in results?**
Providers who are not enrolled in Medicare or who have voluntarily opted out will not appear in this dataset.

**Is name matching case-sensitive?**
The actor automatically converts name input to uppercase to match the CMS database format.

**Can I get providers in US territories?**
Yes. Puerto Rico (PR), Guam (GU), Virgin Islands (VI), American Samoa (AS), and Northern Mariana Islands (MP) are included in the state filter.

# Actor input Schema

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

What to search: physicians by name/specialty/location, by NPI number, or browse by specialty.

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

Provider last name to search by (partial match supported).

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

Provider first name to filter by (optional).

## `specialty` (type: `string`):

Filter by primary medical specialty.

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

Filter by US state or territory.

## `npi` (type: `string`):

National Provider Identifier (10-digit NPI number) for a specific physician. Used in getByNPI mode.

## `gender` (type: `string`):

Filter by provider gender (optional).

## `acceptsMedicare` (type: `boolean`):

When enabled, only return providers who accept Medicare assignment.

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

Maximum number of providers to return (1-200).

## Actor input object example

```json
{
  "mode": "searchPhysicians",
  "lastName": "Smith",
  "specialty": "CARDIOVASCULAR DISEASE (CARDIOLOGY)",
  "npi": "1104481472",
  "acceptsMedicare": false,
  "maxItems": 20
}
```

# Actor output Schema

## `items` (type: `string`):

Dataset containing all scraped physician/provider records.

# 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 = {
    "mode": "searchPhysicians",
    "lastName": "Smith",
    "specialty": "CARDIOVASCULAR DISEASE (CARDIOLOGY)",
    "npi": "1104481472",
    "acceptsMedicare": false,
    "maxItems": 20
};

// Run the Actor and wait for it to finish
const run = await client.actor("crawlergang/cms-physician-compare-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 = {
    "mode": "searchPhysicians",
    "lastName": "Smith",
    "specialty": "CARDIOVASCULAR DISEASE (CARDIOLOGY)",
    "npi": "1104481472",
    "acceptsMedicare": False,
    "maxItems": 20,
}

# Run the Actor and wait for it to finish
run = client.actor("crawlergang/cms-physician-compare-scraper").call(run_input=run_input)

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

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

```

## CLI example

```bash
echo '{
  "mode": "searchPhysicians",
  "lastName": "Smith",
  "specialty": "CARDIOVASCULAR DISEASE (CARDIOLOGY)",
  "npi": "1104481472",
  "acceptsMedicare": false,
  "maxItems": 20
}' |
apify call crawlergang/cms-physician-compare-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=crawlergang/cms-physician-compare-scraper",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/acts/LiwQpxJNdNylPDc41/builds/XriaSthDg0qjctZFY/openapi.json
