# CMS Hospital Quality / Care Compare Scraper (`thetatech-data/cms-hospital-quality-scraper`) Actor

Query official CMS Care Compare hospital general information and overall star ratings. Filter by state, city, type, ownership, emergency services, and minimum rating. Public Provider Data Catalog API — no login. Free.

- **URL**: https://apify.com/thetatech-data/cms-hospital-quality-scraper.md
- **Developed by:** [Theta Tech](https://apify.com/thetatech-data) (community)
- **Categories:** Business, AI
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

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

## 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

### What does CMS Hospital Quality / Care Compare Scraper do?

**CMS Hospital Quality Scraper** queries the official [CMS Provider Data Catalog](https://data.cms.gov/provider-data/) **Hospital General Information** dataset ([`xubh-q36u`](https://data.cms.gov/provider-data/dataset/xubh-q36u)) — Care Compare facility details, ownership, emergency services, birthing-friendly designation, and **overall hospital star ratings** for ~5,400 US hospitals.

This Actor does **not** scrape HTML. It calls the documented CMS datastore query API and returns clean JSON — no CMS login and no bulk CSV downloads.

### Why use this Actor?

Use cases for health-systems analysts, payers, journalists, PE diligence, and AI agents:

- Find hospitals in a **state** or **city** with a minimum **overall star rating**
- Filter by **hospital type**, **ownership**, and **emergency services**
- Export Care Compare facility rows to JSON, CSV, Excel, or HTML
- Schedule recurring pulls and integrate via the Apify API / Zyla CMS Healthcare Data API

### What data can it extract?

| Field | Type | Description |
| --- | --- | --- |
| `facilityId` | string | CMS Certification Number (CCN) |
| `facilityName` | string | Hospital name |
| `city` / `state` / `zipCode` | string | Location |
| `hospitalType` | string | e.g. Acute Care Hospitals |
| `hospitalOwnership` | string | Ownership category |
| `emergencyServices` | boolean | Emergency services offered |
| `overallRating` | number | Care Compare overall star rating 1–5 |
| `birthingFriendly` | boolean | Birthing-friendly designation |

### How to query hospital star ratings

1. Open this Actor in Apify Console → **Input**.
2. Set `state` (e.g. `RI`) and optionally `minOverallRating`.
3. Click **Start** and download the **Dataset**.

#### Example input

```json
{
  "state": "RI",
  "minOverallRating": 3,
  "emergencyServicesOnly": true,
  "maxItems": 50
}
```

#### Example output item

```json
{
  "facilityId": "410001",
  "facilityName": "EXAMPLE HOSPITAL",
  "city": "PROVIDENCE",
  "state": "RI",
  "overallRating": 4,
  "emergencyServices": true,
  "sourceDatasetId": "xubh-q36u",
  "source": "CMS Provider Data Catalog — Hospital General Information"
}
```

### How much does it cost?

**Free** on the Apify Store (no publisher pay-per-result). You only pay Apify platform usage. Lightweight HTTP only — typically a fraction of a cent per run on small filters.

### FAQ

**Is this the official hospital star ratings API?**\
Yes — it uses the public CMS Provider Data Catalog datastore for Hospital General Information (Care Compare).

**Support** — Issues tab or publisher `thetatech-data`.

### Related

- [CMS Open Payments Scraper](https://apify.com/thetatech-data/cms-open-payments-scraper)
- [CMS Nursing Home Care Compare Scraper](https://apify.com/thetatech-data/cms-nursing-home-scraper)
- [CMS Medicare Physician Scraper](https://apify.com/thetatech-data/cms-medicare-physician-scraper)
- [Medicaid NADAC Drug Pricing Scraper](https://apify.com/thetatech-data/cms-nadac-drug-pricing-scraper)

# Actor input Schema

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

US state abbreviation, e.g. RI, MA, NY. Server-side filter.

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

City name as stored by CMS (usually uppercase), e.g. PROVIDENCE. Server-side filter on citytown.

## `facilityNameContains` (type: `string`):

Case-insensitive substring match on facility name (client-side).

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

Exact CMS hospital_type value, e.g. Acute Care Hospitals.

## `hospitalOwnership` (type: `string`):

Substring match on hospital_ownership (server-side contains), e.g. Voluntary.

## `minOverallRating` (type: `integer`):

Keep hospitals with hospital_overall_rating >= this value (1–5). Client-side.

## `emergencyServicesOnly` (type: `boolean`):

If true, keep only hospitals with emergency services = Yes.

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

Maximum number of hospitals to push to the dataset.

## `pageSize` (type: `integer`):

CMS API page size (1–500).

## `delayMs` (type: `integer`):

Polite delay between API pages.

## Actor input object example

```json
{
  "state": "RI",
  "emergencyServicesOnly": false,
  "maxItems": 1000,
  "pageSize": 100,
  "delayMs": 200
}
```

# Actor output Schema

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

Dataset containing hospital facility and star-rating records matching the input filters.

# 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 = {};

// Run the Actor and wait for it to finish
const run = await client.actor("thetatech-data/cms-hospital-quality-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 = {}

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

```

## MCP server setup

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

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/wzBbuI597qkjDW1N2/builds/k3IG8NfwShLTwkDr3/openapi.json
