# Spain Property Enricher — RefCat, Address & Coordinates (`icarodata/spain-property-enricher`) Actor

Enrich Spanish properties from a cadastral reference, an address or coordinates: use, built and plot surface, year built, units, floor/door, postcode, centroid lat/lon and map links. Also runs as a pack from BOE Subastas (enrichWithCatastro). Built on Catastro open web services. No owner data.

- **URL**: https://apify.com/icarodata/spain-property-enricher.md
- **Developed by:** [Icaro Data](https://apify.com/icarodata) (community)
- **Categories:** Real estate, Lead generation
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $4.00 / 1,000 property enricheds

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

## Spain Property Enricher — Cadastral Reference, Address & Coordinates

**Spain Property Enricher** turns a Spanish **cadastral reference** (referencia catastral), a **postal address** or a pair of **coordinates** into a clean, structured property record: main use, built surface, dwelling and common-area surface, year of construction and building age, plot surface, block / stair / floor / door, postcode, municipality and INE codes, construction units, rustic subparcels, parcel centroid (WGS84) and links to the official map viewer.

It is built on the free web services for **non-protected data** of the *Sede Electrónica del Catastro* (Dirección General del Catastro). No login, no API key. **No personal data**: owners, tax IDs and cadastral values are protected data that these services do not return.

Fuente: **Dirección General del Catastro**. This is a value-added product that transforms that information (normalised English schema, derived fields, joined services, geocoding). It is **not an official Catastro product**, has no legal effect and data may be outdated; check the Sede Electrónica for any legal use.

### Typical uses

- Enrich Idealista / Fotocasa / Habitaclia datasets with the official reference, built surface and year.
- Validate square metres and building age before a valuation, mortgage or due diligence.
- Geocode a list of references for GIS and maps.
- Expand a building (14-character parcel reference) into all its flats, parking spaces and shops.
- Find the property at a GPS point (rural plots, solar projects, land acquisitions).

### Input

```json
{
  "cadastralReferences": ["9872023VH5797S0001WX", "9872023VH5797S"],
  "addresses": ["Calle Alcalá 45, Madrid, Madrid", "Carrer de Mallorca 401, 3º 2ª, Barcelona, Barcelona"],
  "coordinates": ["41.4036,2.1744"],
  "maxUnitsPerParcel": 20,
  "fetchUnitDetails": true,
  "includeCoordinates": true,
  "requestDelaySecs": 1
}
```

- **20-character reference** → one property. **14-character reference** → every unit in the parcel (up to `maxUnitsPerParcel`).
- **Address**: `Street Number[, floor door], Municipality, Province`. Street names are matched against the official street directory, so `Carrer de Mallorca` or `C/ Mallorca` work. Without floor/door, every unit at that number is returned.
- **Coordinates**: WGS84 `lat,lon` in Spain.
- The Actor throttles requests (1 per second by default) to respect fair use of the public service.

### Output

```json
{
  "status": "ok",
  "inputType": "cadastral_reference",
  "cadastralReference": "9872023VH5797S0001WX",
  "parcelReference": "9872023VH5797S",
  "propertyClass": "urban",
  "address": "...",
  "province": "MADRID",
  "municipality": "MADRID",
  "postalCode": "...",
  "mainUse": "Residencial",
  "mainUseEn": "residential",
  "builtSurfaceM2": 0,
  "yearBuilt": 0,
  "buildingAgeYears": 0,
  "constructionUnits": [{"use": "VIVIENDA", "useEn": "dwelling", "floor": "..", "door": "..", "surfaceM2": 0}],
  "latitude": 40.0,
  "longitude": -3.0,
  "sedeUrl": "https://www1.sedecatastro.gob.es/...",
  "attribution": "Fuente: Dirección General del Catastro"
}
```

See `SAMPLE_OUTPUT.json` for a real record. Inputs that cannot be resolved return a free row with `status: "not_found"`, the reason and the candidates suggested by the service.

### Pricing

**$4 per 1,000 enriched properties** (pay per event). Not-found and invalid inputs are free.

### Licence and attribution

Data: Dirección General del Catastro, free web services ([licence](https://www.catastro.hacienda.gob.es/webinspire/documentos/Licencia.pdf)). Commercial reuse is authorised for value-added products in which the information has been transformed; the original information is not redistributed as such. Every row carries the attribution "Fuente: Dirección General del Catastro". The Dirección General del Catastro is not responsible for this product.

***

## Enriquecedor de inmuebles en España — referencia catastral, dirección y coordenadas

Convierte una **referencia catastral**, una **dirección** o unas **coordenadas** en un registro estructurado del inmueble: uso, superficie construida, superficie de vivienda y de elementos comunes, año de construcción y antigüedad, superficie de la parcela, bloque / escalera / planta / puerta, código postal, municipio y códigos INE, unidades constructivas, subparcelas rústicas, centroide de la parcela (WGS84) y enlaces al visor oficial.

Usa los servicios web libres de **datos no protegidos** de la Sede Electrónica del Catastro. **Sin datos personales**: titulares, NIF y valor catastral son datos protegidos que estos servicios no devuelven.

- Referencia de 20 posiciones → un inmueble. De 14 → todos los inmuebles de la finca.
- Dirección: `Calle Número[, planta puerta], Municipio, Provincia`, contrastada con el callejero oficial.
- Coordenadas WGS84 `lat,lon`.
- Peticiones espaciadas (1 por segundo por defecto) para respetar el uso razonable del servicio.

**Precio:** 4 $ por cada 1.000 inmuebles enriquecidos. Las entradas no encontradas no se cobran.

**Fuente: Dirección General del Catastro.** Producto de valor añadido que transforma la información (esquema normalizado, campos derivados, unión de servicios y geocodificación). No es un producto oficial del Catastro, carece de fehaciencia y los datos pueden estar desactualizados.

# Actor input Schema

## `cadastralReferences` (type: `array`):

20-character property references (one property) or 14-character parcel references (every unit in the building or plot). Spaces and dashes are ignored.

## `addresses` (type: `array`):

Free text 'Street Number\[, floor door], Municipality, Province' (e.g. 'Calle Alcalá 45, Madrid, Madrid' or 'Carrer de Mallorca 401, 3º 2ª, Barcelona, Barcelona'). Without floor/door, every unit at that number is returned (up to the per-parcel limit).

## `coordinates` (type: `array`):

WGS84 'latitude,longitude' pairs in Spain, e.g. '41.3917,2.1649'. The parcel at that point is enriched.

## `maxUnitsPerParcel` (type: `integer`):

When a parcel reference, address or point contains several properties (flats, parking spaces, shops), return at most this many.

## `fetchUnitDetails` (type: `boolean`):

For multi-unit parcels, query each unit for use, surface and year (one extra request per unit). Turn off to list only references and floor/door.

## `includeCoordinates` (type: `boolean`):

Add the WGS84 centroid of the parcel and map links (one cached request per parcel).

## `requestDelaySecs` (type: `number`):

Throttle to respect fair use of the public Catastro services. Minimum 0.5 s.

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

Stop after this many enriched properties (0 = no limit).

## Actor input object example

```json
{
  "cadastralReferences": [
    "9872023VH5797S0001WX"
  ],
  "addresses": [],
  "coordinates": [],
  "maxUnitsPerParcel": 20,
  "fetchUnitDetails": true,
  "includeCoordinates": true,
  "requestDelaySecs": 1,
  "maxItems": 0
}
```

# 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 = {
    "cadastralReferences": [
        "9872023VH5797S0001WX"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("icarodata/spain-property-enricher").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 = { "cadastralReferences": ["9872023VH5797S0001WX"] }

# Run the Actor and wait for it to finish
run = client.actor("icarodata/spain-property-enricher").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 '{
  "cadastralReferences": [
    "9872023VH5797S0001WX"
  ]
}' |
apify call icarodata/spain-property-enricher --silent --output-dataset

```

## MCP server setup

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

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/GtJBsV5gsXXgtTNeG/builds/0Bx7mAfCU5q9apS9L/openapi.json
