# Spain Property Scraper: Pisos.com & Habitaclia, Sale & Rent (`rawtojson/spain-property-listings`) Actor

Scrape homes for sale and rent in Spain from Pisos.com and Habitaclia in one JSON schema: price, m2, rooms, zone, coordinates, agency. Incremental mode returns only new listings and price drops. No login, no proxy. Pay per listing.

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

## Pricing

$1.00 / 1,000 listing returneds

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 Scraper: Pisos.com and Habitaclia listings, sale and rent

**Scrape Spanish real estate listings** from **Pisos.com** and **Habitaclia** in **one clean JSON format**: price, price per m², size, rooms, bathrooms, zone, coordinates and agency, for homes **for sale** and **for rent**. **No login, no proxy, no API key.** In **incremental mode** each run returns only **new listings and price drops**, so scheduled monitoring only pays for what matters.

Idealista and Fotocasa are protected against automated access. This Actor covers two large Spanish portals that are not, and joins them in a single schema, so you maintain one integration instead of two. It does **not** return Idealista or Fotocasa data.

### Who is it for

- **Real estate agencies and investors:** spot new listings and price drops below market in a city, every day.
- **Proptech and data teams:** feed a CRM, dashboard or model with fresh structured data.
- **Analysts:** price per m² by zone for sale listings, rent levels by city.
- **n8n, Make and AI-agent builders:** compact JSON ready for an LLM.

### Quick start

Paste this in the Console and press **Start** (about 15 seconds, 20 listings):

```json
{
  "cities": ["madrid"],
  "maxListingsPerSource": 10
}
```

Real output (shortened):

```json
{
  "portal": "pisos.com",
  "operation": "sale",
  "title": "Piso en calle del General Álvarez de Castro",
  "price": 1050000,
  "currency": "EUR",
  "pricePerM2": 9292,
  "areaM2": 113,
  "rooms": 3,
  "bathrooms": 1,
  "zone": "Trafalgar",
  "city": "Madrid Capital",
  "latitude": 40.4353091,
  "longitude": -3.7019234,
  "agency": "Tengacasa",
  "url": "https://www.pisos.com/comprar/piso-trafalgar28010-65067693696_440000/"
}
```

### Input

| Field | Type | Description |
|---|---|---|
| `operation` | string | `sale` or `rent`. Default `sale`. |
| `cities` | array | Cities or provinces as they appear in portal URLs: `madrid`, `barcelona`, `valencia`, `sevilla`... Accents and spaces are handled. |
| `portals` | array | `pisos.com`, `habitaclia` or both (default). |
| `propertyType` | string | Pisos.com only: `pisos` (apartments) or `casas` (houses). Habitaclia returns all residential types. |
| `startUrls` | array | Optional. Paste search-result pages from either portal with your own filters (zone, price, rooms...). |
| `maxListingsPerSource` | integer | Per city and portal. Default `100`. In incremental mode this is how many listings are checked. |
| `onlyNewOrChanged` | boolean | Incremental mode. Default `false`. |
| `minPrice`, `maxPrice`, `minRooms`, `minAreaM2` | integer | Optional filters. Filtered-out listings are not charged. |

Daily monitoring example:

```json
{
  "operation": "sale",
  "cities": ["madrid", "barcelona"],
  "maxListingsPerSource": 200,
  "onlyNewOrChanged": true,
  "maxPrice": 450000,
  "minRooms": 2
}
```

### Output

One dataset item per listing: `portal`, `id`, `url`, `operation`, `propertyType`, `title`, `price`, `currency`, `pricePerM2`, `areaM2`, `rooms`, `bathrooms`, `floor`, `zone`, `city`, `region`, `postalCode`, `latitude`, `longitude`, `sellerType`, `agency`, `agencyUrl`, `description`, `imageUrl`, `changeType`, `previousPrice`, `scrapedAt`.

`changeType` is `new` or `price_changed` in incremental mode (otherwise `null`). Habitaclia listings include postal code and region but no coordinates or agency in the public listing page. `pricePerM2` is only calculated for sale listings.

### Pricing compared with other Actors

**Pay per event: you only pay for the listings you receive.** Filtered-out listings and unchanged listings in incremental mode are free, as are searches that cannot be read.

| Actor | Portal | Price per 1,000 listings |
|---|---|---|
| **This Actor (rawtojson)** | Pisos.com + Habitaclia | **$1.00** |
| igolaizola/idealista-scraper | Idealista | $0.90 + start fee |
| memo23/idealista-scraper | Idealista | $1.00 + start fee |
| azzouzana/fotocasa scraper | Fotocasa | $0.70 + start fee |

Prices of other Actors taken from their public Store pages in November 2026 and may change. Those Actors cover other portals; this one is for Pisos.com and Habitaclia and includes built-in new-listing and price-drop detection. Set a maximum cost per run in the Apify run options and the Actor stops cleanly when it is reached.

### Schedule it and send the data to Google Sheets, Slack or a webhook

- **Daily alerts:** click **Save as task**, set `onlyNewOrChanged: true`, then **Schedules** to run it every day. Each run returns only new listings and price changes.
- **Google Sheets:** use the Apify integration "Export to Google Sheets" on the task, or in n8n / Make use "Run Actor" followed by "Add row" in Google Sheets.
- **Webhook:** add a webhook on the event "Run succeeded" in the task to call Slack, email, Zapier or your own API.
- **Price drops only:** filter the output for `changeType = price_changed` where `price < previousPrice`.
- **AI agents (MCP):** call it through the Apify MCP server (`mcp.apify.com`).

