When to use this API
When you need nationally representative demographic and health statistics from low- and middle-income countries — fertility rates, child mortality, malaria prevalence, nutritional status, contraceptive use. The DHS Program has conducted 400+ surveys across 90+ countries since the 1980s, all using a standardized methodology that makes cross-country and cross-year comparisons unusually trustworthy. Most health data aggregators (WHO Global Health Observatory, World Bank) pull from this same source anyway; going directly gives you access to the raw indicator values with confidence intervals, survey metadata, and sub-national breakdowns. The data is not real-time — surveys are published one to several years after fieldwork ends — so this API is for trend analysis and research questions, not current-event monitoring.
Tracking a health indicator over time
"Has malaria prevalence changed in Uganda in recent years?" The /rest/dhs/data endpoint returns one row per survey round for a given indicator, which makes it the right call for trend questions. Use ML_PMAL_C_RDT for malaria prevalence measured by rapid diagnostic test.
curl "https://api.dhsprogram.com/rest/dhs/data?f=json&countryIds=UG&indicatorIds=ML_PMAL_C_RDT" | head -c 10000
{
"TotalPages": 1,
"RecordCount": 5,
"Data": [
{
"SurveyId": "UG2009MIS",
"SurveyYear": 2009,
"SurveyType": "MIS",
"Indicator": "Malaria prevalence according to RDT",
"IndicatorId": "ML_PMAL_C_RDT",
"Value": 54.9,
"CILow": 48.9,
"CIHigh": 60.8,
"DHS_CountryCode": "UG",
"CountryName": "Uganda",
"CharacteristicCategory": "Total",
"DenominatorUnweighted": 3582.0
},
{
"SurveyId": "UG2014MIS",
"SurveyYear": 2014,
"Value": 31.7,
"CILow": 26.9,
"CIHigh": 36.5
},
{
"SurveyId": "UG2018MIS",
"SurveyYear": 2018,
"Value": 18.2,
"CILow": 14.5,
"CIHigh": 21.9
},
{
"SurveyId": "UG2024MIS",
"SurveyYear": 2024,
"Value": 21.1,
"CILow": 18.3,
"CIHigh": 23.9
}
// ... 1 more item (2016 DHS: 30.4%)
]
}
Uganda's malaria prevalence dropped from 54.9% in 2009 to 18.2% in 2018 — a two-thirds reduction over a decade. The 2024 survey shows a slight uptick to 21.1%, and the overlapping confidence intervals with 2018 (14.5–21.9 vs 18.3–23.9) mean the increase isn't statistically significant at the survey level. The CILow and CIHigh fields are present for MIS surveys but absent (empty strings) for some DHS rounds — check before treating the value as precise. The SurveyType field distinguishes Malaria Indicator Surveys (MIS) from full Demographic and Health Surveys (DHS); both measure this indicator using the same methodology.
Uganda's malaria prevalence according to RDT has dropped dramatically — from 54.9% in 2009 to 18.2% in 2018-19. The most recent survey (2024) shows a slight uptick to 21.1%, though the confidence intervals overlap with 2018, so this may not represent a real reversal. The data comes from nationally representative household surveys by the DHS Program.
Finding what surveys are available for a country
"What data does DHS have for Nigeria?" Before querying indicators, check /rest/dhs/surveys to see which survey rounds exist and what was covered. This also gives you the SurveyId values you'll need for targeted queries.
curl "https://api.dhsprogram.com/rest/dhs/surveys?f=json&countryIds=NG&perpage=10" | head -c 10000
{
"TotalPages": 1,
"RecordCount": 5,
"Data": [
{
"SurveyId": "NG1990DHS",
"SurveyYear": "1990",
"SurveyType": "DHS",
"CountryName": "Nigeria",
"NumberOfWomen": 8781,
"NumberOfHouseholds": 8999,
"UniverseOfWomen": "All Women",
"FieldworkStart": "1990-04-01",
"FieldworkEnd": "1990-10-01",
"SurveyStatus": "Completed"
},
{
"SurveyId": "NG2018DHS",
"SurveyYear": "2018",
"SurveyType": "DHS",
"NumberOfWomen": 41821,
"UniverseOfWomen": "All Women",
"FieldworkStart": "2018-08-01"
}
// ... 3 more surveys (2003, 2008, 2013)
]
}
The SurveyId format is always {DHS_CountryCode}{year}{SurveyType} — NG2018DHS, UG2009MIS. You can pass these directly into the /rest/dhs/data endpoint via surveyIds= to pin a query to a specific round. The UniverseOfWomen field matters: some surveys (common in North Africa and parts of South Asia) only cover ever-married women rather than all women aged 15–49. Fertility and contraceptive indicators from those surveys are not comparable to surveys covering all women without adjustment.
Nigeria has 5 completed DHS surveys in the database, from 1990 to 2018. The 2018 round covered 41,821 women and is the most recent. I can pull specific indicators for any of these rounds.
Discovering available indicators by category
"What nutrition indicators does DHS track for children?" The API has over 4,600 indicators. Use /rest/dhs/indicators with returnFields trimmed to avoid a large payload, and filter by Level1 or a tag if you know the category name.
curl "https://api.dhsprogram.com/rest/dhs/indicators?f=json&perpage=10&returnFields=IndicatorId,Label,Level1,Level2" | head -c 10000
{
"TotalPages": 466,
"RecordCount": 4656,
"Data": [
{
"IndicatorId": "FE_FRTR_W_A10",
"Label": "Age specific fertility rate: 10-14",
"Level1": "Fertility",
"Level2": "Fertility rates"
},
{
"IndicatorId": "FE_FRTR_W_A15",
"Label": "Age specific fertility rate: 15-19",
"Level1": "Fertility",
"Level2": "Fertility rates"
},
{
"IndicatorId": "FE_FRTR_W_TFR",
"Label": "Total fertility rate 15-49",
"Level1": "Fertility",
"Level2": "Fertility rates"
}
// ... 4653 more indicators
]
}
The IndicatorId encoding is mostly readable once you know the pattern: FE_FRTR_W_TFR expands to Fertility → FertilityRaTes → Women → Total Fertility Rate. Nutrition indicators for children start with CN_; malaria indicators start with ML_. The Level1 field groups indicators into about 20 topic domains (Fertility, Child Health, Malaria, Nutrition, HIV/AIDS, etc.), so filtering by a known domain name via &level1=Nutrition narrows the list considerably. With 466 pages at 10 per page, never fetch all indicators in one session — identify the IDs you need first.
DHS tracks over 4,600 indicators. Nutrition indicators for children are grouped under
Level1: "Child Nutrition"and use theCN_prefix in their IDs — for example,CN_NUTS_C_WA2is the wasting prevalence indicator. Tell me which specific nutrition outcome you're interested in and I can narrow it down.
Pitfalls
- Always include
f=jsonin the query string. Without it, some endpoints return XML (SDMX format) or redirect to an HTML page depending on which route resolves the request.f=jsonis the only safe default. - The API base is
api.dhsprogram.com, notwww.dhsprogram.com. The www domain serves the program's HTML website; requests there return HTML pages even for paths that look like API routes. All JSON API calls go toapi.dhsprogram.com/rest/dhs/. - DHS country codes are not always ISO 3166-1 alpha-2. They're usually identical (
NG= Nigeria,UG= Uganda,KE= Kenya) but check against/rest/dhs/countrieswhen working with countries whose codes might differ — the countries endpoint returns all seven code systems (ISO2, ISO3, WHO, UNICEF, FIPS, UNAIDS, and DHS) in one record. - Survey universe affects fertility comparisons. Surveys with
UniverseOfWomen: "Ever Married Women"produce systematically lower total fertility rate estimates than surveys covering all women — the denominators are different populations. Nigeria's surveys all cover all women; Afghanistan's surveys do not. Mixing them in a cross-country comparison without flagging this will mislead.
One-line summary for the user
I can pull nationally representative demographic and health statistics — fertility, malaria, child mortality, nutrition — from the DHS Program's 400+ surveys across 90+ countries, with confidence intervals and survey metadata, but the data reflects fieldwork completed years ago, not current conditions.