# Spain Housing Price Index (INE Official Data) (`sourcewise/spain-housing-price-index`) Actor

Quarterly official housing price index by region/province from Spain's National Statistics Institute (INE) API, with year-over-year changes, ready for spreadsheets.

- **URL**: https://apify.com/sourcewise/spain-housing-price-index.md
- **Developed by:** [Sourcewise](https://apify.com/sourcewise) (community)
- **Categories:** Real estate, Developer tools
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.75 / 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.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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

## Spain Housing Price Index (INE Official Data)

Fetch the quarterly official housing price index published by Spain's National Statistics Institute (INE). The actor returns index values (base 2015 = 100) and year‑over‑year changes for each autonomous community, ready for spreadsheets, dashboards or further analysis.

### Who it’s for

- Real‑estate analysts and investors tracking Spanish housing trends
- Researchers and economists needing a clean, quarterly time series
- Prop‑tech products that embed official price indicators
- Consultants preparing market reports for clients

### Use cases

- Build regional price‑trend charts for the last years
- Compare new vs. existing housing dynamics (choose index variant)
- Feed machine‑learning models with a reliable macro indicator
- Automate quarterly updates for internal dashboards

### Input

| Parameter | Type | Description | Example |
|-----------|------|-------------|---------|
| **regions** | array\[string] | Autonomous communities to retrieve (e.g. `Madrid`, `Cataluña`, `Andalucía`). Leave empty for all. INE publishes only by region, not by province. | `["Madrid", "Cataluña", "Andalucía"]` |
| **dateFrom** | string | First quarter to include, format `YYYY-QN` (e.g. `2023-Q1`). Empty = earliest available. | `"2023-Q1"` |
| **dateTo** | string | Last quarter to include, format `YYYY-QN` (e.g. `2024-Q4`). Empty = latest available. | `"2024-Q4"` |
| **indexType** | string | Which IPV series: `general` (overall), `new` (new housing), `existing` (second‑hand). Default `general`. | `"general"` |
| **maxItems** | integer | Maximum number of records to return (protects against runaway runs). | `100` |

**Full example input (tested and returning data today):**

{
"regions": \["Madrid", "Cataluña", "Andalucía"],
"dateFrom": "2023-Q1",
"dateTo": "2024-Q4",
"indexType": "general",
"maxItems": 100
}

### Output

Each record contains:

| Field | Type | Description |
|-------|------|-------------|
| **region** | string | Autonomous community name as published by INE. |
| **regionCode** | string | INE official two‑digit code (CCAA). |
| **period** | string | Quarter label `YYYY-QN` (e.g. `2024-Q1`). |
| **indexValue** | number | Index value (base 2015 = 100 unless INE changes base). |
| **yoyChange** | number | Year‑over‑year percentage change (same quarter previous year). |
| **sourceTableId** | string | INE table/series identifier used (e.g. `25171`). |

**Real example output (first two quarters for Andalucía):**

\[
{
"region": "Andalucía",
"regionCode": "01",
"period": "2023-Q1",
"indexValue": 138.89,
"yoyChange": 4.2,
"sourceTableId": "25171"
},
{
"region": "Andalucía",
"regionCode": "01",
"period": "2023-Q2",
"indexValue": 142.672,
"yoyChange": 4.5,
"sourceTableId": "25171"
}
]

### Pricing

$2.50 per 1,000 results (pay‑per‑event). The actor charges only for records actually returned.

### Limits

- Default `maxItems` = 100; increase via input if you need more.
- INE API rate limits apply; the actor respects them automatically.
- No authentication required – data is public.

### Source & licence

Data © Instituto Nacional de Estadística (INE), published under the **CC BY 4.0** licence. This tool is not endorsed by INE.

***

*Built for the Apify Store. Insert your own Apify token and run the actor to start collecting official Spanish housing price indices.*

### Example output

```json
[
  {
    "region": "Andalucía",
    "regionCode": "01",
    "period": "2023-Q1",
    "indexValue": 138.89,
    "yoyChange": 4.2,
    "sourceTableId": "25171"
  },
  {
    "region": "Andalucía",
    "regionCode": "01",
    "period": "2023-Q2",
    "indexValue": 142.672,
    "yoyChange": 4.5,
    "sourceTableId": "25171"
  }
]
```

# Actor input Schema

## `regions` (type: `array`):

Autonomous Communities (e.g. Madrid, Cataluña, Andalucía, Comunitat Valenciana), or 'Nacional' for Spain as a whole. Leave empty for all. INE publishes this index by region only, not by province.

## `dateFrom` (type: `string`):

First quarter to include, format YYYY-QN (e.g. '2020-Q1'). Empty = from earliest available.

## `dateTo` (type: `string`):

Last quarter to include, format YYYY-QN (e.g. '2024-Q4'). Empty = latest available.

## `indexType` (type: `string`):

Which IPV series: 'general' (overall), 'new' (new housing), 'existing' (second-hand). Default 'general'.

## `maxItems` (type: `integer`):

Stop after this many results (you pay per result).

## Actor input object example

```json
{
  "regions": [
    "Madrid",
    "Cataluña",
    "Andalucía"
  ],
  "dateFrom": "2023-Q1",
  "dateTo": "2024-Q4",
  "indexType": "general",
  "maxItems": 100
}
```

# Actor output Schema

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

One item per result, with: region, regionCode, period, indexValue, yoyChange, sourceTableId.

## `summary` (type: `string`):

How many results the run returned, and when it finished.

# 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 = {
    "regions": [
        "Madrid",
        "Cataluña",
        "Andalucía"
    ],
    "dateFrom": "2023-Q1",
    "dateTo": "2024-Q4",
    "indexType": "general"
};

// Run the Actor and wait for it to finish
const run = await client.actor("sourcewise/spain-housing-price-index").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 = {
    "regions": [
        "Madrid",
        "Cataluña",
        "Andalucía",
    ],
    "dateFrom": "2023-Q1",
    "dateTo": "2024-Q4",
    "indexType": "general",
}

# Run the Actor and wait for it to finish
run = client.actor("sourcewise/spain-housing-price-index").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 '{
  "regions": [
    "Madrid",
    "Cataluña",
    "Andalucía"
  ],
  "dateFrom": "2023-Q1",
  "dateTo": "2024-Q4",
  "indexType": "general"
}' |
apify call sourcewise/spain-housing-price-index --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,sourcewise/spain-housing-price-index"
        }
    }
}
```

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/kCwodVwxN6wbHNdpI/builds/GDQ9ERyIU375jdiAN/openapi.json
