Financial Literature

World Bank

World Bank Indicators API — Annual macro for every country with one indicator code — the quickest cross-country table on the web

When the question is 'across countries' and annual is fine — growth, inflation, unemployment, debt, population — or you need the Pink Sheet's monthly commodity prices (energy, metals, food) with history to 1960.

macropriceslabourcommoditiesglobal
Asset classesmacro · prices · labour · commodities
Frequencymonthly → annual
History1960 → today
Limit · costNo key · 15,000 rows per page
KeyNo key
Formats · pull withjson · xml · csv · xlsx — python, excel, sheets
LicenceCC BY 4.0 for most datasets: free to use and redistribute with attribution.
RedistributeYes, with attribution
Best for“Inflation, growth or unemployment for 200 countries in one call” · “Monthly commodity prices (the Pink Sheet)”
When to use it

Reach for it when…

When the question is 'across countries' and annual is fine — growth, inflation, unemployment, debt, population — or you need the Pink Sheet's monthly commodity prices (energy, metals, food) with history to 1960.

Not for: Anything monthly or daily for one country (its central bank or statistics office), the latest year (World Bank data lag national sources by months), market prices.

How to read it

Units, revisions, traps

Units. Per indicator: percent, current US dollars, constant dollars, index. Country codes are ISO-3 (KOR, not KR); aggregates (WLD, EAS) are available too.

Revisions. Annual updates in spring; national revisions flow through with a lag.

  • The JSON returns a two-element array: metadata first, data second.
  • The most recent year is often null — use mrnev (most recent non-empty value) or drop nulls.
  • Pink Sheet is a spreadsheet, not the API; read the xlsx.
  • Multi-country requests (KR;JP;…) and some mrv= requests have answered 502 while single-country, date-range calls worked — loop countries and ask for date=YYYY:YYYY when that happens.

Classic mistake: Reading GDP in current dollars as real growth.

How to use it in your own work

Three recipes

Each recipe: Python · Excel · Sheets, with how to read the result. Python recipes run under pandas; recipe 1 is re-run by the weekly check where the source allows it.

How to use it in your own work

Copy the snippet, change the series id, read the result the way the footer says. Replace YOUR_…_KEY with your own key where one is needed.

Recipe 1Inflation for a set of countries

# one call per country (the multi-country form KR;JP and some larger requests answered 502 when we checked)
import requests, pandas as pd
out = {}
for c in ["KR", "JP", "SG", "US", "DE"]:
    u = f"https://api.worldbank.org/v2/country/{c}/indicator/FP.CPI.TOTL.ZG?format=json&mrv=5"
    rows = requests.get(u, timeout=30).json()[1]
    out[rows[0]["country"]["value"]] = {r["date"]: r["value"] for r in rows}
print(pd.DataFrame(out).sort_index().round(1))
How to read the resultAnnual averages: a country can have 8% in the annual figure and 2% by December. Use it for the cross-country table, not the latest month.

Recipe 2The Pink Sheet: monthly commodity prices since 1960

import pandas as pd
u = "https://thedocs.worldbank.org/en/doc/18675f1d1639c7a34d463f59263ba0a2-0050012025/related/CMO-Historical-Data-Monthly.xlsx"
df = pd.read_excel(u, sheet_name="Monthly Prices", skiprows=4)
df = df.rename(columns={df.columns[0]: "month"}).dropna(subset=["month"])
print(df[["month", "CRUDE_BRENT", "GOLD", "WHEAT_US_HRW"]].tail())
How to read the resultNominal US dollars; the 'Monthly Indices' sheet has the energy, metals and food indices in real terms.

Recipe 3Unemployment across a region

import requests, pandas as pd
u = "https://api.worldbank.org/v2/country/EAS/indicator/SL.UEM.TOTL.ZS?format=json&mrv=10"
rows = requests.get(u, timeout=30).json()[1]
print(pd.DataFrame([(r["date"], r["value"]) for r in rows], columns=["year", "East Asia & Pacific"]))
How to read the resultModelled ILO estimates — comparable across countries, but not the number a national statistics office quotes.

Series → question map

The ids we use from World Bank Indicators API, each with the question it answers. The catalog's compare view reads the concept tags behind these rows.

SeriesAnswersRegionConcept
FP.CPI.TOTL.ZGInflation, any country, annualglobalcpi
NY.GDP.MKTP.KD.ZGReal GDP growth, any countryglobalgdp
SL.UEM.TOTL.ZSUnemployment, any countryglobalunemployment
Pink Sheet · CRUDE_BRENTBrent, monthly, since 1960globalcommodity
Pink Sheet · GOLDGold, monthly, since 1960globalcommodity
GC.DOD.TOTL.GD.ZSHow indebted is a government?globaldebt

Compare with

Same question, different source: IMF Data, OECD Data Explorer, EIA API. The compare view lines up coverage, frequency, history and access side by side and lists what the combination makes possible.

Open compare: World Bank Indicators API · IMF Data · OECD Data Explorer →

Questions readers ask

Is the World Bank API free?

Yes, no key, generous paging.

Why is the latest year missing?

National sources report with a lag and the Bank publishes once validated. Use mrnev=1 to get the most recent non-empty value.

Where is the Pink Sheet URL?

On the Commodity Markets page; the file name is stable (CMO-Historical-Data-Monthly.xlsx) but the folder id changes with each release — link from the page.

Educational only — we explain, we never advise · snippet licence: public domain · corrections to [email protected], fixed within a day and logged in the changelog.