Our World in Data API: Get statistic
Finds the Our World in Data chart that best matches a statistic and returns its country-by-year numeric values, definition and source.
Unofficial. Not affiliated with or endorsed by Our World in Data.
Inputs
Values from the run on Oct 23, 2026, shown under Output.
- To Year optional
to_year Last year to include. Example: 2020. Defaults to the latest available year.
2020
Whole number.
- Countries optional
countries Country names separated by commas. Example: France, Germany. Defaults to World.
France, Germany
Default
World.- From Year optional
from_year First year to include. Example: 2000. Defaults to the earliest available year.
2018
Whole number.
- Statistic, required
statistic The statistic to measure, in plain words. Example: life expectancy.
life expectancy
Input as JSON
{ "to_year": 2020, "countries": "France, Germany", "from_year": 2018, "statistic": "life expectancy"}Output
{ "unit": "years", "source": "Riley (2005); Zijdeman et al. (2015); HMD (2025); UN WPP (2024) – with major processing by Our World in Data", "values": [ { "year": 2018, "value": 82.5682, "country": "France" }, { "year": 2019, "value": 82.7304, "country": "France" }, { "year": 2020, "value": 82.1993, "country": "France" } ], "chart_link": "https://ourworldindata.org/grapher/life-expectancy" , "definition": "Period life expectancy is the number of years the average person born in a certain year would live if they experienced the same chances of dying at each age as people did that year.", "chart_title": "Life expectancy"}Code
curl https://api.fous.com/v1/runs \ -H "Authorization: Bearer $FOUS_API_KEY" \ -H "Content-Type: application/json" \ -d '{"method":"ourworldindata.org/get_statistic","input":{"to_year":2020,"countries":"France, Germany","from_year":2018,"statistic":"life expectancy"}}' # 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": "ourworldindata.org/get_statistic" , "input": { "to_year": 2020, "countries": "France, Germany", "from_year": 2018, "statistic": "life expectancy" }})# 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": "ourworldindata.org/get_statistic" , "input": { "to_year": 2020, "countries": "France, Germany", "from_year": 2018, "statistic": "life expectancy" } }), 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 ourworldindata.org/get_statistic# with {"to_year":2020,"countries":"France, Germany","from_year":2018,"statistic":"life expectancy"}"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": [ "statistic" ], "properties": { "to_year": { "type": "integer", "description": "Last year to include. Example: 2020. Defaults to the latest available year." }, "countries": { "type": "string", "default": "World", "description": "Country names separated by commas. Example: France, Germany. Defaults to World." }, "from_year": { "type": "integer", "description": "First year to include. Example: 2000. Defaults to the earliest available year." }, "statistic": { "type": "string", "description": "The statistic to measure, in plain words. Example: life expectancy." } }}Output schema
{ "type": "object", "required": [ "chart_title", "chart_link", "values" ], "properties": { "unit": { "type": [ "string", "null" ] }, "source": { "type": [ "string", "null" ] }, "values": { "type": "array", "items": { "type": "object", "properties": { "year": { "type": "integer" }, "value": { "type": "number" }, "country": { "type": "string" } } } }, "chart_link": { "type": "string" }, "definition": { "type": [ "string", "null" ] }, "chart_title": { "type": "string" } }}- Price
- 1 credit per completed run (1¢ with pay as you go); failed runs are free.
- Method
ourworldindata.org/get_statistic- Returns
- chart title, unit, definition, source, chart link, values by country and year
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 ourworldindata.org/get_statistic with the inputs above.
Ask your agent
- Get the yearly CO2 emissions per capita for Japan and South Korea from 1990 to 2015, with the source and definition.
- I need life expectancy at birth for Brazil, Nigeria and India across 1960 through 2019, values by country and year.
- Pull the share of population living in extreme poverty for Kenya between 2000 and 2018, including the chart link.
- What is the global child mortality rate by year up to 2010? Include the unit and data source.
- Show me renewable electricity share of total generation for Germany, Spain and Denmark from 2005 to the latest year available on ourworldindata.org.
See more
Looks up a World Bank statistic for a country and returns its annual values and latest value for the selected years.
data.worldbank.org/get_country_statisticRanks 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_countriesGets 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_statisticsLooks 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_statisticGets 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_forecastGets a public FRED economic series by plain name or series ID, with its observations, latest value and source details.
fred.stlouisfed.org/get_economic_indicatorCompares 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_indicatorGets Kworb's latest YouTube music chart, worldwide or for one country, ordered by daily views. The worldwide chart covers the past 24 hours. Country charts report daily track streams.
kworb.net/get_youtube_music_chart