# CMS Hospital Compare Search — Public Provider Data API (`quartz_apple_dnx/cms-hospital-compare-search-api`) Actor

Search CMS Hospital General Information by state, city, ZIP, facility ID, hospital type, ownership, emergency services, or overall rating. Independent tool; not affiliated with or endorsed by CMS.

- **URL**: https://apify.com/quartz_apple_dnx/cms-hospital-compare-search-api.md
- **Developed by:** [Piven Core](https://apify.com/quartz_apple_dnx) (community)
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$0.25 / 1,000 cms 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 Compare Search — Public Provider Data API

Search the public CMS Hospital General Information dataset and export structured hospital/provider rows.

Use it for **provider discovery, hospital-market research, public healthcare-data analysis, facility comparison research, geographic provider datasets, and automated CMS-data workflows**.

**Independent tool. Not affiliated with or endorsed by the Centers for Medicare & Medicaid Services (CMS). Not medical advice or a recommendation of any hospital.**

### Common use cases

- Find hospitals by state, city, ZIP, or facility ID
- Filter providers by hospital type, ownership, or emergency-services status
- Collect CMS-published overall rating and measure-count fields
- Build geographic hospital datasets for research
- Feed public provider records into downstream analysis workflows

### What you get

Each hospital row can include facility ID/name, address, phone, type, ownership, emergency/birthing-friendly indicators, overall rating and counts of mortality, safety, readmission, patient-experience and timely/effective-care measures.

### Source

Dataset: **Hospital General Information**\
CMS dataset identifier: `xubh-q36u`\
API: `https://data.cms.gov/provider-data/api/1/datastore/query/xubh-q36u/0`

CMS currently publishes 5,419 hospitals in this dataset, with facility identity/location, hospital type/ownership, emergency-services status, overall rating and measure-count summaries.

### Input

Filter by state, exact city, exact ZIP, exact facility ID / CCN, exact hospital type, exact ownership, emergency-services status, or overall rating.

The Store prefill searches **Texas** and saves at most 25 hospital rows. API users can omit state for a national browse.

### Important limitations

This Actor does not rank hospitals, recommend care, infer clinical outcomes, or infer quality beyond CMS-published fields. CMS ratings and measure counts should be interpreted according to CMS methodology and are not a substitute for individualized medical or facility-selection advice.

### Pricing

Only successfully saved hospital rows are billed. Legitimate zero-result and budget-limit summaries are non-billed. Source/API failures remain failures.

Private candidate target: **$0.25 per 1,000 hospital rows**, subject to live economics and final market recheck.

Public release is a separate decision.

### About Piven Core

Built and maintained by **Piven Core** — focused data APIs and automation utilities for reliable, production-ready workflows.

Learn more: https://pivencore.com

# Actor input Schema

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

Optional 2-letter state code. Store prefill is TX; omit the field for a national browse.

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

Optional exact city filter.

## `zipCode` (type: `string`):

Optional exact ZIP code.

## `facilityId` (type: `string`):

Optional exact CMS facility ID.

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

Optional exact CMS hospital-type value.

## `ownership` (type: `string`):

Optional exact CMS ownership value.

## `emergencyServices` (type: `boolean`):

Optional emergency-services filter.

## `overallRating` (type: `integer`):

Optional CMS overall hospital rating from 1 to 5.

## `maxRows` (type: `integer`):

Hard cap on saved billable hospital rows.

## Actor input object example

```json
{
  "state": "TX",
  "maxRows": 25
}
```

# Actor output Schema

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

No description

## `summary` (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": "TX",
    "maxRows": 25
};

// Run the Actor and wait for it to finish
const run = await client.actor("quartz_apple_dnx/cms-hospital-compare-search-api").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": "TX",
    "maxRows": 25,
}

# Run the Actor and wait for it to finish
run = client.actor("quartz_apple_dnx/cms-hospital-compare-search-api").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": "TX",
  "maxRows": 25
}' |
apify call quartz_apple_dnx/cms-hospital-compare-search-api --silent --output-dataset

```

## MCP server setup

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

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/zLIMjzgE7NBulbo1N/builds/c9XiMQaNuC4npxyaK/openapi.json
