Hospitals API logo
DataMAINTAINED1 token / call

Hospitals API

5,419 Medicare-certified US hospitals with CMS star ratings, emergency services and coordinates

US hospital directory for 5,400+ Medicare-certified hospitals, built from official CMS Hospital Compare data enriched with geographic and infrastructure attributes: name, full address, county, phone, hospital type (acute care, critical access, psychiatric, childrens...), ownership, emergency services and birthing-friendly flags, CMS overall star rating (1-5) with mortality, safety, readmission, patient-experience and timeliness measure-group summaries — plus coordinates, bed counts, trauma-center level, helipad flag and website for the ~86% of hospitals geo-matched against the DHS HIFLD infrastructure layer. Search by name or city, filter by state, city, zip, county, type, ownership, emergency services, minimum star rating or trauma centers; find hospitals near any coordinate sorted by distance; aggregate states (with average rating) and hospital types. Self-hosted dataset refreshed daily from CMS — no third-party calls at request time.

Every call needs an X-Api-Key header. A free key includes 500 tokens a month, no card required. 1 token per call, so the free plan covers about 500 calls a month.

No credit card requiredAccess to 125+ APIsCancel anytime
response.json
{
  "total": 5419,
  "count": 1,
  "results": [
    {
      "ccn": "050625",
      "name": "CEDARS-SINAI MEDICAL CENTER",
      "address": {
        "city": "LOS ANGELES",
        "state": "CA"
      },
      "type": "Acute Care Hospitals",
      "emergencyServices": true,
      "overallRating": 5,
      "beds": 886
    }
  ]
}
Production Ready
Battle-tested infrastructure with a 99.9% uptime SLA. Rate limits are generous, responses are consistent.
Simple Integration
Standard REST + JSON. Works with any HTTP client. Copy-ready code snippets in 4 languages.
One Key, 125+ APIs
Your DataAndAPIs subscription unlocks every API on the platform — anime, finance, sports, and more.

Use cases for Hospitals API

  • Find the nearest emergency department to a patient's location in a telehealth or ambulance-dispatch tool.

  • Show CMS star ratings and safety, readmission and patient-experience summaries on a hospital comparison page.

  • Filter hospitals by type, ownership, trauma level or birthing-friendly flag for a referral directory.

  • Enrich claims or provider records with the hospital's address, phone, bed count and website from its CMS number.

Hospitals API endpoints

Every endpoint with its parameters and a real example response.

GETGet Hospital

https://api-hospitals.dataandapis.com/v1/hospitals/{ccn}

Path parameters

ParameterExample
ccn050625Required

Example request

curl
curl "https://api-hospitals.dataandapis.com/v1/hospitals/050625" \
  -H "X-Api-Key: YOUR_API_KEY"
JavaScript / TypeScript (dataandapis package)
// npm install dataandapis
import { DataAndApis } from "dataandapis";

const client = new DataAndApis(); // reads DATAANDAPIS_API_KEY

const data = await client.hospitals.getHospital({ ccn: "050625" });
Python (dataandapis package)
# pip install dataandapis
from dataandapis import DataAndApis

client = DataAndApis()  # reads DATAANDAPIS_API_KEY

