- Guides
- World Bank API documentation
World Bank API: how to query indicators, with examples
The World Bank Indicators API is free, needs no API key and lives at https://api.worldbank.org/v2/; for example /v2/country/NO/indicator/SP.POP.TOTL?format=json&date=2024 returns Norway's population for 2024. APIFor serves the World Development Indicators at /v1/indicators if you want them behind the same key and JSON shape as other public data, at 1 credit per request.
Last checked . Service: World development indicators dataset. Reference: endpoint docs.
The official World Bank API in one minute
The World Bank's documentation says the Indicators API gives access to nearly 16,000 time series indicators from over 45 databases, and that API keys are no longer needed. Version 1 was retired in 2018 and switched off in June 2020, so every call needs v2 in the path.
A call is /v2/country/{code}/indicator/{indicator}. Add format=json, because the default is XML. date=2024 or date=2015:2024 limits the years. On 1 Dec 2026, https://api.worldbank.org/v2/country/NO/indicator/SP.POP.TOTL?format=json&date=2024 returned a two-element array: paging metadata first ("lastupdated":"2026-11-11"), then the rows, with "value":5572279 for 2024.
That first element trips people up. The data is in response[1], and you have to follow pages when a query returns more than per_page rows.
Request
Send your key in the x-api-key header. New accounts get 1,000 free requests after email verification; the quickstart takes about a minute.
curl 'https://api.apifor.dev/v1/indicators?country=NO&indicator=SP.POP.TOTL' \
-H 'x-api-key: YOUR_API_KEY'import os
import requests
r = requests.get(
"https://api.apifor.dev/v1/indicators",
params={
"country": "NO",
"indicator": "SP.POP.TOTL",
},
headers={"x-api-key": os.environ["APIFOR_API_KEY"]},
timeout=30,
)
r.raise_for_status()
print(r.json()["data"])const res = await fetch("https://api.apifor.dev/v1/indicators?country=NO&indicator=SP.POP.TOTL", {
headers: { "x-api-key": process.env.APIFOR_API_KEY },
});
const { data } = await res.json();
console.log(data);Response
The OpenAPI example shows the shape with an Aruba row. For Norway, our snapshot holds SP.POP.TOTL 5,610,870 for 2025. The full spec is at api.apifor.dev/v1/openapi.json.
{
"success": true,
"data": [
{
"indicator_code": "AG.LND.FRST.ZS",
"country_iso3": "ABW",
"country_code": "AW",
"name": "Forest area (% of land area)",
"unit": "% of land area",
"year": 2000,
"value": 2.72222222222222
}
]
}The same indicators from APIFor
APIFor holds 298,281 indicator rows for 217 countries and territories from World Development Indicators. Filter by two-letter country, World Bank indicator code, year, or search indicator names with q. The response is the usual { success, data } envelope with one row per country, indicator and year, so there is no metadata element to skip.
Use the official API when World Bank data is all you need; it is free and has every series. APIFor is worth it when you already call it for holidays, postal codes or other data and want one key, or when an AI agent reaches it over the MCP server.
Common indicator codes
SP.POP.TOTL is total population, NY.GDP.MKTP.CD is GDP in current US dollars and SP.DYN.LE00.IN is life expectancy at birth. In our snapshot, Norway's GDP for 2025 is about US$530.8 billion and life expectancy for 2024 is 83.2 years. The World Bank's own indicator list at https://api.worldbank.org/v2/indicator?format=json has the full catalogue.
Errors, limits and cost
A missing or wrong key returns 401, bad parameters return 400 with an error.code, and an unknown id returns 404. Rate limits are per key: a limited request gets 429 with a Retry-After header in seconds, so wait that long and retry. Calls that fail before any work starts are refunded. Details are in errors and rate limits.
This request costs 1 credit. Pricing is prepaid: 1,000 free requests once after email verification, then packs from $5 for 5,000 requests to $149 for 400,000. Credits never expire and there is no subscription. See pricing.
From an AI assistant
The same data is available as a tool on the APIFor MCP server at https://mcp.apifor.dev/mcp. Add it as a remote server in any client that supports remote MCP, sign in with OAuth or send your API key as a Bearer token, and ask in plain language. MCP calls use the same key and credits as REST. Setup steps are on the MCP page.
Alternatives
- World Bank Indicators API (v2): Free, no key, nearly 16,000 indicators from over 45 databases, per its documentation.
- wbgapi for Python: A Python wrapper around the official API that returns pandas DataFrames. Our Python guide shows it side by side with APIFor.
Facts about other services come from their own pages or a test call on 1 Dec 2026. Prices and limits change, so confirm them there.
Source and licence
World Development Indicators, The World Bank, CC BY 4.0 (https://data.worldbank.org). APIFor serves a copy; the World Bank does not endorse it.
Every APIFor response carries the same attribution in meta.attribution. All sources are listed on sources and licences.
FAQ
Does the World Bank API need an API key?
No. The World Bank's documentation says API keys and other authentication are no longer needed.
Why does the World Bank API return XML?
XML is the default. Add format=json to the query string to get JSON.
What does APIFor add over the official API?
One key and one response shape shared with other datasets and services, and access from AI clients over MCP. It holds fewer series than the World Bank, so use the official API for anything outside World Development Indicators.