TL;DR
The CDC (Centers for Disease Control and Prevention) publishes hundreds of public health datasets through the Socrata open data platform, accessible via a REST API. Data includes chronic disease indicators, immunization coverage, mortality statistics, behavioral risk factors (BRFSS), infectious disease surveillance, and environmental health data. Each dataset has a unique 4-character identifier and supports SoQL (Socrata Query Language) for filtering, aggregation, and sorting.
Quick start: https://data.cdc.gov/resource/hk9y-quqm.json
No API key needed — just make a request!
How to Use This API
1. Query a Dataset
The example dataset hk9y-quqm is a CDC health measure:
https://data.cdc.gov/resource/hk9y-quqm.json?$limit=5
2. Filter by Year
https://data.cdc.gov/resource/hk9y-quqm.json?year=2020&$limit=5
3. JavaScript — Get CDC Data
fetch('https://data.cdc.gov/resource/hk9y-quqm.json?$limit=10')
.then(r => r.json())
.then(d => {
d.forEach(row => {
console.log(JSON.stringify(row));
});
});
4. Python — Aggregate Query
import requests
# Example: query CDC datasets
# First list available datasets
resp = requests.get('https://data.cdc.gov/data.json')
catalog = resp.json()
for ds in catalog['dataset'][:5]:
print(ds['title'], '-', ds.get('identifier', 'No ID'))
# Then query a specific dataset by its identifier
# Replace with actual dataset ID from catalog search
https://data.cdc.gov/resource/hk9y-quqm.json?$limit=3
API Details
- API URL
https://data.cdc.gov/resource- Documentation
- dev.socrata.com
- Category
- Health
- Authentication
- Not Required
- Geographic Coverage
- USA
Frequently Asked Questions
- What types of datasets does the CDC publish?
- Over 400 datasets covering chronic diseases, infectious diseases, immunization, injury, environmental health, reproductive health, and health statistics.
- How do I find dataset IDs?
- Browse data.cdc.gov and note the 4-character identifier in the URL (e.g.,
hk9y-quqm). - What is SoQL?
- Socrata Query Language supports
$select,$where,$order,$group,$limit,$offset, and$qfor full-text search. It is similar to SQL. - Can I get data in CSV format?
- Yes, add
.csvinstead of.jsonto the dataset URL for CSV download. - Is there geographic data?
- Many datasets include state, county, or census tract identifiers. Some include latitude/longitude for point data.
What You Can Build
- Public health trend dashboard by state and year
- Chronic disease prevalence map for grant research
- Immunization rate tracker for school districts
- Mortality statistics analyzer for epidemiology
- Health policy data visualization tool