The Hospitals API provides detailed information about hospitals in the United States including location, contact information, bed count, and more.
https://api.api-ninjas.com/v1/hospitals
Get hospital data based on given parameters. Returns a list of hospitals that match the specified criteria.
At least one parameter (other than offset
) must be provided. Free users are limited to 5 results per request. Premium users can use the limit
parameter to get up to 100 results per request and can use the offset
parameter to paginate through more results.
name
optionalName of the hospital to search for. Supports partial matching.
city
optionalCity where the hospital is located.
state
optionalState where the hospital is located.
zipcode
optionalZIP code of the hospital location.
county
optionalCounty where the hospital is located.
min_latitude
optionalMinimum latitude coordinate.
max_latitude
optionalMaximum latitude coordinate.
min_longitude
optionalMinimum longitude coordinate.
max_longitude
optionalMaximum longitude coordinate.
limit
optional Premium OnlyNumber of results to return. Default is 5. Maximum is 100.
offset
optional Premium OnlyNumber of results to skip. Default is 0.
X-Api-Key
requiredAPI Key associated with your account.
https://api.api-ninjas.com/v1/hospitals?name=General Hospital
Headers
X-Api-Key
Log in or sign up to get your API Key
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
[
{
"name": "ROCHESTER GENERAL HOSPITAL",
"care_type": "Acute Care Hospitals",
"address": "1425 Portland Ave",
"city": "Rochester",
"state": "NY",
"zipcode": "14621",
"county": "Monroe",
"location_area_code": "585",
"fips_code": "36055",
"timezone": "EST",
"latitude": "43.1888",
"longitude": "-77.6040",
"phone_number": "(585) 922-4000",
"website": "http://www.viahealth.org/",
"ownership": "Voluntary non-profit - Private",
"bedcount": 398
},
"..."
]
1
2
3
4
5
6
7
8
9
import requests
name = 'General Hospital'
api_url = 'https://api.api-ninjas.com/v1/hospitals?name={}'.format(name)
response = requests.get(api_url, headers={'X-Api-Key': 'YOUR_API_KEY'})
if response.status_code == requests.codes.ok:
print(response.text)
else:
print("Error:", response.status_code, response.text)
If your programming language is not listed in the Code Example above, you can still make API calls by using a HTTP request library written in your programming language and following the above documentation.