World Bank API: Get country statistic
Looks up a World Bank statistic for a country and returns its annual values and latest value for the selected years.
Unofficial. Not affiliated with or endorsed by World Bank.
Inputs
Values from the run on Oct 23, 2026, shown under Output.
- Country, required
country Country name, such as Brazil.
South Korea
- To Year optional
to_year Last year to include, such as 2023. Defaults to the most recent year with data.
Not set
Whole number.
- From Year optional
from_year First year to include, such as 2015. Defaults to nine years before the most recent year with data.
Not set
Whole number.
- Statistic, required
statistic Statistic in everyday words, such as GDP per person or inflation.
GDP per person
Input as JSON
{ "country": "South Korea", "statistic": "GDP per person"}Output
{ "unit": "current US$", "source": "World Development Indicators", "values": [ { "year": 2016, "value": 30832.0628072516 }, { "year": 2017, "value": 33296.9845439195 }, { "year": 2018, "value": 35363.9508228687 } ], "country": "Korea, Rep.", "statistic": "GDP per capita (current US$)", "latest_year": 2025, "latest_value": 36226.9663637512, "data_page_link": "https://data.worldbank.org/indicator/NY.GDP.PCAP.CD?locations=KR" , "indicator_code": "NY.GDP.PCAP.CD"}Code
curl https://api.fous.com/v1/runs \ -H "Authorization: Bearer $FOUS_API_KEY" \ -H "Content-Type: application/json" \ -d '{"method":"data.worldbank.org/get_country_statistic","input":{"country":"South Korea","statistic":"GDP per person"}}' # Save as fous.py, then run: python3 fous.pyimport json, os, timefrom urllib.error import HTTPErrorfrom urllib.request import Request, urlopenAPI = "https://api.fous.com/v1/runs" KEY = os.environ["FOUS_API_KEY"]HEADERS = { "Authorization": f"Bearer {KEY}", "Content-Type": "application/json" ,}def call(url, body=None): data = json.dumps(body).encode() if body else None request = Request(url, data, HEADERS) try: with urlopen(request, timeout=120) as r: return r.status, json.load(r) except HTTPError as error: message = json.load(error)["error"]["message"] raise RuntimeError(message) from errorstatus, run = call(API, { "method": "data.worldbank.org/get_country_statistic" , "input": { "country": "South Korea", "statistic": "GDP per person" }})# 202: still going after 30 s. Ask again until it ends.while status == 202: time.sleep(2) status, run = call(f"{API}/{run['id']}")print(json.dumps(run["data"], indent=2))// Save as fous.mjs, then run: node fous.mjsconst api = "https://api.fous.com/v1/runs" ;const headers = { Authorization: `Bearer ${process.env.FOUS_API_KEY}`, "Content-Type": "application/json" ,};let response = await fetch(api, { method: "POST", headers, body: JSON.stringify({ "method": "data.worldbank.org/get_country_statistic" , "input": { "country": "South Korea", "statistic": "GDP per person" } }), signal: AbortSignal.timeout(120_000),});let run = await response.json();// 202: still going after 30 s. Ask again until it ends.while (response.status === 202) { await new Promise((done) => setTimeout(done, 2_000)); response = await fetch(`${api}/${run.id}`, { headers }); run = await response.json();}if (!response.ok) throw new Error(run.error.message);console.log(run.data);# Connect your agent to Fous once, over MCP (Streamable HTTP):# https://api.fous.com/mcp# Set FOUS_API_KEY first: create a key at https://app.fous.com/keys.# Claude Codeclaude mcp add \ --scope user \ --transport http fous https://api.fous.com/mcp \ --header "Authorization: Bearer ${FOUS_API_KEY:?Set FOUS_API_KEY to your Fous API key}"# Codexcodex mcp add fous \ --url https://api.fous.com/mcp \ --bearer-token-env-var FOUS_API_KEY# Cursor, VS Code, Windsurf, Cline and morenpx -y add-mcp https://api.fous.com/mcp -g -n fous \ --header "Authorization: Bearer ${FOUS_API_KEY:?Set FOUS_API_KEY to your Fous API key}"# Then ask your agent:# "Use Fous to run data.worldbank.org/get_country_statistic# with {"country":"South Korea","statistic":"GDP per person"}"Over HTTP, the answer’s data holds the output. A run still going after 30 seconds answers 202 with its id: ask GET /v1/runs/{id} until it ends.
Schema
Input schema
{ "type": "object", "required": [ "country", "statistic" ], "properties": { "country": { "type": "string", "minLength": 1, "description": "Country name, such as Brazil." }, "to_year": { "type": "integer", "description": "Last year to include, such as 2023. Defaults to the most recent year with data." }, "from_year": { "type": "integer", "description": "First year to include, such as 2015. Defaults to nine years before the most recent year with data." }, "statistic": { "type": "string", "minLength": 1, "description": "Statistic in everyday words, such as GDP per person or inflation." } }, "additionalProperties": false}Output schema
{ "type": "object", "required": [ "country", "statistic", "unit", "latest_value", "latest_year", "values", "source", "data_page_link", "indicator_code" ], "properties": { "unit": { "type": [ "string", "null" ], "description": "Unit of measurement." }, "source": { "type": "string", "description": "World Bank data collection supplying this statistic." }, "values": { "type": "array", "items": { "type": "object", "required": [ "year", "value" ], "properties": { "year": { "type": "integer" }, "value": { "type": [ "number", "null" ] } }, "additionalProperties": false }, "description": "Annual values, oldest first, including years without data." }, "country": { "type": "string", "description": "World Bank country name." }, "statistic": { "type": "string", "description": "World Bank indicator title." }, "latest_year": { "type": [ "integer", "null" ], "description": "Year of the most recent available value within the selected years." }, "latest_value": { "type": [ "number", "null" ], "description": "Most recent available value within the selected years." }, "data_page_link": { "type": "string", "description": "World Bank page for this country and statistic." }, "indicator_code": { "type": "string", "description": "World Bank indicator identifier.", "x-fous-developer": true } }, "additionalProperties": false}- Price
- 1 credit per completed run (1¢ with pay as you go); failed runs are free.
- Method
data.worldbank.org/get_country_statistic- Returns
- country, statistic, unit, latest value and year, annual values, source, data page link
Use it from your agent
Give your agent this line. It reads SKILL.md, gets a Fous API key and connects the Fous MCP server. Its run then takes the method data.worldbank.org/get_country_statistic with the inputs above.
Ask your agent
- What was Brazil's GDP per person over the last ten years, and what is the latest figure?
- Show me inflation rates for Kenya from 2010 to 2020 with the most recent value.
- I need the unemployment rate for Germany for 2015 through 2022, year by year, from worldbank.org.
- What is the latest life expectancy for Japan, plus its annual values since 2000?
- Give me the annual population figures for Nigeria between 2012 and 2023 with a source link.
See more
All World Bank methodsRanks countries by a World Development Indicators statistic for a given year, or for the latest year with broad country coverage. Regional aggregates and countries without data for that year are left out.
worldbank.org/compare_countriesFinds the Our World in Data chart that best matches a statistic and returns its country-by-year numeric values, definition and source.
ourworldindata.org/get_statisticGets the latest WHO value of a health statistic for a country, with sex-specific values, the regional value for the same year, and up to 10 years of history.
who.int/get_country_health_statisticsGets World Economic Outlook figures for a country or region by year, labelled as actual or forecast. Measures the IMF does not publish for a year are null.
imf.org/get_economic_forecastLooks up an official Eurostat statistic for an EU or EEA country and the EU27 figure for the same period. Quarterly and half-yearly series return the reporting period that contains a requested month.
ec.europa.eu/get_statisticReturns seven key economic indicators for a country from its public Trading Economics overview: GDP growth rate, inflation rate, interest rate, unemployment rate, government debt to GDP, currency and stock market. Indicators absent from the overview are null; the US dollar index is not reported as a USD exchange rate.
tradingeconomics.com/get_country_overviewRanks countries by a World Economic Outlook indicator for a chosen year, excluding regional and group totals and countries without a value.
imf.org/list_country_rankingsCompares the latest reported value of an economic indicator across countries in a region, highest first. World includes all listed countries; Australia uses the Oceania region.
tradingeconomics.com/list_countries_by_indicator