GovData Docs

Economics API Reference

UK economic data from the ONS: inflation (CPI, CPIH, RPI), GDP growth, unemployment, and house price index.

Base URL: https://api.govdata.dev/v1

Inflation Time Series

GET /v1/economics/inflation/:metric

Historical inflation observations for a given metric. Returns monthly data points with optional date range filtering.

Parameters

Parameter Type Required Description
metric string (path) Yes cpi, cpih, or rpi
from string (query) No Start date in YYYY-MM format
to string (query) No End date in YYYY-MM format
curl -H "Authorization: Bearer YOUR_API_KEY" \
  "https://api.govdata.dev/v1/economics/inflation/cpi?from=2024-01&to=2024-06"

Response

{
  "data": {
    "metric": "cpi",
    "name": "Consumer Prices Index",
    "observations": [
      { "date": "2024-01", "value": 4.0, "index": 131.5 },
      { "date": "2024-02", "value": 3.4, "index": 131.8 },
      { "date": "2024-03", "value": 3.2, "index": 132.0 },
      { "date": "2024-04", "value": 2.3, "index": 132.5 },
      { "date": "2024-05", "value": 2.0, "index": 132.8 },
      { "date": "2024-06", "value": 2.0, "index": 132.9 }
    ]
  },
  "meta": {
    "api_version": "v1",
    "licence": "Open Government Licence v3.0",
    "source": "Office for National Statistics",
    "source_url": "https://www.ons.gov.uk/economy/inflationandpriceindices"
  }
}

Latest Observation

GET /v1/economics/inflation/:metric/latest

Returns the most recent published observation for the given metric.

Parameters

Parameter Type Description
metric string (path) cpi, cpih, or rpi
curl -H "Authorization: Bearer YOUR_API_KEY" \
  https://api.govdata.dev/v1/economics/inflation/cpi/latest

Response

{
  "data": {
    "metric": "cpi",
    "name": "Consumer Prices Index",
    "date": "2025-12",
    "value": 2.5,
    "index": 135.2,
    "previous": { "date": "2025-11", "value": 2.6 }
  },
  "meta": {
    "api_version": "v1",
    "licence": "Open Government Licence v3.0",
    "source": "Office for National Statistics",
    "source_url": "https://www.ons.gov.uk/economy/inflationandpriceindices"
  }
}

Economic Indicators

GET /v1/economics/indicators/:metric

Historical economic indicator data. Returns time series observations with optional date range filtering.

Parameters

Parameter Type Required Description
metric string (path) Yes gdp (quarterly growth), unemployment (rate), or hpi (house price index)
from string (query) No Start date in YYYY-MM-DD format
to string (query) No End date in YYYY-MM-DD format
curl -H "Authorization: Bearer YOUR_API_KEY" \
  "https://api.govdata.dev/v1/economics/indicators/gdp?from=2024-01&to=2024-12"

Response

{
  "data": {
    "metric": "gdp",
    "name": "Gross Domestic Product (quarterly growth)",
    "observations": [
      { "date": "2024 Q1", "value": 0.7 },
      { "date": "2024 Q2", "value": 0.6 },
      { "date": "2024 Q3", "value": 0.5 },
      { "date": "2024 Q4", "value": 0.3 }
    ]
  },
  "meta": {
    "api_version": "v1",
    "licence": "Open Government Licence v3.0",
    "source": "Office for National Statistics",
    "source_url": "https://www.ons.gov.uk"
  }
}

Latest Indicator

GET /v1/economics/indicators/:metric/latest

Returns the most recent published observation for the given economic indicator.

curl -H "Authorization: Bearer YOUR_API_KEY" \
  https://api.govdata.dev/v1/economics/indicators/unemployment/latest

Economic data is sourced from the Office for National Statistics and updated weekly. Contains public sector information licensed under the Open Government Licence v3.0.

Data Coverage

Source Office for National Statistics (ONS)
Date range Varies by metric (CPI from 1989, GDP from 1955, etc.)
Records ~1,800 data points across 6 metrics
Updated Weekly (Monday)
Limitations ONS publishes with a 1-2 month lag