# UK Statistics API
> Official UK economic statistics straight from the Office for National Statistics (ONS) beta API — no key, read live. The cpi endpoint returns CPIH, the UK's lead measure of consumer price inflation (Consumer Prices Index including owner occupiers' housing costs, index 2015=100), for the latest month with the index level plus the month-on-month and year-on-year rates, computed from the official series. The cpi/series endpoint returns the historical monthly CPIH index and year-on-year rate over the last N months, ready to chart. The cpi/divisions endpoint breaks the latest CPIH down across all twelve COICOP divisions (food, housing, transport, recreation and so on) with the index for each. The datasets endpoint lists the ONS dataset catalogue (hundreds of datasets covering prices, GDP, the labour market, population, trade and more) so you can discover what is available. The meta endpoint documents the source. Live data from the ONS beta CMD API, lightly cached. Live. 5 endpoints. This serves UK national statistics; for the sterling exchange rate or the Bank of England base rate use an FX / central-bank API.

## Authentication
All requests require your oanor API key in the `x-oanor-key` header. Get one at https://www.oanor.com/developer/keys.

```bash
curl -H "x-oanor-key: oanor_live_…" "https://api.oanor.com/uk-stats-api/..."
```

## Pricing
- **Free** (Free) — 300 calls/Mo, 2 req/s
- **Basic** ($11/Mo) — 19,500 calls/Mo, 6 req/s
- **Pro** ($29/Mo) — 99,000 calls/Mo, 22 req/s
- **Mega** ($67/Mo) — 445,000 calls/Mo, 55 req/s

## Endpoints

### Inflation

#### `GET /v1/cpi` — UK CPIH (latest month): index, MoM and YoY

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/uk-stats-api/v1/cpi"
```

**Response:**
```json
{
    "data": {
        "base": "Index: 2015=100",
        "index": 139.4,
        "period": "Jan-26",
        "source": "UK Office for National Statistics (dataset cpih01)",
        "country": "United Kingdom",
        "indicator": "CPIH — Consumer Prices Index including owner occupiers' housing costs (overall)",
        "period_iso": "2026-01",
        "change_mom_pct": -0.36,
        "change_yoy_pct": 3.18
    },
    "meta": {
        "timestamp": "2026-06-15T20:40:38.079Z",
        "request_id": "fd383c9f-2e6e-473d-8ba9-76095c4dc9dc"
    },
    "status": "ok",
    "message": "UK CPIH retrieved",
    "success": true
}
```

#### `GET /v1/cpi/divisions` — Latest CPIH across all 12 COICOP divisions

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/uk-stats-api/v1/cpi/divisions"
```

**Response:**
```json
{
    "data": {
        "base": "Index: 2015=100",
        "count": 12,
        "period": "Jan-26",
        "source": "ONS cpih01",
        "country": "United Kingdom",
        "divisions": [
            {
                "index": 144.3,
                "label": "01 Food and non-alcoholic beverages",
                "coicop": "CP01"
            },
            {
                "index": 159.7,
                "label": "02 Alcoholic beverages and tobacco",
                "coicop": "CP02"
            },
            {
                "index": 118,
                "label": "03 Clothing and footwear",
                "coicop": "CP03"
            },
            {
                "index": 142.8,
                "label": "04 Housing, water, electricity, gas and other fuels",
                "coicop": "CP04"
            },
            {
                "index": 124.5,
                "label": "05 Furniture, household equipment and maintenance",
                "coicop": "CP05"
            },
            {
                "index": 142.3,
                "label": "06 Health",
                "coicop": "CP06"
            },
            {
                "index": 136.7,
                "label": "07 Transport",
                "coicop": "CP07"
            },
            {
                "index": 142.1,
                "label": "08 Communication",
                "coicop": "CP08"
            },
            {
                "index": 135.5,
                "label": "09 Recreation and cultur
…(truncated, see openapi.json for full schema)
```

#### `GET /v1/cpi/series` — Historical CPIH index + YoY series

