UK Office for National Statistics
The UK's national statistical institute. Publishes authoritative data on the UK economy, labour market, population, housing, and public finances. Open Government Licence, free commercial use with attribution.
Current status
100.0% operational in known checks
Checked Jun 16, 8:10 PM
Access
open
Collection level
L2
Confidence
medium
Recommended next action
Use the documented public content probe, then promote to freshness only after a stable value is confirmed.
Exportable data
public_api
Docker fit
docker_ok
Estimated size
large
Download location
https://api.beta.ons.gov.uk/v1/datasetsCost
Free
Access type
open
Signup required
No
Update alerts
Not offered
Coverage
europe
Update frequency
monthly
Source Documentation
What You're Getting
The UK Office for National Statistics is the national statistical institute for the UK. It publishes official data on the UK economy (GDP, CPI, trade, national accounts), labour market (employment, unemployment, earnings), population (census, projections, migration), housing (prices, construction), and public finance. Data is available as downloadable CSV/Excel datasets and via a beta JSON API.
Ingestion Strategy
Two paths: the beta API for structured pulls, or direct CSV download for bulk loads.
import requests
import pandas as pd
ONS_API = "https://api.beta.ons.gov.uk/v1"
# List available datasets
datasets_r = requests.get(f"{ONS_API}/datasets")
datasets = datasets_r.json()["items"]
print(f"Available datasets: {len(datasets)}")
# Direct CSV download — most reliable for bulk data
# CPI dataset (mm23)
csv_url = "https://www.ons.gov.uk/generator?format=csv&uri=/economy/inflationandpriceindices/datasets/consumerpriceinflation"
df_cpi = pd.read_csv(csv_url, skiprows=7)
Rate Limits & API Details
- No published rate limit
- Beta API:
https://api.beta.ons.gov.uk/v1 - Key publication codes:
mm23(CPI),qna(GDP),lms(Labour Market),hpssa(House Prices) - CSV/Excel via
ons.gov.uk/generator?format=csv&uri={dataset_uri}
Schema Stability
Stable for headline publications (CPI, GDP, LMS). The beta API is actively developed. CSV column headers use period codes (e.g. 2024 JAN) — parse carefully.
Data Quality Gotchas
- CSV header rows: ONS CSVs have 5–10 metadata rows before data — use
skiprows - Period coding: time periods as
2024 Q1,2024 JAN, or2024— normalize to ISO 8601 on ingest - Beta API coverage: not all 2,000+ datasets available via API; many require CSV download
- Revisions: UK GDP has three rounds of revisions — store download timestamps
- Geographic scope: some series are England-only or Great Britain, not UK-wide
Data Formats
API Quickstart
No snippet available yet.
How to Access
- 🌐 end user
- ⚡ automation ready programmable
Notable Datasets
8 total- ▸ GDP and National Accounts (QNA)
- ▸ Consumer Price Inflation (CPI, RPI — mm23)
- ▸ Labour Market Statistics (LMS)
- ▸ House Price Index
- ▸ Public Sector Finances
- ▸ Population Estimates and Projections
- ▸ International Trade
- ▸ Business and Economic Indicators
Index entry
Added: May 2, 2026
Last indexed: Jun 16, 2026
Unverified entry