# CMS Hospital Star Ratings & Quality (`cheerful_term/cms-hospital-ratings`) Actor

Medicare Care Compare data for every US hospital: CMS ID, name, address, phone, type, ownership, emergency services, overall star rating, and mortality, safety, readmission, patient-experience and timeliness measure counts.

- **URL**: https://apify.com/cheerful_term/cms-hospital-ratings.md
- **Developed by:** [Aidan Jude](https://apify.com/cheerful_term) (community)
- **Categories:** Business, Lead generation
- **Security:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$3.00 / 1,000 hospitals

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 Star Ratings & Quality

Medicare Care Compare data for every US hospital: CMS ID, name, address, phone, type, ownership, emergency services, overall star rating, and mortality, safety, readmission, patient-experience and timeliness measure counts.

### Who it's for

- Health-tech and med-device sales teams building hospital lists
- Patients and journalists comparing quality
- Analysts studying ownership vs ratings

### Input

| Field | What it does |
|---|---|
| `state` | **State**. Two-letter code |
| `city` | **City**. City in capitals |
| `hospitalType` | **Hospital type**. e.g. Acute Care Hospitals, Critical Access Hospitals |
| `minRating` | **Minimum overall star rating**. 1-5 |
| `maxItems` | **Max results**. Stop after this many results. Each result is one billed event. |

Example input:

```json
{
  "state": "MN",
  "maxItems": 100
}
```

### Output

One dataset item per result. A real item from a test run:

```json
{
  "facility_id": "240001",
  "facility_name": "NORTH MEMORIAL HEALTH HOSPITAL",
  "address": "3300 OAKDALE NORTH",
  "citytown": "ROBBINSDALE",
  "state": "MN",
  "zip_code": "55422",
  "countyparish": "HENNEPIN",
  "telephone_number": "(763) 520-5200",
  "hospital_type": "Acute Care Hospitals",
  "hospital_ownership": "Voluntary non-profit - Private",
  "emergency_services": "Yes",
  "meets_criteria_for_birthing_friendly_designation": "Y",
  "hospital_overall_rating": "1",
  "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",
  "safety_group_measure_count": "8",
  "count_of_facility_safety_measures": "6",
  "count_of_safety_measures_better": "1",
  "count_of_safety_measures_no_different": "4",
  "count_of_safety_measures_worse": "1",
  "readm_group_measure_count": "11",
  "count_of_facility_readm_measures": "10",
  "count_of_readm_measures_better": "0",
  "count_of_readm_measures_no_different": "8",
  "count_of_readm_measures_worse": "2",
  "pt_exp_group_measure_count": "15",
  "count_of_facility_pt_exp_measures": "15",
  "te_group_measure_count": "10",
  "count_of_facility_te_measures": "8",
  "careCompareUrl": "https://www.medicare.gov/care-compare/details/hospital/240001"
}
```

Download as JSON, CSV, Excel or via the Apify API.

### Pricing

Pay per result: **$0.003 per hospital** ($3 per 1,000). No monthly fee. Set a max charge on the run and it stops there. AI agents can run it with agentic payments where Apify enables them.

### Data source

Fetched live at run time from the public source: https://data.cms.gov/provider-data/dataset/xubh-q36u

Public records only. Nothing is fetched behind a login.

### Use it from code or an AI agent

```bash
curl -X POST 'https://api.apify.com/v2/acts/cheerful_term~cms-hospital-ratings/run-sync-get-dataset-items?token=YOUR_TOKEN' \
  -H 'Content-Type: application/json' -d '{"state": "MN", "maxItems": 100}'
```

Part of a set of public-records actors by cheerful_term: https://apify.com/cheerful_term

# Actor input Schema

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

Two-letter code

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

City in capitals

## `hospitalType` (type: `string`):

e.g. Acute Care Hospitals, Critical Access Hospitals

## `minRating` (type: `integer`):

1-5

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

Stop after this many results. Each result is billed as one event.

## Actor input object example

```json
{
  "state": "MN",
  "maxItems": 100
}
```

# Actor output Schema

## `overview` (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 = {
    "state": "MN",
    "maxItems": 100
};

// Run the Actor and wait for it to finish
const run = await client.actor("cheerful_term/cms-hospital-ratings").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": "MN",
    "maxItems": 100,
}

# Run the Actor and wait for it to finish
run = client.actor("cheerful_term/cms-hospital-ratings").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": "MN",
  "maxItems": 100
}' |
apify call cheerful_term/cms-hospital-ratings --silent --output-dataset

```

## MCP server setup

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

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/GWrfW9fIejym86FLE/builds/XoQnFOmbuZBR5J0k5/openapi.json
