# Spain Statistics API
> Official Spanish statistics from Statistics Spain (Instituto Nacional de Estadística, INE) as a clean, keyless JSON API. Get the latest Spanish consumer price index and inflation — index level (base 2021 = 100), month-on-month and year-on-year change — fetch any INE time-series by its code, pull all the series of a statistical table (prices, labour, population, national accounts, industry, trade and more), and browse the catalogue of statistical operations. A thin gateway over INE's Tempus3 JSON API: you supply a series or table identifier and how many recent periods you want, we return tidy observations with ISO dates and values. Ideal for inflation trackers, Spanish 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/spain-stats-api/..."
```

## Pricing
- **Free** (Free) — 3,000 calls/Mo, 3 req/s
- **Basic** ($13/Mo) — 55,000 calls/Mo, 10 req/s
- **Pro** ($32/Mo) — 208,000 calls/Mo, 25 req/s
- **Mega** ($70/Mo) — 848,000 calls/Mo, 60 req/s

## Endpoints

### Inflation

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

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

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

**Response:**
```json
{
    "data": {
        "base": "2021 = 100",
        "table": "50902",
        "latest": {
            "year": 2025,
            "month": 12,
            "date_iso": "2025-11-30",
            "index_value": 119.942,
            "change_annual_pct": 2.9,
            "change_monthly_pct": 0.3
        },
        "series": [
            {
                "year": 2025,
                "month": 12,
                "date_iso": "2025-11-30",
                "index_value": 119.942,
                "change_annual_pct": 2.9,
                "change_monthly_pct": 0.3
            },
            {
                "year": 2025,
                "month": 11,
                "date_iso": "2025-10-31",
                "index_value": 119.532,
                "change_annual_pct": 3,
                "change_monthly_pct": 0.2
            },
            {
                "year": 2025,
                "month": 10,
                "date_iso": "2025-09-30",
                "index_value": 119.301,
                "change_annual_pct": 3.1,
                "change_monthly_pct": 0.7
            },
            {
                "year": 2025,
                "month": 9,
                "date_iso": "2025-08-31",
                "index_value": 118.485,
                "change_annual_pct": 3,
                "change_monthly_pct": -0.3
            },
            {
                "year": 2025,
                "month": 8,
                "date_iso": "2025-07-31",
                "index_value": 118.824,
          
…(truncated, see openapi.json for full schema)
```

### Data

#### `GET /v1/series` — Any INE time-series by code

**Parameters:**
- `serie` (query, required, string) — INE series code Example: `IPC251852`
- `periods` (query, optional, string) — Recent observations (1-240) Example: `12`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/spain-stats-api/v1/series?serie=IPC251852&periods=12"
```

**Response:**
```json
{
    "data": {
        "name": "National. Overall index. Index.",
        "unit": 133,
        "count": 12,
        "serie": "IPC251852",
        "observations": [
            {
                "year": 2025,
                "value": 119.942,
                "period": 12,
                "date_iso": "2025-11-30"
            },
            {
                "year": 2025,
                "value": 119.532,
                "period": 11,
                "date_iso": "2025-10-31"
            },
            {
                "year": 2025,
                "value": 119.301,
                "period": 10,
                "date_iso": "2025-09-30"
            },
            {
                "year": 2025,
                "value": 118.485,
                "period": 9,
                "date_iso": "2025-08-31"
            },
            {
                "year": 2025,
                "value": 118.824,
                "period": 8,
                "date_iso": "2025-07-31"
            },
            {
                "year": 2025,
                "value": 118.777,
                "period": 7,
                "date_iso": "2025-06-30"
            },
            {
                "year": 2025,
                "value": 118.867,
                "period": 6,
                "date_iso": "2025-05-31"
            },
            {
                "year": 2025,
                "value": 118.077,
                "period": 5,
                "date_iso": "2025-04-30"
            },
            {
              
…(truncated, see openapi.json for full schema)
```

#### `GET /v1/table` — All series of an INE statistical table

**Parameters:**
- `table` (query, required, string) — INE table id Example: `50902`
- `periods` (query, optional, string) — Recent periods (1-60) Example: `1`
- `limit` (query, optional, string) — Max series (1-500) Example: `50`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/spain-stats-api/v1/table?table=50902&periods=1&limit=50"
```

**Response:**
```json
{
    "data": {
        "table": "50902",
        "series": [
            {
                "cod": "IPC251852",
                "name": "National. Overall index. Index.",
                "observations": [
                    {
                        "year": 2025,
                        "value": 119.942,
                        "period": 12,
                        "date_iso": "2025-11-30"
                    }
                ]
            },
            {
                "cod": "IPC251855",
                "name": "National. Overall index. Monthly change.",
                "observations": [
                    {
                        "year": 2025,
                        "value": 0.3,
                        "period": 12,
                        "date_iso": "2025-11-30"
                    }
                ]
            },
            {
                "cod": "IPC251856",
                "name": "National. Overall index. Annual change.",
                "observations": [
                    {
                        "year": 2025,
                        "value": 2.9,
                        "period": 12,
                        "date_iso": "2025-11-30"
                    }
                ]
            },
            {
                "cod": "IPC251858",
                "name": "National. Overall index. Year-to-date change.",
                "observations": [
                    {
                        "year": 2025,
                        "value": 2.9,
             
…(truncated, see openapi.json for full schema)
```

### Catalog

#### `GET /v1/operations` — List INE statistical operations

**Parameters:**
- `page` (query, optional, string) — Catalogue page (1-50) Example: `1`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/spain-stats-api/v1/operations?page=1"
```

**Response:**
```json
{
    "data": {
        "page": 1,
        "count": 112,
        "operations": [
            {
                "id": 4,
                "ioe": "30147",
                "code": "EI",
                "name": "Estadística de Efectos de Comercio Impagados"
            },
            {
                "id": 6,
                "ioe": "30211",
                "code": "ICLA",
                "name": "Índice de Coste Laboral Armonizado"
            },
            {
                "id": 7,
                "ioe": "30168",
                "code": "ETDP",
                "name": "Estadística de Transmisión de Derechos de la Propiedad"
            },
            {
                "id": 10,
                "ioe": "30256",
                "code": "UA",
                "name": "Indicadores Urbanos"
            },
            {
                "id": 13,
                "ioe": "30219",
                "code": "EPC",
                "name": "Estadística del Procedimiento Concursal"
            },
            {
                "id": 14,
                "ioe": "30182",
                "code": "IPS",
                "name": "Índices de Precios del Sector Servicios"
            },
            {
                "id": 15,
                "ioe": "30457",
                "code": "IPV",
                "name": "Índice de Precios de la Vivienda (IPV)"
            },
            {
                "id": 16,
                "ioe": "",
                "code": "TNOM",
                "name": "Distribuc
…(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/spain-stats-api/v1/meta"
```

**Response:**
```json
{
    "data": {
        "note": "series takes an INE series code (e.g. IPC251852); table takes an INE table id (e.g. 50902).",
        "source": "Statistics Spain (Instituto Nacional de Estadística, INE)",
        "upstream": "https://servicios.ine.es/wstempus/js/EN",
        "cpi_table": "50902",
        "endpoints": [
            "/v1/cpi",
            "/v1/series",
            "/v1/table",
            "/v1/operations",
            "/v1/meta"
        ],
        "description": "Keyless gateway over INE's Tempus3 JSON API. /v1/cpi gives the latest Spanish consumer price index and inflation; /v1/series fetches any INE time-series by code; /v1/table returns all series of a statistical table; /v1/operations lists the statistical operations catalogue.",
        "documentation": "https://spain-stats-api.oanor.dev"
    },
    "meta": {
        "timestamp": "2026-06-15T11:14:36.014Z",
        "request_id": "6768d133-210d-4781-a3f0-642995a87ed2"
    },
    "status": "ok",
    "message": "Meta",
    "success": true
}
```


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