data = client.hospitals.get_hospital(ccn="050625")
Example response
{
  "ccn": "050625",
  "name": "CEDARS-SINAI MEDICAL CENTER",
  "address": {
    "street": "8700 BEVERLY BLVD",
    "city": "LOS ANGELES",
    "state": "CA",
    "zip": "90048",
    "county": "LOS ANGELES"
  },
  "phone": "(310) 423-3277",
  "type": "Acute Care Hospitals",
  "ownership": "Voluntary non-profit - Private",
  "emergencyServices": true,
  "overallRating": 5,
  "latitude": 34.0757,
  "longitude": -118.3803,
  "beds": 886,
  "birthingFriendly": true,
  "measureGroups": {
    "mortality": {
      "measures": 8,
      "better": 3,
      "no_different": 5,
      "worse": 0
    },
    "safety": {
      "measures": 8,
…
Show full response
{
  "ccn": "050625",
  "name": "CEDARS-SINAI MEDICAL CENTER",
  "address": {
    "street": "8700 BEVERLY BLVD",
    "city": "LOS ANGELES",
    "state": "CA",
    "zip": "90048",
    "county": "LOS ANGELES"
  },
  "phone": "(310) 423-3277",
  "type": "Acute Care Hospitals",
  "ownership": "Voluntary non-profit - Private",
  "emergencyServices": true,
  "overallRating": 5,
  "latitude": 34.0757,
  "longitude": -118.3803,
  "beds": 886,
  "birthingFriendly": true,
  "measureGroups": {
    "mortality": {
      "measures": 8,
      "better": 3,
      "no_different": 5,
      "worse": 0
    },
    "safety": {
      "measures": 8,
      "better": 4,
      "no_different": 4,
      "worse": 0
    },
    "readmission": {
      "measures": 11,
      "better": 2,
      "no_different": 8,
      "worse": 1
    },
    "patient_experience": {
      "measures": 15,
      "better": null,
      "no_different": null,
      "worse": null
    },
    "timely_effective": {
      "measures": 9,
      "better": null,
      "no_different": null,
      "worse": null
    }
  },
  "trauma": "LEVEL I",
  "helipad": true,
  "website": "https://www.cedars-sinai.org",
  "countyFips": "06037",
  "facilityOwner": "NON-PROFIT",
  "geoMatched": true
}

GETHospital Types

https://api-hospitals.dataandapis.com/v1/hospitals/types

This endpoint takes no parameters.

Example request

curl
curl "https://api-hospitals.dataandapis.com/v1/hospitals/types" \
  -H "X-Api-Key: YOUR_API_KEY"
JavaScript / TypeScript (dataandapis package)
// npm install dataandapis
import { DataAndApis } from "dataandapis";

const client = new DataAndApis(); // reads DATAANDAPIS_API_KEY

const data = await client.hospitals.hospitalTypes();
Python (dataandapis package)
# pip install dataandapis
from dataandapis import DataAndApis

client = DataAndApis()  # reads DATAANDAPIS_API_KEY

data = client.hospitals.hospital_types()
Example response
{
  "count": 8,
  "types": [
    {
      "type": "Acute Care Hospitals",
      "count": 3107
    },
    {
      "type": "Critical Access Hospitals",
      "count": 1382
    },
    {
      "type": "Psychiatric",
      "count": 624
    }
  ]
}

GETHospitals By State

https://api-hospitals.dataandapis.com/v1/hospitals/states

This endpoint takes no parameters.

Example request

curl
curl "https://api-hospitals.dataandapis.com/v1/hospitals/states" \
  -H "X-Api-Key: YOUR_API_KEY"
JavaScript / TypeScript (dataandapis package)
// npm install dataandapis
import { DataAndApis } from "dataandapis";

const client = new DataAndApis(); // reads DATAANDAPIS_API_KEY

const data = await client.hospitals.hospitalsByState();
Python (dataandapis package)
# pip install dataandapis
from dataandapis import DataAndApis

client = DataAndApis()  # reads DATAANDAPIS_API_KEY

data = client.hospitals.hospitals_by_state()
Example response
{
  "count": 56,
  "states": [
    {
      "state": "TX",
      "count": 467,
      "avgRating": 3.38
    },
    {
      "state": "CA",
      "count": 377,
      "avgRating": 3.1
    },
    {
      "state": "FL",
      "count": 221,
      "avgRating": 3.06
    }
  ]
}

GETList Hospitals

https://api-hospitals.dataandapis.com/v1/hospitals

Query parameters

ParameterExample
cityLos AngelesOptional
countyLos AngelesOptional
emergencytrueOptional
limit20Optional
minRating4Optional
ownershipVoluntary non-profitOptional
page1Optional
qcedarsOptional
ratedtrueOptional
stateCAOptional
traumatrueOptional
typeAcute CareOptional
zip90048Optional

Example request

curl
curl "https://api-hospitals.dataandapis.com/v1/hospitals?city=Los%20Angeles&county=Los%20Angeles&emergency=true&limit=20&minRating=4&ownership=Voluntary%20non-profit&page=1&q=cedars&rated=true&state=CA&trauma=true&type=Acute%20Care&zip=90048" \
  -H "X-Api-Key: YOUR_API_KEY"
JavaScript / TypeScript (dataandapis package)
// npm install dataandapis
import { DataAndApis } from "dataandapis";

const client = new DataAndApis(); // reads DATAANDAPIS_API_KEY

const data = await client.hospitals.listHospitals({
  city: "Los Angeles",
  county: "Los Angeles",
  emergency: true,
  limit: 20,
  minRating: 4,
  ownership: "Voluntary non-profit",
  page: 1,
  q: "cedars",
  rated: true,
  state: "CA",
  trauma: true,
  type: "Acute Care",
  zip: 90048,
});
Python (dataandapis package)
# pip install dataandapis
from dataandapis import DataAndApis

client = DataAndApis()  # reads DATAANDAPIS_API_KEY

data = client.hospitals.list_hospitals(
    city="Los Angeles",
    county="Los Angeles",
    emergency=True,
    limit=20,
    minRating=4,
    ownership="Voluntary non-profit",
    page=1,
    q="cedars",
    rated=True,
    state="CA",
    trauma=True,
    type="Acute Care",
    zip=90048,
)
Example response
{
  "total": 284,
  "page": 1,
  "limit": 20,
  "count": 1,
  "results": [
    {
      "ccn": "050625",
      "name": "CEDARS-SINAI MEDICAL CENTER",
      "address": {
        "street": "8700 BEVERLY BLVD",
        "city": "LOS ANGELES",
        "state": "CA",
        "zip": "90048",
        "county": "LOS ANGELES"
      },
      "phone": "(310) 423-3277",
      "type": "Acute Care Hospitals",
      "ownership": "Voluntary non-profit - Private",
      "emergencyServices": true,
      "overallRating": 5,
      "latitude": 34.0757,
      "longitude": -118.3803,
      "beds": 886
    }
  ]
}

GETNearby Hospitals

https://api-hospitals.dataandapis.com/v1/hospitals/nearby

Query parameters

ParameterExample
emergencytrueOptional
lat34.0522Required
limit10Optional
lon-118.2437Required
radius25Optional

Example request

curl
curl "https://api-hospitals.dataandapis.com/v1/hospitals/nearby?emergency=true&lat=34.0522&limit=10&lon=-118.2437&radius=25" \
  -H "X-Api-Key: YOUR_API_KEY"
JavaScript / TypeScript (dataandapis package)
// npm install dataandapis
import { DataAndApis } from "dataandapis";

const client = new DataAndApis(); // reads DATAANDAPIS_API_KEY

const data = await client.hospitals.nearbyHospitals({
  emergency: true,
  lat: 34.0522,
  limit: 10,
  lon: -118.2437,
  radius: 25,
});
Python (dataandapis package)
# pip install dataandapis
from dataandapis import DataAndApis

client = DataAndApis()  # reads DATAANDAPIS_API_KEY

data = client.hospitals.nearby_hospitals(
    emergency=True,
    lat=34.0522,
    limit=10,
    lon=-118.2437,
    radius=25,
)
Example response
{
  "lat": 34.0522,
  "lon": -118.2437,
  "radiusKm": 10,
  "count": 2,
  "results": [
    {
      "ccn": "050149",
      "name": "CALIFORNIA HOSPITAL MEDICAL CENTER",
      "distanceKm": 2.6,
      "emergencyServices": true,
      "overallRating": 2,
      "beds": 318
    },
    {
      "ccn": "050557",
      "name": "EAST LOS ANGELES DOCTORS HOSPITAL",
      "distanceKm": 6.3,
      "emergencyServices": true,
      "overallRating": 3,
      "beds": 127
    }
  ]
}

GETRandom Hospitals

https://api-hospitals.dataandapis.com/v1/hospitals/random

Query parameters

ParameterExample
amount3Optional

Example request

curl
curl "https://api-hospitals.dataandapis.com/v1/hospitals/random?amount=3" \
  -H "X-Api-Key: YOUR_API_KEY"
JavaScript / TypeScript (dataandapis package)
// npm install dataandapis
import { DataAndApis } from "dataandapis";

const client = new DataAndApis(); // reads DATAANDAPIS_API_KEY

const data = await client.hospitals.randomHospitals({ amount: 3 });
Python (dataandapis package)
# pip install dataandapis
from dataandapis import DataAndApis

client = DataAndApis()  # reads DATAANDAPIS_API_KEY

data = client.hospitals.random_hospitals(amount=3)
Example response
{
  "count": 2,
  "results": [
    {
      "ccn": "450054",
      "name": "BAYLOR UNIVERSITY MEDICAL CENTER",
      "address": {
        "city": "DALLAS",
        "state": "TX"
      },
      "type": "Acute Care Hospitals",
      "overallRating": 4
    },
    {
      "ccn": "141322",
      "name": "SARAH BUSH LINCOLN HEALTH CENTER",
      "address": {
        "city": "MATTOON",
        "state": "IL"
      },
      "type": "Critical Access Hospitals",
      "overallRating": null
    }
  ]
}

Where the data comes from

Source
CMS Hospital Compare general information and ratings, enriched with the DHS HIFLD hospitals layer for coordinates, beds, trauma level and helipad.
Freshness
CMS data re-synced daily. Geographic enrichment from the HIFLD release.

One install. Every endpoint.

Install the dataandapis package from npm or PyPI and call this API with typed methods, or use any HTTP client in the language you prefer.

4languages
6endpoints
RESTarchitecture
1key for all APIs
  • Typed parameters and responses, with auto-completion in your editor
  • For Node.js 18 or later and Python 3.9 or later, with no dependencies
  • One key works across 125+ APIs on the platform

Read the npm package guide →Read the Python package guide →

// npm install dataandapis
import { DataAndApis } from "dataandapis";

const client = new DataAndApis(); // reads DATAANDAPIS_API_KEY

const data = await client.hospitals.getHospital({ ccn: "050625" });

Hospitals API · X-Api-Key

Explore the endpoints

Browse request parameters and inspect live example responses.

Available Endpoints

Request Parameters

API URL

Headers

X-Api-Key

Path Parameters

ccn
// npm install dataandapis
import { DataAndApis } from "dataandapis";

const client = new DataAndApis({ apiKey: "YOUR_API_KEY" });

const data = await client.hospitals.getHospital({ ccn: "050625" });

One subscription. Every API.

Tokens unlock this API and 125+ others on DataAndAPIs. Switch APIs any time — we promote.

FREE

$0/mo

500 tokens / month

  • Access to all APIs
  • Tokens reset monthly
  • Community support
Start free
Most Popular

STARTER

$6.99/mo

25,000 tokens / month

  • Access to all APIs
  • Tokens reset monthly
  • Email support
Subscribe

PRO

$24.99/mo

100,000 tokens / month

  • Access to all APIs
  • Tokens reset monthly
  • Priority email support
Subscribe

ULTRA

$99.99/mo

1,000,000 tokens / month

  • Access to all APIs
  • Tokens reset monthly
  • Priority support
Subscribe

Need higher volume, dedicated infra, or a custom contract? Talk to sales →

Questions about Hospitals API

Ship Hospitals API this afternoon.

500 free tokens. No card. Plus 125+ other APIs on the same key.