Skill Tracer
Skills › Scientific Agent Skills › database-lookup › worldbank.md

worldbank.md

239 lines · skills/database-lookup/references/worldbank.md at 5f2bc03

Open on GitHub
1# World Bank Open Data API
2

World Bank Open Data API

Raw lines 1 to 2
3## Base URL
4
5```
6https://api.worldbank.org/v2
7```
8

Base URL

https://api.worldbank.org/v2
Raw lines 3 to 8
9## Authentication
11**No API key required.** The API is fully open.

Authentication

No API key required. The API is fully open.

Raw lines 9 to 12
13## Key Endpoints

Key Endpoints

Raw lines 13 to 14
15### 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}
ParameterRequiredDescription
formatNojson, xml (default), jsonP
dateNoYear range: 2010:2023, single year: 2020
pageNoPage number (default 1)
per_pageNoResults per page (default 50, max 32500)
MRVNoMost recent values: number of recent data points
gapfillNoY to fill gaps with most recent value
frequencyNoM (monthly), Q (quarterly), Y (yearly)
sourceNoSource ID number

Example (GDP for USA, 2015-2023):

https://api.worldbank.org/v2/country/US/indicator/NY.GDP.MKTP.CD?format=json&date=2015:2023

Example (most recent 5 values):

https://api.worldbank.org/v2/country/US/indicator/NY.GDP.MKTP.CD?format=json&MRV=5
Raw lines 15 to 39
40### 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:2023
Raw lines 40 to 48
49### 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=300
Raw lines 49 to 57
58### 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:2023
Raw lines 58 to 68
69### 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 /country

Example:

https://api.worldbank.org/v2/country?format=json&per_page=300
Raw lines 69 to 77
78### 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=json
Raw lines 78 to 86
87### 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 /indicator

Example:

https://api.worldbank.org/v2/indicator?format=json&per_page=100
Raw lines 87 to 95
96### 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 /indicator

Use the query string directly in the URL path or filter by topic/source.

By topic:

https://api.worldbank.org/v2/topic/3/indicator?format=json

By source:

https://api.worldbank.org/v2/source/2/indicator?format=json&per_page=50
Raw lines 96 to 111
112### 9. List Topics
113```
114GET /topic
115```
116Example:
117```
118https://api.worldbank.org/v2/topic?format=json
119```

9. List Topics

GET /topic

Example:

https://api.worldbank.org/v2/topic?format=json
Raw lines 112 to 120
121### 10. List Sources
122```
123GET /source
124```
125Example:
126```
127https://api.worldbank.org/v2/source?format=json
128```

10. List Sources

GET /source

Example:

https://api.worldbank.org/v2/source?format=json
Raw lines 121 to 129
130## 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 CodeDescription
NY.GDP.MKTP.CDGDP (current US$)
NY.GDP.MKTP.KD.ZGGDP growth (annual %)
NY.GDP.PCAP.CDGDP per capita (current US$)
NY.GDP.PCAP.PP.CDGDP per capita, PPP (current intl $)
SP.POP.TOTLPopulation, total
SP.POP.GROWPopulation growth (annual %)
SP.DYN.LE00.INLife expectancy at birth (years)
SP.DYN.TFRT.INFertility rate (births per woman)
SL.UEM.TOTL.ZSUnemployment (% of total labor force)
FP.CPI.TOTL.ZGInflation, consumer prices (annual %)
SI.POV.DDAYPoverty headcount at $3.00/day (2021 PPP; % of pop)
SI.POV.GINIGini index
BX.KLT.DINV.CD.WDForeign direct investment, net inflows (BoP, US$)
NE.EXP.GNFS.ZSExports of goods and services (% of GDP)
EN.ATM.CO2E.PCCO2 emissions (metric tons per capita)
SE.ADT.LITR.ZSLiteracy rate, adult (% ages 15+)
SH.XPD.CHEX.PC.CDCurrent health expenditure per capita (US$)
IT.NET.USER.ZSIndividuals using the Internet (% of pop)
Raw lines 130 to 152
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)

Raw lines 153 to 156
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 160
161### Indicator observations
162```json
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 ]
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.

Raw lines 161 to 204
205### Country info
206```json
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 ]
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 225
226## 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=32500 to minimize requests.
  • Be respectful: 1-2 requests/second for automated scripts.
  • For very large datasets, consider the World Bank bulk download facility.
Raw lines 226 to 232
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.
  • null values are common for recent years (data not yet published) or for indicators with sparse coverage.
  • Pagination: check pages in the metadata; iterate page=1, page=2, etc.
  • Country codes follow ISO 3166-1 alpha-2 (2-letter) in the URL path. The response also includes countryiso3code.
Raw lines 233 to 239