World Bank Open Data API
Free World Bank API with no key: GDP, population, inflation and 16,000+ development indicators for every country, going back decades. Tested curl example.
Endpoint tested and returned HTTP 200 on 2026-08-19
What is the World Bank Open Data API?
The World Bank Open Data API provides free access to more than 16,000 economic and development indicators — GDP, population, inflation, literacy, life expectancy and more — for every country, with decades of history and no API key.
This is one of the highest-quality open datasets available through an API, maintained by the World Bank as part of its open data mandate. It is authoritative source data rather than a scraped aggregation, which matters if you are publishing charts anyone might fact-check.
The API has one quirk that trips up every newcomer: it returns a two-element array where the first element is pagination metadata and the second is the actual data array. You want `response[1]`, not `response[0]`, and you must pass `format=json` or you will get XML.
Quick facts
- Base URL
https://api.worldbank.org/v2- Authentication
- No key or registration required.
- Rate limit
- No published limit; reasonable use expected.
- Pricing
- Free open data under a CC BY 4.0 licence, with attribution required.
- CORS
- Enabled — callable directly from browser JavaScript
- Official docs
- Read the docs
How to use the World Bank Open Data API
Every request below was executed against the live API on 2026-08-19, and the response shown is the real body it returned — not an illustration.
1. Pakistan's GDP, most recent year
GET https://api.worldbank.org/v2/country/pk/indicator/NY.GDP.MKTP.CD?format=json&per_page=1
curl 'https://api.worldbank.org/v2/country/pk/indicator/NY.GDP.MKTP.CD?format=json&per_page=1'const res = await fetch("https://api.worldbank.org/v2/country/pk/indicator/NY.GDP.MKTP.CD?format=json&per_page=1");
if (!res.ok) throw new Error(`Request failed: ${res.status}`);
const data = await res.json();
console.log(data);import requests
res = requests.get("https://api.worldbank.org/v2/country/pk/indicator/NY.GDP.MKTP.CD?format=json&per_page=1", timeout=20)
res.raise_for_status()
print(res.json())[
{
"page": 1,
"pages": 66,
"per_page": 1,
"total": 66,
"sourceid": "2",
"lastupdated": "2026-07-13"
},
[
{
"indicator": {
"id": "NY.GDP.MKTP.CD",
"value": "GDP (current US$)"
},
"country": {
"id": "PK",
"value": "Pakistan"
},
"countryiso3code": "PAK",
"date": "2025",
"value": 407307214476.222,
"unit": "",
"obs_status": "",
"decimal": 0
}
]
]Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
<country> | path | Required | ISO 2 or 3 letter country code, or `all`. pk |
<indicator> | path | Required | Indicator code, e.g. NY.GDP.MKTP.CD for GDP in current USD. NY.GDP.MKTP.CD |
format | string | Required | Must be `json`, otherwise XML is returned. json |
per_page | integer | Optional | Results per page. Defaults to 50. 1 |
date | string | Optional | Year or range to filter by. 2010:2024 |
Response fields
[0]object- Pagination metadata — page, pages, per_page, total. Not the data.
[1]array- The actual observations array. This is what you want.
[1][].valuenumber|null- The indicator value; null where no data exists for that year.
[1][].datestring- Year of the observation.
[1][].country.valuestring- Country name.
What you can build with the World Bank Open Data API
- Chart GDP, inflation or population trends for any country
- Compare development indicators across regions in research or journalism
- Feed authoritative country statistics into dashboards and reports
- Build educational data-visualisation projects with citable sources
Common errors and how to fix them
XML instead of JSON
The `format=json` parameter was omitted.
Fix: Always include `format=json`; XML is the default output.
value: null
No observation exists for that country and year — not an error.
Fix: Filter out null values before charting rather than plotting them as zero, which would badly distort trends.
Empty second array element
Unknown country or indicator code.
Fix: Verify the indicator code at the World Bank data portal; codes are case-sensitive and dotted.
World Bank Open Data API — frequently asked questions
Is the World Bank API free?
Yes, completely free with no API key. The data is published under CC BY 4.0, so you may use it commercially provided you attribute the World Bank.
Why does the World Bank API return an array with two elements?
The first element is pagination metadata and the second is the actual data array. Read `response[1]` for observations — this is the most common integration mistake.
How do I find the right indicator code?
Search the World Bank data portal. Common codes include NY.GDP.MKTP.CD for GDP in current US dollars, SP.POP.TOTL for total population and FP.CPI.TOTL.ZG for inflation.
Why are so many values null?
Not every country reports every indicator every year. Nulls are genuine gaps in the source data, and should be skipped rather than treated as zero.
Tools that pair with this API
JSON Formatter
Format, beautify and minify JSON online with 2-space, 4-space or tab indentation. Sort keys alphabetically and catch syntax errors instantly — free and private.
CSV to JSON Converter
Convert CSV to a JSON array of objects online. Header-row detection, comma/semicolon/tab delimiters and pretty-printed output — 100% in your browser.
Percentage Calculator
Calculate what X% of a number is, what percent one number is of another, and percentage increase or decrease between two values — instantly and free.
World Bank Open Data is an independent third-party service and is not affiliated with ByteTools or ByteVancer. Details on this page were verified on 2026-08-19; always check the official documentation before relying on this API in production, as terms and limits can change.