# Our World in Data API

> Our World in Data returns country-by-year statistics as a workflow and API.

Our World in Data (OWID) returns numeric country-by-year values from the best-matching chart for a named statistic. Get statistic returns chart details, definitions, sources, units, and values; provide a statistic and optionally countries and years.

- Page: https://fous.com/workflows/our-world-in-data
- Handle: `@our-world-in-data`
- Category: [Data](https://fous.com/workflows/category/data)
- Source website: https://ourworldindata.org
- Last verified: Sep 29, 2026
- Fous is not affiliated with Our World in Data.

## Methods

### Get statistic

Operation `get_statistic`, version 1. 1 credit per call.

Get a country-by-year statistic from the best-matching Our World in Data chart. Returns the selected chart, its definition and source, and numeric values. Only charts with downloadable numeric time-series data are supported.

**Input**

| Field | Type | Required | Example | Description |
|---|---|---|---|---|
| `to_year` | integer | no | `2022` | Last year to include. Example: 2020. Defaults to the latest available year. |
| `countries` | string | no | `"World, United States"` | Country names separated by commas. Example: France, Germany. Defaults to World. |
| `from_year` | integer | no | `2020` | First year to include. Example: 2000. Defaults to the earliest available year. |
| `statistic` | string | yes | `"CO2 emissions"` | The statistic to measure, in plain words. Example: life expectancy. |

**Input schema**

```json
{
  "type": "object",
  "required": [
    "statistic"
  ],
  "properties": {
    "to_year": {
      "type": "integer",
      "description": "Last year to include. Example: 2020. Defaults to the latest available year.",
      "examples": [
        2022,
        2020,
        2021
      ]
    },
    "countries": {
      "type": "string",
      "default": "World",
      "description": "Country names separated by commas. Example: France, Germany. Defaults to World.",
      "examples": [
        "World, United States",
        "France, Germany",
        "World"
      ]
    },
    "from_year": {
      "type": "integer",
      "description": "First year to include. Example: 2000. Defaults to the earliest available year.",
      "examples": [
        2020,
        2018
      ]
    },
    "statistic": {
      "type": "string",
      "description": "The statistic to measure, in plain words. Example: life expectancy.",
      "examples": [
        "CO2 emissions",
        "life expectancy",
        "GDP per person"
      ]
    }
  },
  "additionalProperties": false,
  "examples": [
    {
      "to_year": 2022,
      "countries": "World, United States",
      "from_year": 2020,
      "statistic": "CO2 emissions"
    },
    {
      "to_year": 2020,
      "countries": "France, Germany",
      "from_year": 2018,
      "statistic": "life expectancy"
    },
    {
      "to_year": 2021,
      "countries": "World",
      "from_year": 2020,
      "statistic": "GDP per person"
    }
  ]
}
```

**Output**

| Field | Type | Example | Description |
|---|---|---|---|
| `unit` | string or null | `"tonnes"` | Measurement unit. |
| `source` | string or null | `"Global Carbon Budget (2025) – with major processing by Our World in Data"` | Original data source citation. |
| `values` | array |  | Numeric observations sorted by country and then year. |
| `values[].year` | integer | `2020` |  |
| `values[].value` | number | `4689954000` |  |
| `values[].country` | string | `"United States"` |  |
| `chart_link` | string | `"https://ourworldindata.org/grapher/annual-co2-emissions-per-country"` | Link to the selected chart. |
| `definition` | string or null | `"Annual total emissions of carbon dioxide (CO₂), excluding land-use change, measured in tonnes."` | What the statistic measures. |
| `chart_title` | string | `"Annual CO₂ emissions"` | Title of the chart used. |

**Example input**

```json
{
  "to_year": 2022,
  "countries": "World, United States",
  "from_year": 2020,
  "statistic": "CO2 emissions"
}
```

**Example output**

```json
{
  "unit": "tonnes",
  "source": "Global Carbon Budget (2025) – with major processing by Our World in Data",
  "values": [
    {
      "year": 2020,
      "value": 4689954000,
      "country": "United States"
    },
    {
      "year": 2021,
      "value": 5020111000,
      "country": "United States"
    },
    {
      "year": 2022,
      "value": 5055403000,
      "country": "United States"
    }
  ],
  "chart_link": "https://ourworldindata.org/grapher/annual-co2-emissions-per-country",
  "definition": "Annual total emissions of carbon dioxide (CO₂), excluding land-use change, measured in tonnes.",
  "chart_title": "Annual CO₂ emissions"
}
```

## Quick start

Call the API with a Fous API key (`FOUS_API_KEY`). To create one, turn on Developer mode in Fous Studio, then open Keys & connections → API keys (https://app.fous.com/keys).

```bash
# First set your key: export FOUS_API_KEY='YOUR_FOUS_API_KEY'
: "${FOUS_API_KEY:?Set FOUS_API_KEY before running this example}"

curl 'https://api.fous.com/v1/query' \
  --fail-with-body --silent --show-error --max-time 120 \
  -H "Authorization: Bearer $FOUS_API_KEY" \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "api": "@our-world-in-data",
  "visibility": "public",
  "operation": "get_statistic",
  "version": 1,
  "input": {
    "to_year": 2022,
    "countries": "World, United States",
    "from_year": 2020,
    "statistic": "CO2 emissions"
  },
  "response": {
    "format": "json"
  }
}'
```

```python
# Save as fous.py and run with python3 fous.py. No packages needed.
# First set your key: export FOUS_API_KEY='YOUR_FOUS_API_KEY'
import json
import os
import urllib.error
import urllib.request

api_key = os.environ.get("FOUS_API_KEY")
if not api_key:
    raise RuntimeError("Set FOUS_API_KEY before running this example")

body = json.loads("{\n  \"api\": \"@our-world-in-data\",\n  \"visibility\": \"public\",\n  \"operation\": \"get_statistic\",\n  \"version\": 1,\n  \"input\": {\n    \"to_year\": 2022,\n    \"countries\": \"World, United States\",\n    \"from_year\": 2020,\n    \"statistic\": \"CO2 emissions\"\n  },\n  \"response\": {\n    \"format\": \"json\"\n  }\n}")
request = urllib.request.Request(
    "https://api.fous.com/v1/query",
    data=json.dumps(body).encode("utf-8"),
    headers={
        "Authorization": f"Bearer {api_key}",
        "Content-Type": "application/json",
    },
    method="POST",
)
try:
    with urllib.request.urlopen(request, timeout=120) as response:
        result = json.load(response)
except urllib.error.HTTPError as error:
    raise RuntimeError(f"HTTP {error.code}: {error.read().decode('utf-8', errors='replace')}") from error
if result.get("success") is False:
    raise RuntimeError(result.get("error", {}).get("message", "Request failed"))
print(json.dumps(result["data"]["output"], indent=2))
```

```typescript
// Save as fous.mts and run with npx tsx fous.mts.
// First set your key: export FOUS_API_KEY='YOUR_FOUS_API_KEY'
const apiKey = process.env.FOUS_API_KEY;
if (!apiKey) throw new Error("Set FOUS_API_KEY before running this example");

const response = await fetch("https://api.fous.com/v1/query", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${apiKey}`,
    "Content-Type": "application/json",
  },
  signal: AbortSignal.timeout(120_000),
  body: JSON.stringify({
  "api": "@our-world-in-data",
  "visibility": "public",
  "operation": "get_statistic",
  "version": 1,
  "input": {
    "to_year": 2022,
    "countries": "World, United States",
    "from_year": 2020,
    "statistic": "CO2 emissions"
  },
  "response": {
    "format": "json"
  }
}),
});
type ApiResult = { success: boolean; data?: { output: unknown }; error?: { message: string } };
const result: ApiResult = await response.json();
if (!response.ok || result.success === false) {
  throw new Error(result.error?.message ?? `HTTP ${response.status}`);
}
if (!result.data) throw new Error("Missing API response data");
console.log(result.data.output);
```

Or describe the data in plain language: send `{"api":"@our-world-in-data","prompt":"Describe the data you need, with every detail"}` to the same URL. Fous fills in the input, runs the method that fits and returns only the fields you asked for; `data.route.calls[].request` is the exact call it made. Routing is free; the run costs the same.

## Use cases

- Compare a statistic across countries and years
- Track changes in a statistic over time
- Find the source and definition for a statistic
- Build country-level reports from historical values

## FAQ

### Is Fous affiliated with Our World in Data?

No. Fous is not affiliated with Our World in Data. This workflow reads the public ourworldindata.org website and returns its data.

### How much does it cost?

Each run costs 1 credit. With pay-as-you-go, a credit costs 1¢; monthly plans cost less per credit.

### Do I need a Our World in Data account?

No. You only need a Fous account.

### How current is the data?

Fous gets the data from ourworldindata.org when you run it; repeating the same request within a day may return the saved result. Fous checks this workflow automatically; it last passed a check on Sep 29, 2026.

### What was life expectancy in France in 2020?

Use Get statistic with life expectancy, France, and 2020 as the first and last years.

### How did a statistic change over time?

Use Get statistic with the statistic and the desired first and last years.

### Which source and definition support a statistic?

Get statistic returns the selected chart’s source and definition.

## Related

- [World Bank API](https://fous.com/workflows/world-bank.md): World Bank provides country statistics and latest values within selected years, plus country rankings for a chosen year or the latest broadly covered year.
- [World Health Organization API](https://fous.com/workflows/world-health-organization.md): The World Health Organization provides public health information, latest outbreak reports, country health statistics with up to 10 years of history when available, and topic fact sheets.
- [Eurostat API](https://fous.com/workflows/eurostat.md): Official European statistics from Eurostat.
- [IMF API](https://fous.com/workflows/imf.md): IMF economic data provides country and regional forecasts with actual or forecast labels, and country rankings by World Economic Outlook indicators, excluding groups and missing values.
- [Kworb API](https://fous.com/workflows/kworb.md): Kworb provides published Spotify and YouTube music charts and tracked artist streaming totals; chart dates may lag, and daily streams or some views may be unavailable.
- [Wikipedia API](https://fous.com/workflows/wikipedia.md): Wikipedia returns article summaries, images, facts, relevant search matches, readable text and daily historical events, plus human-view counts from July 2015 onward.
- [Trading Economics API](https://fous.com/workflows/trading-economics.md): Trading Economics provides economic indicators, market data and country statistics, including country overviews, latest reported country comparisons and current commodity prices reflecting reported trading days.
- [Deezer API](https://fous.com/workflows/deezer.md): Deezer provides albums with ordered tracklists, song recording details, and current worldwide charts or official country-playlist tracks; previews and some tempo data may be unavailable or expire.
- [All Data workflows](https://fous.com/workflows/category/data)
