# Latvia Statistics API
> Official Latvian statistics from the Official Statistics Portal of Latvia (Central Statistical Bureau, CSB) as a clean, keyless JSON API. Get the latest Latvian consumer price index and inflation — the monthly index (2025 = 100) with both the month-on-month and year-on-year change, straight from the source — pull any table in the Latvian PxWeb catalogue as a tidy time-series (economy, prices, population, labour market, trade, business and more), inspect a table's variables and value codes, and browse the subject tree. A thin gateway over the Official Statistics of Latvia PxWeb API: you supply a table path (relative, e.g. VEK/PC/PCI/PCI021m) with optional dimension selection, we return tidy period/value observations. Ideal for inflation trackers, Baltic and Eurozone macro research and economic dashboards.

## 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/latvia-stats-api/..."
```

## Pricing
- **Free** (Free) — 2,300 calls/Mo, 3 req/s
- **Basic** ($11/Mo) — 47,000 calls/Mo, 10 req/s
- **Pro** ($28/Mo) — 188,000 calls/Mo, 25 req/s
- **Mega** ($63/Mo) — 808,000 calls/Mo, 60 req/s

## Endpoints

### Inflation

#### `GET /v1/cpi` — Latest Latvian CPI and inflation

**Parameters:**
- `periods` (query, optional, string) — Number of recent months (1-120) Example: `12`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/latvia-stats-api/v1/cpi?periods=12"
```

**Response:**
```json
{
    "data": {
        "base": "2025 = 100",
        "table": "VEK/PC/PCI/PCI021m",
        "latest": {
            "period": "2026M05",
            "index_value": 103.8,
            "change_annual_pct": 3.5,
            "change_monthly_pct": 0.5
        },
        "series": [
            {
                "period": "2026M05",
                "index_value": 103.8,
                "change_annual_pct": 3.5,
                "change_monthly_pct": 0.5
            },
            {
                "period": "2026M04",
                "index_value": 103.3,
                "change_annual_pct": 2.9,
                "change_monthly_pct": 0.6
            },
            {
                "period": "2026M03",
                "index_value": 102.7,
                "change_annual_pct": 3.4,
                "change_monthly_pct": 1.9
            },
            {
                "period": "2026M02",
                "index_value": 100.8,
                "change_annual_pct": 2.3,
                "change_monthly_pct": 0.2
            },
            {
                "period": "2026M01",
                "index_value": 100.5,
                "change_annual_pct": 2.9,
                "change_monthly_pct": 0
            },
            {
                "period": "2025M12",
                "index_value": 100.5,
                "change_annual_pct": 3.5,
                "change_monthly_pct": -0.1
            },
            {
                "period": "2025M11",
                "index_value": 100.6,
     
…(truncated, see openapi.json for full schema)
```

### Data

#### `GET /v1/series` — Any Latvian PxWeb table as a time-series

