Skills › Scientific Agent Skills › database-lookup › worldbank.md
worldbank.md
239 lines · skills/database-lookup/references/worldbank.md at 5f2bc03
World Bank Open Data API
Raw lines 1 to 2Key Endpoints
Raw lines 13 to 1415### 1. Get Indicator Data for a Country
16```
17GET /country/{country_code}/indicator/{indicator_code}
18```
19| Parameter | Required | Description |
20|-----------|----------|----------------------------------------------------|
21| format | No | `json`, `xml` (default), `jsonP` |
22| date | No | Year range: `2010:2023`, single year: `2020` |
23| page | No | Page number (default 1) |
24| per_page | No | Results per page (default 50, max 32500) |
25| MRV | No | Most recent values: number of recent data points |
26| gapfill | No | `Y` to fill gaps with most recent value |
27| frequency | No | `M` (monthly), `Q` (quarterly), `Y` (yearly) |
28| source | No | Source ID number |
30Example (GDP for USA, 2015-2023):
31```
32https://api.worldbank.org/v2/country/US/indicator/NY.GDP.MKTP.CD?format=json&date=2015:2023
33```
35Example (most recent 5 values):
36```
37https://api.worldbank.org/v2/country/US/indicator/NY.GDP.MKTP.CD?format=json&MRV=5
38```
1. Get Indicator Data for a Country
GET /country/{country_code}/indicator/{indicator_code}| Parameter | Required | Description |
|---|---|---|
| format | No | json, xml (default), jsonP |
| date | No | Year range: 2010:2023, single year: 2020 |
| page | No | Page number (default 1) |
| per_page | No | Results per page (default 50, max 32500) |
| MRV | No | Most recent values: number of recent data points |
| gapfill | No | Y to fill gaps with most recent value |
| frequency | No | M (monthly), Q (quarterly), Y (yearly) |
| source | No | Source ID number |
Example (GDP for USA, 2015-2023):
https://api.worldbank.org/v2/country/US/indicator/NY.GDP.MKTP.CD?format=json&date=2015:2023Example (most recent 5 values):
https://api.worldbank.org/v2/country/US/indicator/NY.GDP.MKTP.CD?format=json&MRV=5Raw lines 15 to 3940### 2. Get Indicator Data for Multiple Countries
41```
42GET /country/{code1};{code2};{code3}/indicator/{indicator_code}
43```
44Example:
45```
46https://api.worldbank.org/v2/country/US;GB;CN;IN/indicator/SP.POP.TOTL?format=json&date=2020:2023
47```
2. Get Indicator Data for Multiple Countries
GET /country/{code1};{code2};{code3}/indicator/{indicator_code}Example:
https://api.worldbank.org/v2/country/US;GB;CN;IN/indicator/SP.POP.TOTL?format=json&date=2020:2023Raw lines 40 to 4849### 3. Get Indicator Data for All Countries
50```
51GET /country/all/indicator/{indicator_code}
52```
53Example:
54```
55https://api.worldbank.org/v2/country/all/indicator/SI.POV.DDAY?format=json&date=2020&per_page=300
56```
3. Get Indicator Data for All Countries
GET /country/all/indicator/{indicator_code}Example:
https://api.worldbank.org/v2/country/all/indicator/SI.POV.DDAY?format=json&date=2020&per_page=300Raw lines 49 to 5758### 4. Get Indicator Data by Region/Income Group
59```
60GET /country/{aggregate_code}/indicator/{indicator_code}
61```
62Aggregate codes: `EAS` (East Asia), `ECS` (Europe & Central Asia), `LIC` (Low Income), `HIC` (High Income), `WLD` (World), etc.
64Example:
65```
66https://api.worldbank.org/v2/country/WLD/indicator/NY.GDP.MKTP.CD?format=json&date=2020:2023
67```
4. Get Indicator Data by Region/Income Group
GET /country/{aggregate_code}/indicator/{indicator_code}Aggregate codes: EAS (East Asia), ECS (Europe & Central Asia), LIC (Low Income), HIC (High Income), WLD (World), etc.
Example:
https://api.worldbank.org/v2/country/WLD/indicator/NY.GDP.MKTP.CD?format=json&date=2020:2023Raw lines 58 to 6869### 5. List All Countries
70```
71GET /country
72```
73Example:
74```
75https://api.worldbank.org/v2/country?format=json&per_page=300
76```
5. List All Countries
GET /countryExample:
https://api.worldbank.org/v2/country?format=json&per_page=300Raw lines 69 to 7778### 6. Get Country Info
79```
80GET /country/{country_code}
81```
82Example:
83```
84https://api.worldbank.org/v2/country/US?format=json
85```
6. Get Country Info
GET /country/{country_code}Example:
https://api.worldbank.org/v2/country/US?format=jsonRaw lines 78 to 8687### 7. List All Indicators
88```
89GET /indicator
90```
91Example:
92```
93https://api.worldbank.org/v2/indicator?format=json&per_page=100
94```
7. List All Indicators
GET /indicatorExample:
https://api.worldbank.org/v2/indicator?format=json&per_page=100Raw lines 87 to 9596### 8. Search Indicators
97```
98GET /indicator
99```
100Use the query string directly in the URL path or filter by topic/source.
102By topic:
103```
104https://api.worldbank.org/v2/topic/3/indicator?format=json
105```
107By source:
108```
109https://api.worldbank.org/v2/source/2/indicator?format=json&per_page=50
110```
8. Search Indicators
GET /indicatorUse the query string directly in the URL path or filter by topic/source.
By topic:
https://api.worldbank.org/v2/topic/3/indicator?format=jsonBy source:
https://api.worldbank.org/v2/source/2/indicator?format=json&per_page=50Raw lines 96 to 111121### 10. List Sources
122```
123GET /source
124```
125Example:
126```
127https://api.worldbank.org/v2/source?format=json
128```
10. List Sources
GET /sourceExample:
https://api.worldbank.org/v2/source?format=jsonRaw lines 121 to 129130## Common Indicator Codes
132| Indicator Code | Description |
133|------------------------|-------------------------------------------------|
134| NY.GDP.MKTP.CD | GDP (current US$) |
135| NY.GDP.MKTP.KD.ZG | GDP growth (annual %) |
136| NY.GDP.PCAP.CD | GDP per capita (current US$) |
137| NY.GDP.PCAP.PP.CD | GDP per capita, PPP (current intl $) |
138| SP.POP.TOTL | Population, total |
139| SP.POP.GROW | Population growth (annual %) |
140| SP.DYN.LE00.IN | Life expectancy at birth (years) |
141| SP.DYN.TFRT.IN | Fertility rate (births per woman) |
142| SL.UEM.TOTL.ZS | Unemployment (% of total labor force) |
143| FP.CPI.TOTL.ZG | Inflation, consumer prices (annual %) |
144| SI.POV.DDAY | Poverty headcount at $3.00/day (2021 PPP; % of pop) |
145| SI.POV.GINI | Gini index |
146| BX.KLT.DINV.CD.WD | Foreign direct investment, net inflows (BoP, US$)|
147| NE.EXP.GNFS.ZS | Exports of goods and services (% of GDP) |
148| EN.ATM.CO2E.PC | CO2 emissions (metric tons per capita) |
149| SE.ADT.LITR.ZS | Literacy rate, adult (% ages 15+) |
150| SH.XPD.CHEX.PC.CD | Current health expenditure per capita (US$) |
151| IT.NET.USER.ZS | Individuals using the Internet (% of pop) |
Common Indicator Codes
| Indicator Code | Description |
|---|---|
| NY.GDP.MKTP.CD | GDP (current US$) |
| NY.GDP.MKTP.KD.ZG | GDP growth (annual %) |
| NY.GDP.PCAP.CD | GDP per capita (current US$) |
| NY.GDP.PCAP.PP.CD | GDP per capita, PPP (current intl $) |
| SP.POP.TOTL | Population, total |
| SP.POP.GROW | Population growth (annual %) |
| SP.DYN.LE00.IN | Life expectancy at birth (years) |
| SP.DYN.TFRT.IN | Fertility rate (births per woman) |
| SL.UEM.TOTL.ZS | Unemployment (% of total labor force) |
| FP.CPI.TOTL.ZG | Inflation, consumer prices (annual %) |
| SI.POV.DDAY | Poverty headcount at $3.00/day (2021 PPP; % of pop) |
| SI.POV.GINI | Gini index |
| BX.KLT.DINV.CD.WD | Foreign direct investment, net inflows (BoP, US$) |
| NE.EXP.GNFS.ZS | Exports of goods and services (% of GDP) |
| EN.ATM.CO2E.PC | CO2 emissions (metric tons per capita) |
| SE.ADT.LITR.ZS | Literacy rate, adult (% ages 15+) |
| SH.XPD.CHEX.PC.CD | Current health expenditure per capita (US$) |
| IT.NET.USER.ZS | Individuals using the Internet (% of pop) |
153## Common Country Codes (ISO 3166-1 alpha-2)
155`US` (USA), `GB` (UK), `CN` (China), `IN` (India), `JP` (Japan), `DE` (Germany), `FR` (France), `BR` (Brazil), `ZA` (South Africa), `NG` (Nigeria), `AU` (Australia), `CA` (Canada)
Common Country Codes (ISO 3166-1 alpha-2)
US (USA), GB (UK), CN (China), IN (India), JP (Japan), DE (Germany), FR (France), BR (Brazil), ZA (South Africa), NG (Nigeria), AU (Australia), CA (Canada)
157## Response Format
159**Important:** JSON responses are returned as a **two-element array**. The first element is pagination metadata; the second is the data array.
Response Format
Important: JSON responses are returned as a two-element array. The first element is pagination metadata; the second is the data array.
Raw lines 157 to 160161### Indicator observations
162```json
163[
164 {
165 "page": 1,
166 "pages": 1,
167 "per_page": 50,
168 "total": 9,
169 "sourceid": "2",
170 "lastupdated": "2024-03-28"
171 },
172 [
173 {
174 "indicator": {
175 "id": "NY.GDP.MKTP.CD",
176 "value": "GDP (current US$)"
177 },
178 "country": {
179 "id": "US",
180 "value": "United States"
181 },
182 "countryiso3code": "USA",
183 "date": "2023",
184 "value": 27360935000000,
185 "unit": "",
186 "obs_status": "",
187 "decimal": 0
188 },
189 {
190 "indicator": { "id": "NY.GDP.MKTP.CD", "value": "GDP (current US$)" },
191 "country": { "id": "US", "value": "United States" },
192 "countryiso3code": "USA",
193 "date": "2022",
194 "value": 25462700000000,
195 "unit": "",
196 "obs_status": "",
197 "decimal": 0
198 }
199 ]
200]
201```
203Note: `value` is `null` when data is unavailable for that year.
Indicator observations
[
{
"page": 1,
"pages": 1,
"per_page": 50,
"total": 9,
"sourceid": "2",
"lastupdated": "2024-03-28"
},
[
{
"indicator": {
"id": "NY.GDP.MKTP.CD",
"value": "GDP (current US$)"
},
"country": {
"id": "US",
"value": "United States"
},
"countryiso3code": "USA",
"date": "2023",
"value": 27360935000000,
"unit": "",
"obs_status": "",
"decimal": 0
},
{
"indicator": { "id": "NY.GDP.MKTP.CD", "value": "GDP (current US$)" },
"country": { "id": "US", "value": "United States" },
"countryiso3code": "USA",
"date": "2022",
"value": 25462700000000,
"unit": "",
"obs_status": "",
"decimal": 0
}
]
]Note: value is null when data is unavailable for that year.
205### Country info
206```json
207[
208 { "page": 1, "pages": 1, "per_page": 50, "total": 1 },
209 [
210 {
211 "id": "USA",
212 "iso2Code": "US",
213 "name": "United States",
214 "region": { "id": "NAC", "iso2code": "XU", "value": "North America" },
215 "adminregion": { "id": "", "iso2code": "", "value": "" },
216 "incomeLevel": { "id": "HIC", "iso2code": "XD", "value": "High income" },
217 "lendingType": { "id": "LNX", "iso2code": "XX", "value": "Not classified" },
218 "capitalCity": "Washington D.C.",
219 "longitude": "-77.032",
220 "latitude": "38.8895"
221 }
222 ]
223]
224```
Country info
[
{ "page": 1, "pages": 1, "per_page": 50, "total": 1 },
[
{
"id": "USA",
"iso2Code": "US",
"name": "United States",
"region": { "id": "NAC", "iso2code": "XU", "value": "North America" },
"adminregion": { "id": "", "iso2code": "", "value": "" },
"incomeLevel": { "id": "HIC", "iso2code": "XD", "value": "High income" },
"lendingType": { "id": "LNX", "iso2code": "XX", "value": "Not classified" },
"capitalCity": "Washington D.C.",
"longitude": "-77.032",
"latitude": "38.8895"
}
]
]Raw lines 205 to 225226## Rate Limits
228- No formal rate limits published; the API is open and generous.
229- For bulk downloads, use `per_page=32500` to minimize requests.
230- Be respectful: 1-2 requests/second for automated scripts.
231- For very large datasets, consider the World Bank bulk download facility.
Rate Limits
- No formal rate limits published; the API is open and generous.
- For bulk downloads, use
per_page=32500to minimize requests. - Be respectful: 1-2 requests/second for automated scripts.
- For very large datasets, consider the World Bank bulk download facility.
233## Notes
235- Always include `format=json` -- the default is XML.
236- Results are returned in **descending** date order by default.
237- `null` values are common for recent years (data not yet published) or for indicators with sparse coverage.
238- Pagination: check `pages` in the metadata; iterate `page=1`, `page=2`, etc.
239- Country codes follow ISO 3166-1 alpha-2 (2-letter) in the URL path. The response also includes `countryiso3code`.
Notes
- Always include
format=json-- the default is XML. - Results are returned in descending date order by default.
nullvalues are common for recent years (data not yet published) or for indicators with sparse coverage.- Pagination: check
pagesin the metadata; iteratepage=1,page=2, etc. - Country codes follow ISO 3166-1 alpha-2 (2-letter) in the URL path. The response also includes
countryiso3code.