# CMS Hospital Compare — Quality & Ratings Data API (`nexgendata/cms-hospital-compare`) Actor

CMS Hospital Compare data: facility name, type, ownership, location, emergency services, and overall rating for 5,400+ US hospitals. For hospital strategy, benchmarking, payers, and consultants.

- **URL**: https://apify.com/nexgendata/cms-hospital-compare.md
- **Developed by:** [NexGenData](https://apify.com/nexgendata) (community)
- **Categories:** Business, Lead generation, AI
- **Features:** Limited permissions
- **Stats:** 3 total users, 1 monthly users, 81.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$50.00 / 1,000 hospital 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

## CMS Hospital Compare

CMS Hospital Compare is a NexGenData tool on Apify that returns hospitals with type, ownership, location, emergency services and rating from CMS Hospital Compare data.

CMS Hospital Compare public records — facility info, type and quality ratings.

> Public regulatory/health data — not medical advice.

### 📊 Sample Output

![6 real rows delivered by CMS Hospital Compare — Quality & Ratings Data API — run 801xV4zo0rVAYtYfN on build 0.0.18](https://api.apify.com/v2/key-value-stores/8gLgXMBveEI1tTz1z/records/cms-hospital-compare-sample)

| `facility_id` | `facility_name` | `address` | `citytown` | `countyparish` | `telephone_number` |
|---|---|---|---|---|---|
| 010001 | SOUTHEAST HEALTH MEDICAL CENTER | 1108 ROSS CLARK CIRCLE | DOTHAN | HOUSTON | \[phone on record] |
| 010005 | MARSHALL MEDICAL CENTERS | 2505 U S HIGHWAY 431 NORTH | BOAZ | MARSHALL | \[phone on record] |
| 010006 | NORTH ALABAMA MEDICAL CENTER | 1701 VETERANS DRIVE | FLORENCE | LAUDERDALE | \[phone on record] |
| 010007 | MIZELL MEMORIAL HOSPITAL | 702 N MAIN ST | OPP | COVINGTON | \[phone on record] |
| 010011 | ST. VINCENT'S EAST | 50 MEDICAL PARK EAST DRIVE | BIRMINGHAM | JEFFERSON | \[phone on record] |
| 010012 | DEKALB REGIONAL MEDICAL CENTER | 200 MED CENTER DRIVE | FORT PAYNE | DE KALB | \[phone on record] |

Real rows from run `801xV4zo0rVAYtYfN` on build 0.0.18 (2026-09-25), unedited apart from masked emails/phones and shortened long text; fields the source does not publish are empty.

### ⚙️ Sample inputs

This is the Store example input — the same input Apify's automated check runs — so it is proven to return rows on the current build. Paste it into the input form, or send it through the API, CLI or a schedule:

```json
{
  "datasetId": "xubh-q36u",
  "maxResults": 2000
}
```

### 🔧 Input reference

| Field | Type | Default | What it does |
|---|---|---|---|
| `datasetId` | string | `"xubh-q36u"` | CMS Provider Data dataset ID (default xubh-q36u = Hospital General Information). |
| `state` | string |  | Two-letter state code filter. |
| `maxResults` | integer | `2000` | Max records to return. |

### 🧾 JSON sample record

One real record from run `801xV4zo0rVAYtYfN` (emails/phones masked, long text shortened):

```json
{
  "facility_id": "010001",
  "facility_name": "SOUTHEAST HEALTH MEDICAL CENTER",
  "address": "1108 ROSS CLARK CIRCLE",
  "citytown": "DOTHAN",
  "state": "AL",
  "zip_code": "36301",
  "countyparish": "HOUSTON",
  "telephone_number": "[phone on record]",
  "hospital_type": "Acute Care Hospitals",
  "hospital_ownership": "Government - Hospital District or Authority",
  "emergency_services": "Yes",
  "meets_criteria_for_birthing_friendly_designation": "Y",
  "hospital_overall_rating": "4",
  "hospital_overall_rating_footnote": "",
  "mort_group_measure_count": "8",
  "count_of_facility_mort_measures": "8",
  "count_of_mort_measures_better": "0",
  "count_of_mort_measures_no_different": "8",
  "count_of_mort_measures_worse": "0",
  "mort_group_footnote": "",
  "safety_group_measure_count": "8",
  "count_of_facility_safety_measures": "7",
  "count_of_safety_measures_better": "3",
  "count_of_safety_measures_no_different": "4",
  "count_of_safety_measures_worse": "0",
  "safety_group_footnote": "",
  "readm_group_measure_count": "11",
  "count_of_facility_readm_measures": "11",
  "count_of_readm_measures_better": "1",
  "count_of_readm_measures_no_different": "9",
  "count_of_readm_measures_worse": "1",
  "readm_group_footnote": "",
  "pt_exp_group_measure_count": "15",
  "count_of_facility_pt_exp_measures": "15",
  "pt_exp_group_footnote": "",
  "te_group_measure_count": "10",
  "count_of_facility_te_measures": "10",
  "te_group_footnote": "",
  "_cmsDatasetId": "xubh-q36u"
}
```

### 💰 Pricing

| Event | Price (USD) | When it is charged |
|---|---|---|
| Hospital record (`apify-default-dataset-item`) | $0.05 | Charged per result row returned. |

Pay-per-event: you pay only for what the run delivers. A run that delivers nothing bills no result events (only the actor-start event, when the actor defines one). Example: a run that delivers 100 results costs 100 × $0.05 = $5.00 plus the start fee.

### 🔗 Related Actors

More from the NexGenData **Healthcare & FDA** family:

- [CMS Dialysis Facility Compare — Provider Data API](https://apify.com/nexgendata/cms-dialysis-facility-compare?fpr=2ayu9b)
- [CMS Home Health Agencies — Provider Records API](https://apify.com/nexgendata/cms-home-health-agencies?fpr=2ayu9b)
- [CMS Hospice Compare — Provider Records API](https://apify.com/nexgendata/cms-hospice-compare?fpr=2ayu9b)
- [CMS Nursing Home Compare — Provider Records API](https://apify.com/nexgendata/cms-nursing-home-compare?fpr=2ayu9b)
- [CMS Open Payments Pro — Sunshine Act + NPI API](https://apify.com/nexgendata/cms-open-payments-physician-intelligence-pro?fpr=2ayu9b)
- [CMS Open Payments — Pharma-to-Doctor Records API](https://apify.com/nexgendata/cms-open-payments-scraper?fpr=2ayu9b)

15 more in this family on the [NexGenData Store page](https://apify.com/nexgendata?fpr=2ayu9b).

### 📊 What you get

Clean JSON, one record per facility (full output has 38 fields):

- `facility_id` — Facility id
- `facility_name` — Facility name
- `address` — Address
- `citytown` — Citytown
- `state` — State
- `zip_code` — Zip code
- `countyparish` — Countyparish
- `telephone_number` — Telephone number
- `hospital_type` — Hospital type
- `hospital_ownership` — Hospital ownership

**Pricing:** $0.05 per facility (Pay-Per-Event) — about **20 per $1**. Live prices are in the Pricing table below.

### 🤖 Use with AI agents

Point Claude, the OpenAI Agents SDK, an n8n flow or any MCP-aware client at it and pull official records on demand.

**Agentic payments (x402):** Supports agentic payment via x402 — agents can call this actor with USDC, no API key required.

### 🔗 Related regulatory actors

**CMS quality & provider records — every CMS compare dataset:**

[Nursing Home](https://apify.com/nexgendata/cms-nursing-home-compare) · [Home Health](https://apify.com/nexgendata/cms-home-health-agencies) · [Hospice](https://apify.com/nexgendata/cms-hospice-compare) · [Dialysis](https://apify.com/nexgendata/cms-dialysis-facility-compare) · [Open Payments](https://apify.com/nexgendata/cms-open-payments-scraper) · [Open Payments Pro](https://apify.com/nexgendata/cms-open-payments-physician-intelligence-pro) · [Medicare Providers](https://apify.com/nexgendata/medicare-provider-intelligence)

**FDA records:** [OpenFDA Drug](https://apify.com/nexgendata/openfda-drug-search) · [Drug Approvals](https://apify.com/nexgendata/fda-drug-approvals) · [Drug Shortages](https://apify.com/nexgendata/fda-drug-shortages-monitor) · [Purple Book](https://apify.com/nexgendata/fda-purple-book-biologics-biosimilars) · [Warning Letters/483](https://apify.com/nexgendata/fda-warning-letters-483-inspections) · [Pharma Pipeline](https://apify.com/nexgendata/fda-pharma-catalyst-pipeline) · [Adverse Events](https://apify.com/nexgendata/fda-adverse-events-faers-maude) · [Medical Devices](https://apify.com/nexgendata/medical-device-fda-intelligence)

**Agent front door — Healthcare & FDA MCP:** [Healthcare & FDA MCP](https://apify.com/nexgendata/healthcare-fda-intelligence-mcp)

***

*Public official records and enforcement data, assembled for research and monitoring.*

### 🤖 Use with AI agents

Structured JSON built for LLM and agent pipelines — point Claude, the OpenAI Agents SDK, an n8n flow or any MCP-aware client at it.

**Sample agent prompt:**

```
List CMS-registered hospitals in Washington state with their type, ownership and overall star rating.
```

# Actor input Schema

## `datasetId` (type: `string`):

CMS Provider Data dataset ID (default xubh-q36u = Hospital General Information).

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

Two-letter state code filter.

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

Max records to return. Default when omitted: 2000.

## Actor input object example

```json
{
  "datasetId": "xubh-q36u",
  "maxResults": 25
}
```

# Actor output Schema

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

Default dataset of CMS Hospital Compare — Quality & Ratings Data API records (39 fields per row: facility_id, facility_name, address, citytown, state, zip_code, countyparish, telephone_number, hospital_type, hospital_ownership, emergency_services, meets_criteria_for_birthing_friendly_designation…).

# 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 = {
    "datasetId": "xubh-q36u",
    "maxResults": 25
};

// Run the Actor and wait for it to finish
const run = await client.actor("nexgendata/cms-hospital-compare").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 = {
    "datasetId": "xubh-q36u",
    "maxResults": 25,
}

# Run the Actor and wait for it to finish
run = client.actor("nexgendata/cms-hospital-compare").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 '{
  "datasetId": "xubh-q36u",
  "maxResults": 25
}' |
apify call nexgendata/cms-hospital-compare --silent --output-dataset

```

## MCP server setup

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

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/8JRXrd7Diyfv5jq7o/builds/x05sg92OZL3w8wNva/openapi.json
