BYTETOOLS

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.

No API key requiredCORS enabledHTTPSFree tier

Endpoint tested and returned HTTP 200 on 19 Aug 2026

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 19 Aug 2026, 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
curl 'https://api.worldbank.org/v2/country/pk/indicator/NY.GDP.MKTP.CD?format=json&per_page=1'
JavaScript (fetch)
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);
Python (requests)
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())
Response — HTTP 200
[
  {
    "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

ParameterTypeRequiredDescription
<country>pathRequiredISO 2 or 3 letter country code, or `all`. pk
<indicator>pathRequiredIndicator code, e.g. NY.GDP.MKTP.CD for GDP in current USD. NY.GDP.MKTP.CD
formatstringRequiredMust be `json`, otherwise XML is returned. json
per_pageintegerOptionalResults per page. Defaults to 50. 1
datestringOptionalYear 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

Alternatives to World Bank Open Data API

If World Bank Open Data does not fit, these finance & crypto apis cover similar ground. Every one was called before publishing, and each links to its own reference page with a working curl command and the response it returned.

APIWhat it doesAuthCORSLast verified
CoinGeckoFree cryptocurrency price API covering 10,000+ coins. Live prices, market cap and volume in any currency, no API key on the public tier. Tested curl example.No keyYes19 Aug 2026
Binance Public APIBinance public market data API needs no API key: live ticker prices, order books, klines and 24h stats for every trading pair. Tested curl example and response.No keyYes19 Aug 2026
Coinbase Exchange RatesCoinbase public exchange rates API with no key: convert any cryptocurrency to 100+ fiat currencies in a single request. Tested curl example and live JSON.No keyYes19 Aug 2026
FrankfurterFree currency exchange rate API with no key, built on European Central Bank data. Latest and historical rates, time series and conversion. Tested curl example.No keyYes19 Aug 2026
Yahoo Finance ChartFree Yahoo Finance chart endpoint with no key: stock quotes, historical OHLC prices and volume for equities, ETFs, indices and currencies. Tested example.No keyNo20 Aug 2026
aWATTar Market DataFree aWATTar API with no key: hourly German and Austrian day-ahead electricity market prices in EUR/MWh, published as soon as the exchange releases them. Tested example.No keyYes21 Aug 2026
All Finance & Crypto APIs

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 19 Aug 2026; always check the official documentation before relying on this API in production, as terms and limits can change.