**Parameters:**
- `path` (query, required, string) — Table path relative to OSP_PUB Example: `VEK/PC/PCI/PCI021m`
- `select` (query, optional, string) — Dimension constraints "Code:Value;Code:Value" Example: `ECOICOP_V2:0;ContentsCode:PCI021m`
- `periods` (query, optional, string) — Recent periods (1-240) Example: `12`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/latvia-stats-api/v1/series?path=VEK%2FPC%2FPCI%2FPCI021m&select=ECOICOP_V2%3A0%3BContentsCode%3APCI021m&periods=12"
```

**Response:**
```json
{
    "data": {
        "path": "VEK/PC/PCI/PCI021m",
        "count": 12,
        "title": "Consumer price indices by commodity groups (2025=100) by Commodity group (ECOICOP ver.2) and Time period",
        "series": [
            {
                "value": 103.8,
                "period": "2026M05",
                "period_label": "2026M05"
            },
            {
                "value": 103.3,
                "period": "2026M04",
                "period_label": "2026M04"
            },
            {
                "value": 102.7,
                "period": "2026M03",
                "period_label": "2026M03"
            },
            {
                "value": 100.8,
                "period": "2026M02",
                "period_label": "2026M02"
            },
            {
                "value": 100.5,
                "period": "2026M01",
                "period_label": "2026M01"
            },
            {
                "value": 100.5,
                "period": "2025M12",
                "period_label": "2025M12"
            },
            {
                "value": 100.6,
                "period": "2025M11",
                "period_label": "2025M11"
            },
            {
                "value": 100.9,
                "period": "2025M10",
                "period_label": "2025M10"
            },
            {
                "value": 100.5,
                "period": "2025M09",
                "period_label": "2025M09"
            },
            {
      
…(truncated, see openapi.json for full schema)
```

### Catalog

#### `GET /v1/catalog` — Browse the subject tree

**Parameters:**
- `path` (query, optional, string) — Sub-path to list (omit for root) Example: `VEK/PC`
- `limit` (query, optional, string) — Max items (1-400) Example: `100`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/latvia-stats-api/v1/catalog?path=VEK%2FPC&limit=100"
```

**Response:**
```json
{
    "data": {
        "path": "VEK/PC",
        "count": 4,
        "items": [
            {
                "id": "PCI",
                "text": "Consumer price index and changes",
                "type": "folder"
            },
            {
                "id": "PCS",
                "text": "Harmonized consumer price index and changes",
                "type": "folder"
            },
            {
                "id": "PCC",
                "text": "Average retail trade prices",
                "type": "folder"
            },
            {
                "id": "A_PC",
                "text": "Archive - consumer prices",
                "type": "folder"
            }
        ]
    },
    "meta": {
        "timestamp": "2026-06-15T20:41:18.414Z",
        "request_id": "cd8b2603-1d25-4c94-b632-6afb2dee1f47"
    },
    "status": "ok",
    "message": "Catalog retrieved successfully",
    "success": true
}
```

#### `GET /v1/table` — Table metadata (variables and value codes)

**Parameters:**
- `path` (query, required, string) — Table path relative to OSP_PUB Example: `VEK/PC/PCI/PCI021m`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/latvia-stats-api/v1/table?path=VEK%2FPC%2FPCI%2FPCI021m"
```

**Response:**
```json
{
    "data": {
        "path": "VEK/PC/PCI/PCI021m",
        "title": "Consumer price indices and changes by commodity groups (ECOICOP ver.2) by Commodity group (ECOICOP ver.2), Indicator and Time period",
        "variables": [
            {
                "code": "ECOICOP_V2",
                "text": "Commodity group (ECOICOP ver.2)",
                "time": false,
                "n_values": 375,
                "sample_values": [
                    {
                        "code": "0",
                        "text": "GOODS AND SERVICES - TOTAL"
                    },
                    {
                        "code": "20.01",
                        "text": "Goods - total"
                    },
                    {
                        "code": "20.02",
                        "text": "Non-food goods"
                    },
                    {
                        "code": "20.03",
                        "text": "Services"
                    },
                    {
                        "code": "20.04",
                        "text": "Food, alcoholic beverages and tobacco"
                    },
                    {
                        "code": "01",
                        "text": "Food and non-alcoholic beverages"
                    }
                ]
            },
            {
                "code": "ContentsCode",
                "text": "Indicator",
                "time": false,
                "n_values": 6,
                "sample_va
…(truncated, see openapi.json for full schema)
```

### Meta

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

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

**Response:**
```json
{
    "data": {
        "note": "path is relative to OSP_PUB, e.g. VEK/PC/PCI/PCI021m (consumer prices).",
        "source": "Official Statistics of Latvia (Central Statistical Bureau, CSB)",
        "upstream": "https://data.stat.gov.lv/api/v1/en/OSP_PUB",
        "cpi_table": "VEK/PC/PCI/PCI021m",
        "endpoints": [
            "/v1/cpi",
            "/v1/series",
            "/v1/table",
            "/v1/catalog",
            "/v1/meta"
        ],
        "description": "Keyless gateway over the Official Statistics of Latvia PxWeb API. /v1/cpi gives the latest Latvian consumer price index and inflation (index + monthly + year-on-year change); /v1/series pulls any table as a clean time-series; /v1/table inspects a table's variables; /v1/catalog browses the subject tree.",
        "documentation": "https://latvia-stats-api.oanor.dev"
    },
    "meta": {
        "timestamp": "2026-06-15T20:41:18.650Z",
        "request_id": "f4d34a6f-7839-438d-9759-a69f543aaacd"
    },
    "status": "ok",
    "message": "Meta",
    "success": true
}
```


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