# CMS Provider Data - hospitals, nursing homes, ratings (API) (`retrainmap/cms-provider-data`) Actor

Pull CMS Provider Data Catalog datasets - Hospital General Information, Nursing Home Provider Information, Home Health Care Agencies, Dialysis Facilities - filtered by state, city or name. One row per facility with the dataset's own columns (id, name, address, phone, type, ownership, star ratings).

- **URL**: https://apify.com/retrainmap/cms-provider-data.md
- **Developed by:** [RetrainMap Team](https://apify.com/retrainmap) (community)
- **Categories:**
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $5.00 / 1,000 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?

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 Provider Data — hospitals, nursing homes, ratings (API)

One row per facility from the CMS Provider Data Catalog (https://data.cms.gov/provider-data)
— the data behind Medicare Care Compare. Pick a dataset (Hospital General Information,
Nursing Home Provider Information, Home Health Care Agencies, Dialysis Facility listing),
filter by state, city or name, and get the dataset's own columns — facility id, name,
address, city, state, zip, phone, type, ownership, star ratings and measure counts — one flat
row per facility, ready for CSV or JSON.

**The default input (Hospital General Information, state NC, 500 rows) succeeds within 5
minutes and returns rows** (North Carolina has ~120 hospitals) — Apify auto-tests it daily.

### Data source and status

| | |
|---|---|
| Publisher | Centers for Medicare & Medicaid Services (CMS) — Provider Data Catalog |
| API | https://data.cms.gov/provider-data/api/1/ — public, no key (documentation: https://data.cms.gov/provider-data/docs) |
| What this Actor reads | The catalog (`metastore/schemas/dataset/items`) once per run to resolve the dataset id by title, then the datastore query endpoint (`datastore/query/{id}/0`) with `limit=500`, `offset`, `count=true` and `conditions[]` for state (`=`), city and name (`like`, case-insensitive); at most two requests per second |
| Refresh cadence | CMS refreshes each dataset on its own schedule (hospital data roughly quarterly, nursing home data monthly, home health and dialysis data quarterly). The Actor reads live on every run; the catalog's `modified` date for the dataset is written to every row as `_dataset_modified` and `_fetched_at` is the fetch time |
| Copyright | Works of the United States Government are not subject to copyright in the U.S. (17 U.S.C. §105). The data are public; please cite CMS as the source |
| Known caveats | Dataset ids change when CMS re-publishes a dataset — the Actor resolves the id by exact title + theme on every run and fails with the candidate list if the title is not found; all values are strings exactly as the datastore returns them (ratings such as `"4"`, footnote columns often empty); `%` and `_` inside city / name filters are SQL LIKE wildcards |

Honesty note: the rows are the dataset's own columns, nothing is inferred, joined or
re-scored by this Actor; CMS ratings and measures are **informational, not medical advice**,
and a run stops with an error rather than guess when the API's shape changes.

Identification: the requests carry a product-token User-Agent and the operator's contact
address in the standard `From:` header (RFC 9110 §10.1.2).

### Input

| Field | Type | Meaning |
|---|---|---|
| `dataset` | select | `hospital_general_info` (default), `nursing_home_provider_info`, `home_health_agencies`, `dialysis_facilities` |
| `state` | 2-letter code | Optional, exact match, e.g. `NC` (prefilled) |
| `city` | string | Optional substring of the city column |
| `name_contains` | string | Optional substring of the facility / provider name column |
| `max_records` | integer | Default 500, at most 20,000 |
| `request_interval_ms` | integer | Default 500 (floor 250) |
| `contact_email` | string | Sent in the `From:` header |

Example — nursing homes in Houston, Texas:

```json
{ "dataset": "nursing_home_provider_info", "state": "TX", "city": "Houston", "max_records": 200 }
```

### Output (dataset row)

Every column the dataset carries, unchanged, plus `_dataset` (the preset key), `_dataset_id`,
`_dataset_title`, `_dataset_modified`, `_source_url` (the dataset's page on data.cms.gov) and
`_fetched_at`. Common columns by dataset (measured 2026-09-04):

| Dataset | Id | Name | Address / city / state / zip | Phone | Type / ownership | Ratings |
|---|---|---|---|---|---|---|
| hospital\_general\_info (~5,400 rows) | `facility_id` | `facility_name` | `address`, `citytown`, `state`, `zip_code`, `countyparish` | `telephone_number` | `hospital_type`, `hospital_ownership`, `emergency_services` | `hospital_overall_rating` (1–5) plus mortality / safety / readmission / patient-experience / timeliness measure counts |
| nursing\_home\_provider\_info (~14,700 rows) | `cms_certification_number_ccn` | `provider_name`, `legal_business_name` | `provider_address`, `citytown`, `state`, `zip_code`, `countyparish` | `telephone_number` | `provider_type`, `ownership_type`, `number_of_certified_beds`, `chain_name` | `overall_rating`, `health_inspection_rating`, `qm_rating`, `staffing_rating`, `special_focus_status`, `abuse_icon` |
| home\_health\_agencies (~11,000 rows) | `cms_certification_number_ccn` | `provider_name` | `address`, `citytown`, `state`, `zip_code` | `telephone_number` | `type_of_ownership`, services offered (`offers_nursing_care_services` …) | `quality_of_patient_care_star_rating` plus outcome measures |
| dialysis\_facilities (~7,700 rows) | `cms_certification_number_ccn` | `facility_name` | `address_line_1`, `citytown`, `state`, `zip_code`, `countyparish` | `telephone_number` | `profit_or_nonprofit`, `chain_owned`, `chain_organization`, `of_dialysis_stations` | `five_star`, mortality / hospitalization / readmission categories |

A run summary (dataset id and modified date, filters, the API's own match count, pages,
requests, whether the pay-per-event budget stopped the run) is stored as `RUN_SUMMARY` in
the run's key-value store.

### Pricing (pay per event)

| Event | Price |
|---|---|
| `run-start` — once per run | $0.10 |
| `record` — per row written | $0.005 |

The default pull (NC hospitals, ~120 rows) costs about $0.70; 1,000 facilities cost $5.10.
Rows stop when your run's maximum charge is reached; the run summary says so.

### Operator

Steelyard Ventures LLC (RetrainMap) — info@steelyardclinical.com. Not affiliated with CMS.
The Actor writes only to its own dataset and key-value store; it stores no credentials and
sends nothing else.

# Actor input Schema

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

Which Provider Data Catalog dataset to read. The dataset id is looked up by title in the live catalog on every run (measured ids on 2026-09-04: hospital\_general\_info = xubh-q36u, nursing\_home\_provider\_info = 4pq5-n9py, home\_health\_agencies = 6jpm-sxkc, dialysis\_facilities = 23ew-n7w9).

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

Optional USPS state or territory code, e.g. NC. Exact match on the dataset's state column (case-insensitive). Empty = all states.

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

Optional substring of the city column (case-insensitive LIKE). Empty = any city.

## `name_contains` (type: `string`):

Optional substring of the facility / provider name column (case-insensitive LIKE). Empty = any name.

## `max_records` (type: `integer`):

Stop after this many rows have been written. The datasets hold roughly 5,400 hospitals, 14,700 nursing homes, 11,000 home health agencies and 7,700 dialysis facilities nationally.

## `request_interval_ms` (type: `integer`):

Politeness delay towards data.cms.gov. Each request returns up to 500 rows; the floor is 250 ms.

## `contact_email` (type: `string`):

Sent in the standard From: request header so the data owner can reach the operator (RFC 9110 s10.1.2).

## Actor input object example

```json
{
  "dataset": "hospital_general_info",
  "state": "NC",
  "max_records": 500,
  "request_interval_ms": 500,
  "contact_email": "info@steelyardclinical.com"
}
```

# Actor output Schema

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

Every matched facility as one row with the dataset's own columns plus \_dataset and \_fetched\_at.

## `results_csv` (type: `string`):

The same rows as a CSV file.

# 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 = {
    "state": "NC"
};

// Run the Actor and wait for it to finish
const run = await client.actor("retrainmap/cms-provider-data").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 = { "state": "NC" }

# Run the Actor and wait for it to finish
run = client.actor("retrainmap/cms-provider-data").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 '{
  "state": "NC"
}' |
apify call retrainmap/cms-provider-data --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,retrainmap/cms-provider-data"
        }
    }
}

```

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/Xo6bKW1kN1QGJA3OZ/builds/QMxmp3KY0ZH9kD31c/openapi.json
