TL;DR
The World Bank Data API provides programmatic access to over 16,000 development indicators spanning 217 countries and regions. Query GDP, population, literacy rates, CO2 emissions, internet users, life expectancy, and thousands more metrics. Data goes back decades, with many indicators updated annually. Returns JSON or XML. Used by economists, researchers, and data journalists worldwide. No API key required.
Quick start: https://api.worldbank.org/v2/country/all/indicator/NY.GDP.MKTP.CD
No API key needed — free global development data!
How to Use This API
1. Get GDP for All Countries
Returns GDP (current US$) for every country, latest data first:
https://api.worldbank.org/v2/country/all/indicator/NY.GDP.MKTP.CD?format=json&per_page=50
2. Get Population Data
https://api.worldbank.org/v2/country/US/indicator/SP.POP.TOTL?format=json
3. Search Indicators
Find indicators related to internet access:
https://api.worldbank.org/v2/indicator?format=json&search=internet
4. JavaScript — Compare Two Countries
async function compareGDP(country1, country2) {
for (const c of [country1, country2]) {
const resp = await fetch(
`https://api.worldbank.org/v2/country/${c}/indicator/NY.GDP.MKTP.CD?format=json&per_page=5`
);
const [, data] = await resp.json();
console.log(`\n${c}:`);
data.forEach(d => console.log(` ${d.date}: $${(d.value/1e9).toFixed(2)}B`));
}
}
compareGDP('US', 'CN');
5. Python — Life Expectancy Trend
import requests
resp = requests.get(
'https://api.worldbank.org/v2/country/BR/indicator/SP.DYN.LE00.IN',
params={'format': 'json', 'per_page': 30}
).json()
for entry in resp[1]:
if entry['value']:
print(f"{entry['date']}: {float(entry['value']):.1f} years")
https://api.worldbank.org/v2/country/US/indicator/SP.POP.TOTL?format=json
Frequently Asked Questions
- How many indicators are available?
- Over 16,000 indicators across 21 topics including agriculture, education, energy, finance, health, infrastructure, poverty, and trade. Use the
/v2/indicatorendpoint to browse them all. - What country codes should I use?
- Use ISO 3166-1 alpha-2 codes (US, GB, BR, IN, CN, etc.). Use
allfor all countries orWLDfor world aggregate. The/v2/countryendpoint lists all available codes. - Can I filter by date range?
- Yes — use the
dateparameter:date=2000:2020returns data between those years. Useper_page(max 1200) andpagefor pagination. - What formats are supported?
- JSON (
?format=json) and XML (default). JSON responses include an array with metadata and data entries. Each data entry containsvalue,date, and metadata likecountryandindicator. - Is the API updated regularly?
- Indicators are updated as new data becomes available, typically annually. The World Bank updates its databases throughout the year as countries submit new statistics.
- Does it include regional aggregates?
- Yes — use codes like
EAS(East Asia),ECS(Europe),LCN(Latin America),MEA(Middle East),NAC(North America),SAS(South Asia), andSSF(Sub-Saharan Africa).
API Details
- API URL
https://api.worldbank.org/v2/- Documentation
- World Bank Data Help Desk
- Category
- Data
- Authentication
- Not Required
- Output Formats
- JSON, XML
What You Can Build
- Economic dashboard comparing GDP growth across countries and regions
- Education statistics explorer showing literacy and enrollment trends
- Health data visualization for life expectancy and mortality metrics
- Climate data analysis combining CO2, energy use, and forest area
- Population projection tool using demographics indicators