**Parameters:**
- `months` (query, optional, string) — Number of recent months (default 24, max 240) Example: `24`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/uk-stats-api/v1/cpi/series?months=24"
```

**Response:**
```json
{
    "data": {
        "base": "Index: 2015=100",
        "count": 24,
        "series": [
            {
                "index": 130.8,
                "period": "Feb-24",
                "period_iso": "2024-02",
                "change_yoy_pct": 3.81
            },
            {
                "index": 131.6,
                "period": "Mar-24",
                "period_iso": "2024-03",
                "change_yoy_pct": 3.79
            },
            {
                "index": 132.2,
                "period": "Apr-24",
                "period_iso": "2024-04",
                "change_yoy_pct": 3.04
            },
            {
                "index": 132.7,
                "period": "May-24",
                "period_iso": "2024-05",
                "change_yoy_pct": 2.79
            },
            {
                "index": 133,
                "period": "Jun-24",
                "period_iso": "2024-06",
                "change_yoy_pct": 2.78
            },
            {
                "index": 132.9,
                "period": "Jul-24",
                "period_iso": "2024-07",
                "change_yoy_pct": 3.02
            },
            {
                "index": 133.4,
                "period": "Aug-24",
                "period_iso": "2024-08",
                "change_yoy_pct": 3.09
            },
            {
                "index": 133.5,
                "period": "Sep-24",
                "period_iso": "2024-09",
                "change_yoy_pct": 2.61
         
…(truncated, see openapi.json for full schema)
```

### Catalogue

#### `GET /v1/datasets` — List the ONS dataset catalogue

**Parameters:**
- `limit` (query, optional, string) — Number of datasets to list (default 50, max 200) Example: `50`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/uk-stats-api/v1/datasets?limit=50"
```

**Response:**
```json
{
    "data": {
        "count": 50,
        "source": "UK Office for National Statistics",
        "datasets": [
            {
                "id": "wellbeing-quarterly",
                "title": "Quarterly personal well-being estimates",
                "description": "Seasonally and non seasonally-adjusted quarterly estimates of life satisfaction, feeling that the things done in life are worthwhile, happiness and anxiety in the UK."
            },
            {
                "id": "wellbeing-local-authority",
                "title": "Personal well-being estimates by local authority",
                "description": "Estimates of life satisfaction, feeling that the things done in life are worthwhile, happiness and anxiety at the UK, country, regional, county, local and unitary authority level."
            },
            {
                "id": "weekly-deaths-region",
                "title": "Deaths registered weekly in England and Wales by region",
                "description": "Provisional counts of the number of deaths registered in England and Wales, by region, in the latest weeks for which data are available."
            },
            {
                "id": "weekly-deaths-local-authority",
                "title": "Death registrations and occurrences by local authority and place of death",
                "description": "Provisional counts of the number of deaths registered in England and Wales, including deaths involving the coronavirus (COVID-19), by local au
…(truncated, see openapi.json for full schema)
```

### Meta

#### `GET /v1/meta` — API metadata

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/uk-stats-api/v1/meta"
```

**Response:**
```json
{
    "data": {
        "api": "UK Statistics (ONS) API",
        "notes": "Live data from the ONS beta API; month-on-month and year-on-year computed from the CPIH index series. The datasets endpoint lists the full ONS catalogue.",
        "source": "UK Office for National Statistics — beta CMD API (api.beta.ons.gov.uk)",
        "country": "United Kingdom",
        "endpoints": [
            "/v1/cpi",
            "/v1/cpi/series",
            "/v1/cpi/divisions",
            "/v1/datasets",
            "/v1/meta"
        ],
        "documentation": "https://uk-stats-api.oanor.dev",
        "primary_indicator": "CPIH — Consumer Prices Index including owner occupiers' housing costs (dataset cpih01, monthly, 2015=100)"
    },
    "meta": {
        "timestamp": "2026-06-15T20:40:38.424Z",
        "request_id": "bd2aa8ef-7955-4161-9835-c7daf6ff94cb"
    },
    "status": "ok",
    "message": "Meta",
    "success": true
}
```


---
Marketplace page: https://www.oanor.com/api/uk-stats-api
OpenAPI spec: https://www.oanor.com/api/uk-stats-api/openapi.json
