UK Office for National Statistics API
UK Office for National Statistics API
The UK Office for National Statistics API makes datasets, editions, versions, dimensions, options and observations available over keyless HTTP. It supports dataset discovery and filtered observation-level JSON from the ONS Explore our data service. The API is open and unrestricted, requires no API key, and is currently labelled Beta.
Required Attribution:
"Source: Office for National Statistics licensed under the Open Government Licence v.3.0" where applicable.
Coverage
ONS economic, population and social datasets published through the Beta API. Granularity ranges from dataset metadata and versioned releases to individual multidimensional observations. Free history depth and publication delay vary by dataset. Update frequency varies by release. ONS warns the Beta API may have occasional breaking changes as functionality is developed.
Verdict
This is an official UK macro and social-statistics signal for discovering releases and selecting observations by dimension. Retain dataset edition and version so revisions do not silently replace prior values, and expect Beta changes. ONS applies request limits and can block abusive automation: respect 429 Retry-After responses and identify bots with a contactable user agent. Most ONS content is under OGL v3.0 with attribution, but check dataset-specific third-party rights.
Get the free weekly email
Free weekly email of newly verified free data. Unsubscribe by emailing us.
By entering your email and clicking Subscribe, you agree to receive the Signal Lab weekly email from Quantum Data Technologies Ltd., 3200-650 West Georgia Street, Vancouver, BC V6B 4P7, Canada (signal-lab@qdt.ai). You can unsubscribe at any time: reply "unsubscribe" to any email or write to signal-lab@qdt.ai. See our Privacy Policy.
Use in your agent
Load the ONS dataset catalogue into pandas and Parquet. Checked against the provider's documentation on Nov 4, 2026.
Access
- No account or key. Catalogue and observation endpoints return JSON.
- Identify automation with a contactable user agent and obey Retry-After.
Request
curl 'https://api.beta.ons.gov.uk/v1/datasets?limit=100'Format
Paginated JSON items with dataset IDs, titles, descriptions, keywords, contacts, links, release frequency and state metadata.
Load into pandas and Parquet
Needs Python 3 with requests, pandas and pyarrow.
"""ONS Beta API dataset catalogue -> pandas -> Parquet. No key."""
import requests
import pandas as pd
URL = "https://api.beta.ons.gov.uk/v1/datasets"
headers = {"User-Agent": "signal-lab-catalog-check/1.0 (+https://signal-lab-jet.vercel.app)"}
r = requests.get(URL, params={"limit": 100}, headers=headers, timeout=60)
r.raise_for_status()
payload = r.json()
df = pd.json_normalize(payload["items"], sep=".")
keep = [c for c in ["id", "title", "description", "release_frequency", "next_release", "state"] if c in df]
df[keep].to_parquet("ons_datasets.parquet", index=False)
print(len(df), "datasets on page; total_count", payload.get("total_count"), "offset", payload.get("offset"))Run by us on 2026-11-04 (python 3.13.5 | pandas 3.1.0 | pyarrow 26.0.0 | requests 2.34.2). Result: 100 datasets on page; total_count 338 offset 0
Limits
- 120 requests per 10 seconds and 200 per minute; 15 per 10 seconds for high-demand assets.
- Respect 429 Retry-After.
Quirks
- The API is Beta.
- Pin edition and version before querying observations.
- Dataset-specific third-party rights can apply.
Terms and attribution
- Most ONS content is OGL v3.0.
- Give source attribution and check exemptions.
Sources
- https://developer.ons.gov.uk/: “The API is open and unrestricted - no API keys are required, so you can start using it immediately.”
- https://developer.ons.gov.uk/bots/: “120 requests per 10 seconds - all site and API assets”
- https://www.ons.gov.uk/help/terms-conditions: “Most content on this website is subject to Crown copyright protection and is published under the Open Government Licence (OGL).”
Information and education only. Not financial, investment, legal or tax advice. Listings can be inaccurate, incomplete or out of date and are provided "as is". Free tiers, limits and licenses belong to each provider and can change, so check the provider's own terms before you rely on them. Terms & Disclaimer