World Bank Open Data Access Skill
Overview
This skill provides programmatic access to the World Bank Open Data API, enabling retrieval of development indicators, country statistics, and global economic data. The World Bank's data portal contains over 20,000 indicators covering topics like GDP, population, health, education, environment, and more across 200+ countries spanning 60+ years.
API Details
- Base URL:
https://api.worldbank.org/v2 - Format: JSON (default), XML, and downloadable formats available
- Authentication: Not required for public data
- Rate Limit: Generous limits (unofficially ~10 requests/second)
Key Capabilities
1. Indicator Data Retrieval (get_indicator_data)
Fetch time series data for any indicator across countries and time periods.
Popular Indicators:
| Code | Description |
|---|---|
| NY.GDP.MKTP.CD | GDP (current US$) |
| NY.GDP.PCAP.CD | GDP per capita (current US$) |
| SP.POP.TOTL | Population, total |
| SP.URB.TOTL.IN.ZS | Urban population (% of total) |
| SH.DYN.MORT | Mortality rate, under-5 |
| SE.PRM.ENRR | School enrollment, primary |
| FP.CPI.TOTL.ZG | Inflation, consumer prices |
2. Country Information (get_country, list_countries)
Retrieve metadata for countries including income level, region, capital, and coordinates.
3. Indicator Discovery (search, list_indicators)
Search and browse indicators by keyword, topic, or source.
4. Data Comparison (compare_countries)
Compare indicators across multiple countries in a single query.
Usage Examples
Get GDP Data for a Country
result = execute({
"function": "get_indicator_data",
"indicator_code": "NY.GDP.MKTP.CD",
"countries": "US",
"date": "2020:2024"
})
Compare Multiple Countries
result = execute({
"function": "compare_countries",
"indicator_code": "SP.POP.TOTL",
"countries": ["US", "CN", "IN", "BR"],
"date": "2023"
})
Search for Indicators
result = execute({
"function": "search",
"query": "illiteracy"
})
Get Most Recent Values
result = execute({
"function": "get_indicator_data",
"indicator_code": "SH.DYN.MORT",
"mrv": 5 # Most recent 5 years of data
})
List Countries by Income Level
result = execute({
"function": "list_countries",
"income_level": "HIC" # High Income Countries
})
Response Structure
All API responses follow this format:
[
{
"page": 1,
"pages": 10,
"per_page": 50,
"total": 500
},
[
{ "indicator": {...}, "country": {...}, "date": "2023", "value": 12345.67 },
...
]
]
The first element contains pagination metadata, and the second element is the data array.
Parameter Reference
Country Codes
- ISO2 format:
US,CN,JP,DE,GB,FR,IN,BR - ISO3 format:
USA,CHN,JPN,DEU,GBR,FRA,IND,BRA - Multiple countries: Use semicolon separator (
US;CN;JP) or array - Special values:
allfor all countries/regions
Date Formats
- Single year:
2023 - Year range:
2020:2023 - Most recent N values: Use
mrvparameter instead of date
Income Levels
HIC: High incomeUMC: Upper middle incomeLMC: Lower middle incomeLIC: Low income
Lending Types
IBD: IBRDIDA: IDALNX: Not classified
Common Topics
| ID | Topic |
|---|---|
| 1 | Agriculture & Rural Development |
| 2 | Aid Effectiveness |
| 3 | Economy & Growth |
| 4 | Education |
| 5 | Energy & Mining |
| 6 | Environment |
| 7 | Financial Sector |
| 8 | Gender |
| 9 | Health |
| 11 | Poverty |
| 12 | Private Sector |
| 13 | Public Sector |
| 14 | Science & Technology |
| 15 | Social Development |
| 16 | Social Protection & Labor |
| 19 | Urban Development |
Notes
Null Values: The API returns
nullfor data that is not available for a specific country/year combination.Pagination: For large datasets, use the
fetch_allparameter to automatically retrieve all pages, or manually paginate using thepageparameter.Regional Data: The API includes aggregate data for regions like "Africa Eastern and Southern", "Arab World", "Euro area", etc.
Data Updates: World Bank data is typically updated quarterly with annual releases for major indicators.
Rate Limiting: While the API is generous, implement reasonable delays for bulk requests to avoid rate limiting.
Error Handling
The skill returns structured error responses:
{
"success": false,
"error": "Resource not found",
"status": 404
}
Common errors:
Resource not found(404): Invalid indicator or country codeHTTP 400: Invalid parameter formatRequest failed: Network or timeout issues
Source Data
This skill interfaces with the World Bank Open Data API, which provides data from:
- World Development Indicators (WDI)
- International Debt Statistics
- Gender Statistics
- Education Statistics
- Health Nutrition and Population Statistics
- And 70+ other data sources