{
  "openapi": "3.1.0",
  "info": {
    "title": "Hospitals API",
    "version": "1.0.0",
    "description": "5,419 Medicare-certified US hospitals with CMS star ratings, emergency services and coordinates.\n\nUS 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.",
    "contact": {
      "name": "Data and APIs",
      "url": "https://dataandapis.com/contact"
    },
    "termsOfService": "https://dataandapis.com/terms-of-service",
    "license": {
      "name": "Data and APIs Terms of Service",
      "url": "https://dataandapis.com/terms-of-service"
    },
    "x-logo": {
      "url": "https://dataandapis.com/images/hospitals.webp"
    }
  },
  "externalDocs": {
    "description": "Documentation, live tester and pricing",
    "url": "https://dataandapis.com/apis/hospitals"
  },
  "servers": [
    {
      "url": "https://api-hospitals.dataandapis.com"
    }
  ],
  "tags": [
    {
      "name": "Data",
      "description": "Hospitals API belongs to the Data category of the Data and APIs catalog."
    }
  ],
  "paths": {
    "/v1/hospitals/{ccn}": {
      "get": {
        "operationId": "getHospital",
        "summary": "Get Hospital",
        "description": "Get Hospital endpoint of the Hospitals API. Costs 1 token per call.",
        "externalDocs": {
          "url": "https://dataandapis.com/apis/hospitals/get-hospital"
        },
        "parameters": [
          {
            "name": "ccn",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "050625"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                },
                "example": {
                  "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
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key"
          },
          "402": {
            "description": "Subscription past due; the response carries a payment_url"
          },
          "429": {
            "description": "Monthly token allowance exhausted"
          }
        },
        "security": [
          {
            "ApiKey": []
          }
        ]
      }
    },
    "/v1/hospitals/types": {
      "get": {
        "operationId": "hospitalTypes",
        "summary": "Hospital Types",
        "description": "Hospital Types endpoint of the Hospitals API. Costs 1 token per call.",
        "externalDocs": {
          "url": "https://dataandapis.com/apis/hospitals/hospital-types"
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                },
                "example": {
                  "count": 8,
                  "types": [
                    {
                      "type": "Acute Care Hospitals",
                      "count": 3107
                    },
                    {
                      "type": "Critical Access Hospitals",
                      "count": 1382
                    },
                    {
                      "type": "Psychiatric",
                      "count": 624
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key"
          },
          "402": {
            "description": "Subscription past due; the response carries a payment_url"
          },
          "429": {
            "description": "Monthly token allowance exhausted"
          }
        },
        "security": [
          {
            "ApiKey": []
          }
        ]
      }
    },
    "/v1/hospitals/states": {
      "get": {
        "operationId": "hospitalsByState",
        "summary": "Hospitals By State",
        "description": "Hospitals By State endpoint of the Hospitals API. Costs 1 token per call.",
        "externalDocs": {
          "url": "https://dataandapis.com/apis/hospitals/hospitals-by-state"
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                },
                "example": {
                  "count": 56,
                  "states": [
                    {
                      "state": "TX",
                      "count": 467,
                      "avgRating": 3.38
                    },
                    {
                      "state": "CA",
                      "count": 377,
                      "avgRating": 3.1
                    },
                    {
                      "state": "FL",
                      "count": 221,
                      "avgRating": 3.06
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key"
          },
          "402": {
            "description": "Subscription past due; the response carries a payment_url"
          },
          "429": {
            "description": "Monthly token allowance exhausted"
          }
        },
        "security": [
          {
            "ApiKey": []
          }
        ]
      }
    },
    "/v1/hospitals": {
      "get": {
        "operationId": "listHospitals",
        "summary": "List Hospitals",
        "description": "List Hospitals endpoint of the Hospitals API. Costs 1 token per call.",
        "externalDocs": {
          "url": "https://dataandapis.com/apis/hospitals/list-hospitals"
        },
        "parameters": [
          {
            "name": "city",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "example": "Los Angeles"
          },
          {
            "name": "county",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "example": "Los Angeles"
          },
          {
            "name": "emergency",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "example": "true"
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "example": "20"
          },
          {
            "name": "minRating",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "example": "4"
          },
          {
            "name": "ownership",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "example": "Voluntary non-profit"
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "example": "1"
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "example": "cedars"
          },
          {
            "name": "rated",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "example": "true"
          },
          {
            "name": "state",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "example": "CA"
          },
          {
            "name": "trauma",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "example": "true"
          },
          {
            "name": "type",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "example": "Acute Care"
          },
          {
            "name": "zip",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "example": "90048"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                },
                "example": {
                  "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
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key"
          },
          "402": {
            "description": "Subscription past due; the response carries a payment_url"
          },
          "429": {
            "description": "Monthly token allowance exhausted"
          }
        },
        "security": [
          {
            "ApiKey": []
          }
        ]
      }
    },
    "/v1/hospitals/nearby": {
      "get": {
        "operationId": "nearbyHospitals",
        "summary": "Nearby Hospitals",
        "description": "Nearby Hospitals endpoint of the Hospitals API. Costs 1 token per call.",
        "externalDocs": {
          "url": "https://dataandapis.com/apis/hospitals/nearby-hospitals"
        },
        "parameters": [
          {
            "name": "emergency",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "example": "true"
          },
          {
            "name": "lat",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "34.0522"
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "example": "10"
          },
          {
            "name": "lon",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "-118.2437"
          },
          {
            "name": "radius",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "example": "25"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                },
                "example": {
                  "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
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key"
          },
          "402": {
            "description": "Subscription past due; the response carries a payment_url"
          },
          "429": {
            "description": "Monthly token allowance exhausted"
          }
        },
        "security": [
          {
            "ApiKey": []
          }
        ]
      }
    },
    "/v1/hospitals/random": {
      "get": {
        "operationId": "randomHospitals",
        "summary": "Random Hospitals",
        "description": "Random Hospitals endpoint of the Hospitals API. Costs 1 token per call.",
        "externalDocs": {
          "url": "https://dataandapis.com/apis/hospitals/random-hospitals"
        },
        "parameters": [
          {
            "name": "amount",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "example": "3"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                },
                "example": {
                  "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
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key"
          },
          "402": {
            "description": "Subscription past due; the response carries a payment_url"
          },
          "429": {
            "description": "Monthly token allowance exhausted"
          }
        },
        "security": [
          {
            "ApiKey": []
          }
        ]
      }
    }
  },
  "components": {
    "securitySchemes": {
      "ApiKey": {
        "type": "apiKey",
        "in": "header",
        "name": "X-Api-Key",
        "description": "Create a free key at https://dataandapis.com/sign-up. 500 tokens a month on the Free plan; this API costs 1 token per call."
      }
    }
  },
  "security": [
    {
      "ApiKey": []
    }
  ]
}