# Pisos.com Listings Scraper (`axiomworks/pisos-habitaclia-property-scraper`) Actor

Scrape public sale and rental listings from Pisos.com and Habitaclia and return one dataset with titles, prices, locations, sizes, rooms, bathrooms, photos and coordinates. Add optional detail-page data such as descriptions, agency details and property features.

- **URL**: https://apify.com/axiomworks/pisos-habitaclia-property-scraper.md
- **Developed by:** [Axiom Works](https://apify.com/axiomworks) (community)
- **Categories:** Real estate
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.55 / 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 Property Listings Scraper

**Returns:** one row per property listing with id, sourceUrl, title, price, location, sizeM2, rooms and imageUrls.
**Input:** `{"startUrls":[{"url":"https://www.pisos.com/venta/pisos-madrid/"}],"maxItems":20,"scrapeDetails":false}`
**Best for:** property price monitoring, rental market research, lead lists for real estate agencies and investors.

```json
{
  "id": "65098413759.100500",
  "sourceUrl": "https://www.pisos.com/comprar/piso-gaztambide-65098413759_100500/",
  "title": "Piso en calle de la Princesa, 76",
  "price": 1600000,
  "location": "Gaztambide (Distrito Chamberí. Madrid Capital)",
  "sizeM2": 155,
  "rooms": 3,
  "imageUrls": [
    "https://fotos.imghs.net/mm-wp/1005/101/1005_2935432214101_1_202606051854533172743.jpg",
    "https://fotos.imghs.net/mm-wp/1005/101/1005_2935432214101_2_202606051854533172928.jpg"
  ]
}
```

### What does Spain Property Listings Scraper do?

This pisos.com scraper and habitaclia.com scraper turns the public search results of two Spanish property portals into a clean dataset. Give it a search-result URL for a city or province, for sale or for rent, and it walks through the result pages and saves one row for every listing. You get a Spanish real estate API without writing a parser: the same fields come back from both portals, so a Madrid sale search on Pisos.com and a Barcelona sale search on Habitaclia.com can be merged into one table.

The Actor reads only public pages that open without an account. It is not affiliated with Pisos.com or Habitaclia.com, and it does not need a login. It paginates automatically, removes duplicate listings, stops exactly at the number of items you ask for, and retries blocked or failed requests on a fresh proxy session.

Typical uses:

Track asking prices and price per square metre in a city or district over time.

Compare rental and sale supply across Madrid, Barcelona and other Spanish cities.

Build lead lists of agencies by switching on detail pages, which add the agency name and page.

Feed listings into a spreadsheet, a BI dashboard or a machine learning model for price estimation.

### What data can you get?

Every record has the fields below. A field that a listing does not show is returned as null, so the dataset keeps one stable shape.

| Field | Type | Description |
|---|---|---|
| `id` | string | Stable listing ID (the Pisos.com ad id, or the Habitaclia.com UUID) |
| `sourceUrl` | string | Address of the listing page |
| `title` | string | Listing title |
| `operation` | string | `sale` or `rent` |
| `source` | string | `pisos.com` or `habitaclia.com` |
| `price` | number | Asking price in euros (monthly for rentals); null when the price is on request |
| `location` | string | Neighbourhood and city as shown on the card |
| `city` | string | City or municipality |
| `province` | string | Province |
| `sizeM2` | number | Built area in square metres |
| `pricePerM2` | number | Price divided by sizeM2, euros, null when either is missing |
| `rooms` | number | Number of bedrooms |
| `bathrooms` | number | Number of bathrooms |
| `floor` | string | Floor as shown on the card |
| `propertyType` | string | Type of property, such as Piso, Casa or Ático |
| `description` | string | Description text: a card excerpt, or the full text with detail pages on |
| `imageUrls` | array | Photo URLs, with Pisos resize variants deduplicated by the source photo filename |
| `photoCount` | number | Total number of photos in the listing |
| `latitude`, `longitude` | number | Coordinates when present in the source; may be null |
| `agencyName` | string | Agency name (detail pages on) |
| `agencyUrl` | string | Agency page URL |
| `features` | object | Feature table from the detail page: reference, condition, age, orientation and extras (Pisos.com) |

Fill rates depend on the listing. Price, size, rooms and bathrooms are present on nearly every card. Floor is missing for houses and ground-floor properties, and some listings show "consultar precio" instead of a number.

### How to use

1. Open the Actor in Apify Console and go to the Input tab.
2. Paste one or more search-result URLs from Pisos.com or Habitaclia.com into **Pisos or Habitaclia URL objects**. Open the portal in your browser, choose the operation (buy or rent), the city and any filters in the URL path, and copy the address.
3. Set **Shared maximum listing count** to the number of rows you need.
4. Turn on **Fetch optional listing details** if you need the agency, the full description, the reference and the other features.
5. Click Start. Results appear in the Output tab as soon as the first page is read. Download them as JSON, CSV, Excel or HTML, or read them through the API.

The maxItems budget is shared across all targets, and only matching unique records count toward it. Filters run after extraction. Missing values do not pass an enabled numeric filter. If a search returns no rows, widen the filters or check the search URL; if requests are blocked, change the proxy configuration.

If you do not have a URL, leave the URL list empty and fill in **City name or slug** (for example `madrid`), **Sale or rent for location search** and **Portals for location search**. The Actor builds the search address for you. This is convenient for Pisos.com. For Habitaclia.com, province and city are part of the path, so pasting a URL copied from the site is more reliable.

Supported URL shapes:

`https://www.pisos.com/venta/pisos-madrid/` and `https://www.pisos.com/alquiler/pisos-barcelona/`

`https://www.habitaclia.com/comprar/viviendas/barcelona-provincia/barcelona-capital/s`

A single listing URL is accepted, but saving it depends on the page containing a parsable listing card. If no card is found, use a search-result URL instead.

Pages are requested politely, about one to two requests per second, with retries and backoff when a portal answers with an error.

### Input

| Field | Type | Description |
|---|---|---|
| `startUrls` | array | Pisos.com or Habitaclia.com search-result URLs. Pagination is followed automatically. |
| `maxItems` | integer | Maximum number of listings to save across all URLs, 1 to 10000, default 50. |
| `propertyType` | string | With `location`: `all` (default), `flats` or `houses`. |
| `minPrice`, `maxPrice` | integer | Keep only listings in this price range in euros. Listings without a price are skipped when set. |
| `minSizeM2`, `minRooms` | integer | Keep only listings with at least this size or number of rooms. |
| `scrapeDetails` | boolean | Open each listing for agency, full description, reference, features and all photos. Default false. |
| `location` | string | City name or slug, used only when `startUrls` is empty. |
| `operation` | string | `sale` or `rent`, used with `location`. Default `sale`. |
| `sources` | array | `pisos` and/or `habitaclia`, used with `location`. Default both. |
| `proxyConfiguration` | object | Apify Proxy settings. Datacenter proxy by default; choose residential if the portals block you. |

Example input:

```json
{
  "startUrls": [
    { "url": "https://www.pisos.com/alquiler/pisos-barcelona/" },
    { "url": "https://www.habitaclia.com/comprar/viviendas/barcelona-provincia/barcelona-capital/s" }
  ],
  "maxItems": 100,
  "scrapeDetails": true,
  "proxyConfiguration": { "useApifyProxy": true }
}
```

The limit `maxItems` applies to the whole run. With two start URLs and `maxItems` set to 100, the run saves 100 listings in total, taking the first URL until it is exhausted or the limit is reached.

### Output

Each listing is one dataset item. This is a real item from a Pisos.com sale search for Madrid:

```json
{
  "id": "65098413759.100500",
  "sourceUrl": "https://www.pisos.com/comprar/piso-gaztambide-65098413759_100500/",
  "title": "Piso en calle de la Princesa, 76",
  "operation": "sale",
  "source": "pisos.com",
  "price": 1600000,
  "location": "Gaztambide (Distrito Chamberí. Madrid Capital)",
  "city": "Madrid Capital",
  "province": "Madrid",
  "sizeM2": 155,
  "rooms": 3,
  "bathrooms": 3,
  "floor": "4ª planta",
  "propertyType": "Piso",
  "photoCount": 34,
  "latitude": 40.4325,
  "longitude": -3.71735,
  "agencyUrl": "https://www.pisos.com/inmobiliaria-princess_homes/"
}
```

Pisos detail pages can contain several image sizes for the same photo. The Actor keeps the first source URL for each photo filename, so `imageUrls` contains distinct photos rather than repeated resize variants. `photoCount` remains the total advertised by the site; it may exceed the number of accessible photo URLs.

A Habitaclia.com item has the same fields. The card gives title, price, location, size, rooms, bathrooms, floor and photos; the detail page adds the description, coordinates and agency.

### How much does it cost?

The Actor is charged per result: you pay for each listing saved to the dataset, and the run never saves or charges more than `maxItems`. See the Pricing tab of the Actor for the current rate. Platform usage such as proxy traffic and compute is billed separately according to your Apify plan. Detail pages cost more run time because they add one request per listing, but they do not change the per-result charge.

To keep a run cheap while you test, set `maxItems` to a small number such as 10 and leave detail pages off.

### Use with AI agents (MCP)

You can call this Actor from an AI assistant through the Apify MCP server. Add the Actor to your MCP client configuration:

```json
{
  "mcpServers": {
    "apify": {
      "url": "https://mcp.apify.com?tools=axiomworks/pisos-habitaclia-property-scraper"
    }
  }
}
```

Example prompts:

"Get 30 flats for sale in Madrid from Pisos.com and list the ten cheapest per square metre."

"Scrape Barcelona rentals on Pisos.com with detail pages and tell me which agencies advertise the most listings."

"Collect 20 sale listings from this Habitaclia.com search URL and return price, size and rooms as a table."

The agent sees the input fields described above, so keep `maxItems` explicit and pass full search URLs for best results.

### Integrations and API

Run the Actor from code with the Apify API clients, or connect the dataset to Google Sheets, Make, Zapier, n8n or a webhook.

**Python**

```python
from apify_client import ApifyClient

client = ApifyClient("<YOUR_APIFY_TOKEN>")
run = client.actor("axiomworks/pisos-habitaclia-property-scraper").call(run_input={
    "startUrls": [{"url": "https://www.pisos.com/venta/pisos-madrid/"}],
    "maxItems": 50,
})
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item["title"], item["price"])
```

**JavaScript**

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

const client = new ApifyClient({ token: process.env.APIFY_TOKEN });
const run = await client.actor('axiomworks/pisos-habitaclia-property-scraper').call({
    startUrls: [{ url: 'https://www.pisos.com/venta/pisos-madrid/' }],
    maxItems: 50,
});
const { items } = await client.dataset(run.defaultDatasetId).listItems();
process.stdout.write(`${items.length}\n`);
```

**cURL**

```bash
curl -X POST "https://api.apify.com/v2/acts/axiomworks~pisos-habitaclia-property-scraper/run-sync-get-dataset-items" \
  -H "Authorization: Bearer $APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"startUrls":[{"url":"https://www.pisos.com/venta/pisos-madrid/"}],"maxItems":20}'
```

### FAQ

**Which portals and operations are supported?**
Pisos.com and Habitaclia.com, for sale and for rent. Residential search pages are supported. Pages for commercial property, land or new developments may have a different layout and can return fewer fields.

**Why is `price` null for some listings?**
Some listings show "consultar precio" (price on request). The Actor leaves the price empty instead of guessing.

**Why are `agencyName` and `features` empty?**
Those fields come from the detail page. Turn on **Fetch optional listing details**. On Pisos.com the detail page also provides the reference and the feature table; on Habitaclia.com it provides the description, coordinates and agency.

**How many listings can I get from one search?**
As many as the portal shows for that search, up to your `maxItems`. The Actor stops when a page has no new listings. Portals usually cap how deep a single search goes, so split very large areas into districts or municipalities.

**What happens with a wrong URL or a city that does not exist?**
The run finishes quickly with zero items and a clear warning in the log. No placeholder records are saved.

**The run returned fewer items than expected.**
Check the log. The portal may have blocked the request; switch the proxy to residential and try again. The Actor does not solve CAPTCHAs: if a block page persists it skips that page and keeps the listings it already has.

**Are duplicates possible?**
No. Each listing id is saved once per run, even when it appears on several pages or in several start URLs.

**Do I need to log in?**
No. Only public pages that load without an account are read.

### Is it legal to scrape Pisos.com and Habitaclia.com?

The Actor collects publicly visible listing information that anyone can open in a browser, without logging in and without bypassing any protection. Scraping public data is generally lawful in many jurisdictions, but the rules depend on how you use the data. Listing text, photos and agency details may be protected by copyright or database rights, and personal data of private sellers is subject to the GDPR. Use the output for analysis and research, respect the data subjects, do not republish photos or descriptions as your own, and check the terms of each portal and your local law. This text is not legal advice; ask a lawyer if you plan a commercial use you are unsure about.

### Feedback

Found a bug, a layout change or a field you need? Open an issue from the Actor's Issues tab in Apify Console and include the input you used and the URL that failed. Portals redesign their pages from time to time, and a short report helps fix extraction quickly.

# Actor input Schema

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

Public search or listing URLs as objects, e.g. \[{"url":"https://www.pisos.com/venta/pisos-madrid/"}]. Search pages paginate automatically. Takes precedence over location, operation, sources and propertyType. Supply startUrls or location. Blocked or empty targets return no rows; try another search URL or proxy configuration.

## `location` (type: `string`):

City name or slug, e.g. "Madrid" or "barcelona", used only when startUrls is empty. Builds URLs using operation, sources and propertyType. For Habitaclia, prefer a copied search URL with province and city in its path. Supply location or startUrls.

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

Operation for location searches: "sale" (default) or "rent", e.g. "rent" with location "barcelona". Ignored when startUrls is supplied; URL paths determine the operation.

## `sources` (type: `array`):

Portal names for location searches, e.g. \["pisos"] or \["pisos","habitaclia"] (default). Ignored when startUrls is supplied. Habitaclia location paths vary; use a copied search URL when the generated path returns no listings.

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

Property category for location searches: "all" (default), "flats" or "houses", e.g. "houses" with location "madrid". Ignored when startUrls is supplied. Pisos uses its pisos path for both all and flats; houses uses casas.

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

Minimum asking price in euros, e.g. 100000; non-negative integer, omitted means no lower limit. Rentals use monthly asking prices. Applied after extraction; rows with missing prices are excluded when set. Combine with maxPrice for a range.

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

Maximum asking price in euros, e.g. 350000; non-negative integer, omitted means no upper limit. Rentals use monthly asking prices. Applied after extraction; rows with missing prices are excluded when set. If no rows match, widen the price range.

## `minSizeM2` (type: `integer`):

Minimum listed area in square metres, e.g. 60; non-negative integer, omitted means no size filter. Applied after extraction; rows with missing area are excluded when set. Lower this value if no listings match.

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

Minimum listed bedroom count, e.g. 2; non-negative integer, omitted means no bedroom filter. Applied after extraction; rows with missing rooms are excluded when set. Lower this value if no listings match.

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

Maximum saved listings across all targets combined, 1-10000, default 50; e.g. 7 saves at most 7 rows. Only matching, unique listings count. Stops at the limit when enough listings exist; fewer rows are possible for empty, filtered or blocked searches. Prefill requests 20 Madrid sale listings.

## `scrapeDetails` (type: `boolean`):

Whether to fetch each listing page, e.g. true; default false reads search cards only. True adds one request per listing for available agency, description, features and photos. Fields depend on portal and listing; missing values stay null. Failed detail requests keep the search-card record.

## `proxyConfiguration` (type: `object`):

Proxy settings, e.g. {"useApifyProxy":true} (default, datacenter). Retries blocked requests on fresh sessions. If requests remain blocked, try residential settings {"useApifyProxy":true,"apifyProxyGroups":\["RESIDENTIAL"]}. Empty targets save no rows; CAPTCHA challenges are not solved.

## Actor input object example

```json
{
  "startUrls": [
    {
      "url": "https://www.pisos.com/venta/pisos-madrid/"
    }
  ],
  "operation": "sale",
  "sources": [
    "pisos",
    "habitaclia"
  ],
  "propertyType": "all",
  "maxItems": 20,
  "scrapeDetails": false,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}
```

# 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 = {
    "startUrls": [
        {
            "url": "https://www.pisos.com/venta/pisos-madrid/"
        }
    ],
    "maxItems": 20,
    "scrapeDetails": false,
    "proxyConfiguration": {
        "useApifyProxy": true
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("axiomworks/pisos-habitaclia-property-scraper").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 = {
    "startUrls": [{ "url": "https://www.pisos.com/venta/pisos-madrid/" }],
    "maxItems": 20,
    "scrapeDetails": False,
    "proxyConfiguration": { "useApifyProxy": True },
}

# Run the Actor and wait for it to finish
run = client.actor("axiomworks/pisos-habitaclia-property-scraper").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 '{
  "startUrls": [
    {
      "url": "https://www.pisos.com/venta/pisos-madrid/"
    }
  ],
  "maxItems": 20,
  "scrapeDetails": false,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}' |
apify call axiomworks/pisos-habitaclia-property-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,axiomworks/pisos-habitaclia-property-scraper"
        }
    }
}
```

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/6wiKvSyeuADfWfQOS/builds/ZgQTLbEgTWv7Y3M0M/openapi.json
