# INE Spain Statistics API: CPI, Unemployment, GDP Series (`sefran1/ine-spain-statistics`) Actor

Fetch official Spanish statistics from INE (Instituto Nacional de Estadística) by series code or table: IPC/CPI inflation, EPA unemployment, GDP, housing prices and more. Clean JSON rows, $0.0005 per data point.

- **URL**: https://apify.com/sefran1/ine-spain-statistics.md
- **Developed by:** [Iberia Channel Desk](https://apify.com/sefran1) (community)
- **Categories:** Business, Developer tools, AI
- **Stats:** 1 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.50 / 1,000 results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## INE Spain Statistics API

Pull **official Spanish statistics** from the **INE (Instituto Nacional de Estadística)** API (Tempus3) as tidy JSON rows: **CPI / IPC inflation, EPA unemployment, GDP (PIB), house price index, population, tourism** and every other INE series or table.

### Sample output (real run of the default input, 6 s)

| seriesName | date | value | provisional |
|---|---|---|---|
| Hogares. Sin Ocupados. Total Nacional. Ambos sexos. Total. Total. | 2026-04-01 | 6291.9 |  |
| Hogares. Sin Ocupados. Total Nacional. Ambos sexos. Total. Total. | 2026-01-01 | 6358 |  |
| Hogares. Sin Ocupados. Total Nacional. Ambos sexos. Total. 0. | 2026-04-01 | 521.7 |  |
| Hogares. Sin Ocupados. Total Nacional. Ambos sexos. Total. 0. | 2026-01-01 | 544.3 |  |
| Hogares. Sin Ocupados. Total Nacional. Ambos sexos. Total. 1. | 2026-04-01 | 4055.5 |  |

<details><summary>One full JSON row</summary>

```json
{
  "seriesCode": "EPA431108",
  "seriesName": "Hogares. Sin Ocupados. Total Nacional. Ambos sexos. Total. Total.",
  "tableId": "65283",
  "date": "2026-04-01",
  "year": 2026,
  "period": 20,
  "value": 6291.9,
  "provisional": null,
  "secret": false
}
```

</details>

Give series codes or table IDs and the number of recent periods; get one row per data point with date, value and series name. Great for dashboards, economic research, and grounding AI agents with real Spanish data.

### Input example

```json
{
  "tableIds": [
    "65283"
  ],
  "lastN": 4
}
```

### Output example

```json
{"seriesCode":"IPC251856","seriesName":"Total Nacional. Índice general. Variación anual.","date":"2026-09-01","year":2026,"period":9,"value":2.1}
```

**Find codes:** open the table on ine.es, the table id is the `t=` value in the URL; series codes appear in each series' detail. INE re-bases some series (for example CPI) and gives the new base new codes; old codes keep returning their historic data.

### Use from an AI agent (API or MCP)

Add `https://mcp.apify.com?tools=sefran1/ine-spain-statistics` to Claude, Cursor, VS Code or any MCP client and the Actor becomes the tool `sefran1--ine-spain-statistics`. Or call the API:

```bash
curl -X POST "https://api.apify.com/v2/acts/sefran1~ine-spain-statistics/run-sync-get-dataset-items?token=$APIFY_TOKEN" \
  -H 'Content-Type: application/json' -d '{"seriesCodes":["IPC251856"],"lastN":24}'
```

Schedule it daily in Apify (Schedules) and send new results to Google Sheets, Slack, Make, Zapier or a webhook.

### Pricing

Pay per result: **$0.0005 per data point** ($0.5 per 1,000). No subscription. Runs that find nothing cost only the tiny start fee.

### Data source and legal note

Data: INE JSON API (servicios.ine.es/wstempus), official statistics reusable with attribution (source: INE). This Actor only reads official public open data through the publisher's own API or feed, at a polite rate. It is not affiliated with or endorsed by the publisher. Check the original source before relying on any result.

# Actor input Schema

## `seriesCodes` (type: `array`):

INE series codes, e.g. IPC251852 (CPI index), IPC251856 (CPI annual %).

## `tableIds` (type: `array`):

INE table ids (from the INE URL ?t=...), e.g. 65283 (EPA labour force survey).

## `lastN` (type: `integer`):

No description

## `language` (type: `string`):

Series names language.

## Actor input object example

```json
{
  "seriesCodes": [],
  "tableIds": [
    "65283"
  ],
  "lastN": 2,
  "language": "ES"
}
```

# Actor output Schema

## `results` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "seriesCodes": [],
    "tableIds": [
        "65283"
    ],
    "lastN": 2
};

// Run the Actor and wait for it to finish
const run = await client.actor("sefran1/ine-spain-statistics").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "seriesCodes": [],
    "tableIds": ["65283"],
    "lastN": 2,
}

# Run the Actor and wait for it to finish
run = client.actor("sefran1/ine-spain-statistics").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "seriesCodes": [],
  "tableIds": [
    "65283"
  ],
  "lastN": 2
}' |
apify call sefran1/ine-spain-statistics --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,sefran1/ine-spain-statistics"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/ZbULv4IzivecCIKRp/builds/HN7eD5UnLftHqj1AN/openapi.json
