canonical: https://jentic.com/apis/ons.gov.uk/ons

# ONS Developer Hub API

The ONS Developer Hub API gives programmatic access to UK statistical data published by the Office for National Statistics. The API is open and unauthenticated and exposes datasets, observations, code lists, and hierarchies behind a small set of REST endpoints, with a POST-based filter operation for slicing large datasets. It is designed for analysts, journalists, and data engineers who need machine-readable access to UK official statistics rather than scraping the ons.gov.uk website. The API is in beta, so consumers should pin to the v1 base path and expect occasional changes.

## For AI agents

Pull UK statistical data and metadata from the Office for National Statistics, including observations, datasets, code lists, and hierarchies, with no API key required.

## Scope

Does not handle non-UK statistics, microdata access, or restricted research datasets - use for public Office for National Statistics data only.

## Capabilities

- Retrieve observation-level data points from a dataset by dimensions
- Filter and export a dataset slice via a POST request to /export
- Look up resources, taxonomies, and the published index of available data
- Resolve datasets and read their code lists and dimensional hierarchies
- Query the published-data feed for the most recent ONS releases
- Read filesize ahead of time so downstream pipelines can plan storage and timeouts

## Use cases

### Newsroom data journalism

Newsrooms covering UK inflation, employment, or population stories need to pull the official ONS numbers as soon as they release. The Developer Hub API provides direct observation-level access and a published-data feed for scheduled releases, so journalists can wire up dashboards and chart factories that update automatically. No API key means a tight time-to-first-chart for ad hoc reporting.

Example prompt: GET /publisheddata for the last 24 hours, then GET /data for the inflation observation matching the latest CPI release.

### Economic research and modelling

Economists and analysts pull UK time series for use in forecasts and academic models. The /data and /export endpoints together support both fine-grained observation reads and bulk dataset slicing, with code-list and hierarchy endpoints that document the dimensions so researchers know what they are joining on. Pipelines built once tend to run for years against the v1 base path.

Example prompt: POST /export with a filter for GDP by region for the last 5 years and download the resulting export file.

### Public sector dashboards and policy analytics

Local councils and central government teams build dashboards that combine ONS releases with their own administrative data. The taxonomy and resolvedatasets endpoints help map ONS datasets onto policy areas, and the resource lookup keeps the dashboard pointing to the canonical, citable file. Most policy dashboards integrate ONS as a nightly or weekly batch.

Example prompt: GET /taxonomy filtered to the cost-of-living node, list datasets for that node via /resolvedatasets, then GET /data for each dataset's headline series.

### AI agent statistics lookup through Jentic

An AI assistant that answers UK economic questions can call ONS through Jentic to ground its answers in official statistics. The agent searches Jentic for the data lookup operation, loads the schema, and queries /data with the right dimensions. The unauthenticated nature of the API means there is no credential to manage, but Jentic still gives the agent a typed schema and consistent error handling.

Example prompt: Search Jentic for 'ons data observation', load the GET /data operation, and execute it for a known dataset id and dimension filter.

## Key endpoints

| Method | Path | Description |
| --- | --- | --- |
| GET | `/data` | Retrieve observation-level data points |
| POST | `/export` | Submit a filter to export a dataset slice |
| GET | `/resource` | Look up a single dataset resource |
| GET | `/publishedindex` | List recently published datasets |
| GET | `/taxonomy` | Walk the ONS topic taxonomy |
| GET | `/resolvedatasets` | List datasets attached to a taxonomy node |
| GET | `/filesize` | Read the size of a resource ahead of download |

## Key resources

- **Data** — Observation-level data points, queryable by dimensions
- **Resources** — Individual files attached to a dataset, with filesize lookup
- **Search** — Search across the published index and taxonomy
- **Code Lists** — Dimension code lists used by datasets
- **Hierarchies** — Tree structures for geography and other dimensions
- **Metadata** — Taxonomy and parent-node lookups for navigating the catalogue

## AI readiness

This API is usable in Jentic One now. Its AI-readiness score against Jentic's framework shows where it stands today and where improvements would make it even easier for agents to use.

- **Score:** 71 / 100
- **Maturity:** AI-Aware
- **Dimensions:**
  - Foundational Compliance: 100 / 100
  - Developer Experience & Jentic Compatibility: 63 / 100
  - AI-Readiness & Agent Experience: 54 / 100
  - Agent Usability: 94 / 100
  - Security: 100 / 100
  - AI Discoverability: 57 / 100