### Limits and good to know

- Only public search-result pages are read. The Actor does not log in and does not open each listing's detail page.
- **Personal data:** the Actor does not collect phone numbers or names of private sellers. It returns property data and the agency name for professional listings only. If you combine the data with other sources, you are responsible for complying with the GDPR.
- The Pisos.com page for a big city can include nearby municipalities from the same province (for example a `barcelona` rent search can include towns such as Vic or Sabadell). Habitaclia returns the city itself. Use `zone` and `city` to filter.
- Habitaclia incremental mode follows the portal's default order (relevance), so use a generous `maxListingsPerSource` for markets with many new listings per day.
- Listings can appear on both portals. Use `portal` and `id` to deduplicate, or compare `title`, `price` and `areaM2`.
- Portals can change their pages at any time. If a run returns an item with an `error` field, check that the city or URL opens in your browser, and open an issue if it does.

### FAQ

**Do I need an account or API key?** No.

**Does it include Idealista or Fotocasa?** No. Only Pisos.com and Habitaclia.

**Does it work for rent and for sale?** Yes: set `operation` to `rent` or `sale`.

**Can I use my own filters?** Yes: paste a search URL with your filters from either portal into `startUrls`.

**How do I get only price drops?** Turn on `onlyNewOrChanged` and filter the output for `changeType = price_changed` where `price < previousPrice`.

**Why is a city name not found?** Use the name as it appears in the portal URL (for example `a-coruna`). Items with an `error` field tell you which search failed.

### Legal notice

The Actor reads only public search-result pages of Pisos.com and Habitaclia. It is not affiliated with either portal. Respect the portals' terms and applicable law, including the GDPR, and use the data for lawful purposes only.

### En español (resumen)

**Scraper de inmuebles de España** para **Pisos.com** y **Habitaclia**: viviendas en venta y alquiler en un único formato JSON, con precio, precio por m², superficie, habitaciones, baños, zona, coordenadas y agencia. Sin login, sin proxy y sin API key. Con el **modo incremental** (`onlyNewOrChanged`) cada ejecución devuelve solo los anuncios nuevos o con cambio de precio, y solo pagas por ellos (1 $ por cada 1.000 anuncios). Programa una ejecución diaria y envía los resultados a Google Sheets, Slack o un webhook. No incluye Idealista ni Fotocasa. Puedes pegar tus propias URLs de búsqueda con filtros en `startUrls`.

### Support

Found a bug or need another field? Open an issue on the Actor page; issues are answered within 24 hours. More Actors by rawtojson at **https://rawtojson.com**.

# Actor input Schema

## `operation` (type: `string`):

Homes for sale or for rent.

## `cities` (type: `array`):

Spanish cities or provinces as they appear in the portal URLs, for example madrid, barcelona, valencia, sevilla. Accents and spaces are handled for you.

## `portals` (type: `array`):

Which portals to read. Both are used by default.

## `propertyType` (type: `string`):

Pisos.com lets you choose apartments or houses. Habitaclia always returns all residential types.

## `startUrls` (type: `array`):

Paste listing-result pages from Pisos.com or Habitaclia with your own filters (zone, price, rooms…). They are read in addition to the cities above.

## `maxListingsPerSource` (type: `integer`):

Stops after this many listings for each portal and city.

## `onlyNewOrChanged` (type: `boolean`):

Return only listings not seen in your previous run or whose price changed. You are charged only for those.

## `minPrice` (type: `integer`):

Skip listings cheaper than this price in EUR (monthly rent if operation is rent). Skipped listings are not charged. Leave empty for no limit.

## `maxPrice` (type: `integer`):

Skip listings more expensive than this price in EUR (monthly rent if operation is rent). Skipped listings are not charged. Leave empty for no limit.

## `minRooms` (type: `integer`):

Skip listings with fewer bedrooms than this. Skipped listings are not charged. Leave empty for no filter.

## `minAreaM2` (type: `integer`):

Skip listings smaller than this many square metres. Skipped listings are not charged. Leave empty for no filter.

## Actor input object example

```json
{
  "operation": "sale",
  "cities": [
    "madrid"
  ],
  "portals": [
    "pisos.com",
    "habitaclia"
  ],
  "propertyType": "pisos",
  "maxListingsPerSource": 20,
  "onlyNewOrChanged": false
}
```

# Actor output Schema

## `listings` (type: `string`):

Homes for sale or rent from Pisos.com and Habitaclia.

# 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 = {
    "cities": [
        "madrid"
    ],
    "maxListingsPerSource": 20
};

// Run the Actor and wait for it to finish
const run = await client.actor("rawtojson/spain-property-listings").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 = {
    "cities": ["madrid"],
    "maxListingsPerSource": 20,
}

# Run the Actor and wait for it to finish
run = client.actor("rawtojson/spain-property-listings").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 '{
  "cities": [
    "madrid"
  ],
  "maxListingsPerSource": 20
}' |
apify call rawtojson/spain-property-listings --silent --output-dataset

```

## MCP server setup

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

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/bXEoknIBqQoYYwIe6/builds/E0ihSiYbFNFuRZQrm/openapi.json