- **View full report:** https://jentic.com/apis/ons.gov.uk/ons/scorecard
- **How the score is calculated:** https://docs.jentic.com/reference/api-readiness-framework/overview/
- **More about the dimensions:** https://docs.jentic.com/reference/api-readiness-framework/specification/#dimensional-model-overview

### Score it yourself

Every API in the directory is allowlisted, so you can re-score it with no key required.

- **Score your own API:** https://jentic.com/scorecard.md
- **Scoring CLI agent skill:** https://github.com/jentic/jentic-api-scorecard/blob/main/skills/jentic-api-scorecard/SKILL.md

```sh
npx @jentic/api-scorecard-cli score <openapi-url>
```

## Why Jentic

- **Setup:** Wiring the ONS Developer Hub API by hand means building each data, export, taxonomy, and dataset-resolution call against api.beta.ons.gov.uk/v1 yourself, even though it needs no credential. Through Jentic you install once, import the ONS Developer Hub API from the API Directory, and your agent calls it with the same invocation pattern you use for credentialed APIs.
- **Permission scoping:** The ONS Developer Hub API is public and takes its dataset and taxonomy parameters in the query string, so you limit the agent to the operations it needs, such as reading data or listing datasets. Exporting or file-size lookups are excluded unless you add those operations to the allowed set.
- **Credential handling:** The ONS Developer Hub API needs no credential, so there is nothing to store. Your Jentic One instance still gives the agent a consistent invocation surface so the same pattern works alongside credentialed APIs.
- **Discovery method:** Agents search Jentic by intent such as 'ons consumer prices' or 'list ons datasets', and Jentic returns the matching ONS operation with its input schema so the agent calls the right endpoint without browsing the reference docs.

## Related APIs

- **US Census Bureau API** — Equivalent open statistics API for the United States
- **Google BigQuery API** — Warehouse the ONS exports for joins with other datasets and SQL analytics
- **Google Sheets API** — Drop ONS observations into a shared sheet for analysts and journalists

## FAQ

### What authentication does the ONS Developer Hub API use?

None. The API is open and unrestricted, and the OpenAPI spec declares no security schemes. You can call it directly without an API key. Through Jentic, the call is still routed and rate-managed consistently with other APIs even though there is no credential to inject.

### Can I download a slice of a dataset rather than every observation?

Yes. POST a filter description to /export to ask ONS to assemble the slice as an export, then read the resulting resource. For point lookups, GET /data returns observations matching a set of dimension values directly. /filesize lets the pipeline size storage before triggering a large export.

### What are the rate limits for the ONS Developer Hub API?

ONS does not publish hard rate limits in the spec, but the API is in beta and shared by all developers. Polite usage is to cache responses, batch reads through /export rather than looping /data, and back off on any 429 or 5xx responses. ONS reserves the right to throttle abusive callers.

### How do I look up the latest UK inflation data through Jentic?

Install the SDK with 'pip install jentic', search for the operation with the query 'ons consumer prices observation', then load the GET /data operation, and execute it with the dataset id for CPI and the latest period dimension. Jentic returns the observation values straight to the agent.

### Is the API stable enough for production use?

The API is documented as beta and ONS notes that breaking changes can occur. Pin to the published v1 base path, monitor the /publishedindex for catalogue changes, and treat schema additions as backwards-compatible while expecting occasional removals or renames on minor revisions.

### How do I navigate ONS datasets by topic?

Use GET /taxonomy to walk the topic tree, GET /parents to climb upward from a node, and GET /resolvedatasets to list the datasets attached to a topic. From there, GET /data or POST /export work against any dataset id you find in the topic walk.

### Can I limit what my agent is allowed to do with the ONS Developer Hub API?

Yes. Because you self-host Jentic One, your own rules decide which ONS operations and parameters the agent can call, even though this API is public and needs no credential. You can allow just the read operations the agent needs, such as GET /data for observations and GET /taxonomy or GET /resolvedatasets for navigating datasets, while withholding POST /export and GET /filesize until you explicitly add them to the allowed set. That way the agent reads UK statistics without being able to trigger export jobs you did not intend.
