# Fotocasa Property Scraper — Spain Real Estate, Prices & Agents (`haketa/fotocasa-scraper`) Actor

Scrape Fotocasa.es property listings for sale or rent across Spain — price, size, rooms, features, coordinates, photos and the agency name, phone and private-vs-agency seller. Search by location or paste URLs and export as JSON, CSV or Excel for lead generation and market research.

- **URL**: https://apify.com/haketa/fotocasa-scraper.md
- **Developed by:** [Haketa](https://apify.com/haketa) (community)
- **Categories:** Real estate, Lead generation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.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?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## Fotocasa Property Scraper — Spain Real Estate, Prices & Agents

Collect property listings from **Fotocasa.es**, one of Spain's biggest real‑estate portals, as clean, structured data. Search by location (or paste a search URL) and get every listing back with **price, size, rooms, features, coordinates, photos** — plus the **agency name, phone and whether the seller is a private owner or an agency**.

Built for **real‑estate agencies, lead‑generation teams, property investors, market analysts and data teams** who need Spanish housing data — for sale or rent — without copying listings by hand.

***

### ✨ Why use this scraper

- **Full listing records** — price, property type, rooms, bathrooms, surface (m²), floor, features and description.
- **Lead‑generation data** — agency name, **phone number**, agency page, and a **private‑owner vs agency** flag with a filter to keep only private owners.
- **Location & map** — full address (district, neighborhood, city, province, ZIP) plus latitude/longitude.
- **Buy or rent** — scrape sale (comprar) or rental (alquiler) listings.
- **Photos & media** — all listing image URLs, plus video/virtual‑tour flags.
- **Clean, typed output** — price as a number, features parsed — ready for spreadsheets, databases and BI tools.
- **Fast & cheap** — pure API‑style access (no browser), so runs are quick and low‑cost.
- **Export anywhere** — JSON, CSV, Excel, HTML or via the Apify API and integrations.

***

### 🚀 Quick start

1. Choose **Buy** or **Rent**.
2. Enter one or more **locations** (for example `madrid-capital`, `barcelona-capital`) — or paste **Start URLs**.
3. Set **Maximum listings** and click **Start**.

Each listing comes back as one clean record.

***

### 📥 Input

| Field | Type | Description |
|---|---|---|
| **Operation** (`operation`) | select | `comprar` (buy) or `alquiler` (rent). |
| **Locations** (`locations`) | array | Fotocasa location slugs (madrid-capital, barcelona-capital …). |
| **Start URLs** (`startUrls`) | array | Paste Fotocasa search URLs directly (overrides operation/locations). |
| **Only private owners** (`onlyPrivateOwners`) | boolean | Keep only private‑owner listings (skip agencies). |
| **Maximum listings** (`maxItems`) | integer | Cap the number of listings. |
| **Max pages per search** (`maxPagesPerSearch`) | integer | Result pages per search (~30 listings each). |
| **Proxy configuration** (`proxyConfiguration`) | object | Spanish (ES) residential proxy is required. |

#### Example — buy listings in Madrid

```json
{
  "operation": "comprar",
  "locations": ["madrid-capital"],
  "maxItems": 300
}
```

#### Example — only private owners (lead‑gen)

```json
{
  "operation": "comprar",
  "locations": ["barcelona-capital", "valencia-capital"],
  "onlyPrivateOwners": true,
  "maxItems": 500
}
```

#### Example — paste a search URL

```json
{
  "startUrls": ["https://www.fotocasa.es/es/comprar/viviendas/madrid-capital/todas-las-zonas/l"]
}
```

***

### 📤 Output

Each listing is one dataset item. Example:

```json
{
  "id": 190139043,
  "url": "https://www.fotocasa.es/es/comprar/vivienda/madrid-capital/.../190139043/d",
  "operation": "comprar",
  "propertyType": "Flat",
  "price": 354000,
  "priceText": "354.000 €",
  "isReduced": false,
  "rooms": 3,
  "bathrooms": 2,
  "surface": 90,
  "floor": 9,
  "antiquity": 7,
  "amenities": ["heating", "terrace", "elevator", "parking"],
  "isNewConstruction": false,
  "district": "San Blas",
  "neighborhood": "Rosas - Musas",
  "city": "Madrid",
  "province": "Madrid",
  "zipCode": "28022",
  "latitude": 40.4311,
  "longitude": -3.6074,
  "agencyName": "VOhome Moratalaz",
  "advertiserType": "professional",
  "isPrivateOwner": false,
  "phone": "+34910327367",
  "agencyUrl": "https://www.fotocasa.es/es/inmobiliaria-...",
  "photos": ["https://static.fotocasa.es/images/ads/..."],
  "photoCount": 24,
  "hasVirtualTour": false,
  "publishedDaysAgo": 131,
  "description": "Magnífico piso en la zona de Las Rosas...",
  "scrapedAt": "2026-09-01T10:00:00.000Z"
}
```

#### Field reference

**Listing**

| Field | Description |
|---|---|
| `id`, `adId` | Fotocasa listing IDs. |
| `url` | Listing page. |
| `operation` | `comprar` or `alquiler`. |
| `propertyType` | Flat, house, etc. |
| `price`, `priceText` | Price as number and as shown. |
| `isReduced`, `reducedPrice` | Price‑drop flag/value. |

**Property**

| Field | Description |
|---|---|
| `rooms`, `bathrooms`, `surface` | Rooms, baths and size (m²). |
| `floor`, `antiquity` | Floor and age. |
| `amenities` | Features (heating, terrace, elevator, parking …). |
| `isNew`, `isNewConstruction` | New‑build flags. |

**Location**

| Field | Description |
|---|---|
| `district`, `neighborhood`, `city`, `province`, `zipCode` | Address. |
| `latitude`, `longitude` | Coordinates. |

**Advertiser (lead‑gen)**

| Field | Description |
|---|---|
| `agencyName` | Agency / advertiser name. |
| `advertiserType` | `professional` or `private`. |
| `isPrivateOwner` | Whether it's a private owner. |
| `phone` | Contact phone. |
| `agencyUrl` | Agency page on Fotocasa. |

**Media & meta**

| Field | Description |
|---|---|
| `photos`, `photoCount` | Image URLs. |
| `hasVideo`, `hasVirtualTour` | Media flags. |
| `publishedDaysAgo` | How long the listing has been live. |
| `description` | Listing description. |

***

### 💡 Use cases

- **Lead generation** — build lists of private owners or agencies with phone numbers for outreach.
- **Market & price analysis** — aggregate prices by district, size and type to track the Spanish market.
- **Investment research** — spot price drops, new builds and opportunities by area.
- **Agency intelligence** — see which agencies list what, where and at what price.
- **Data & analytics** — build clean datasets of Spanish real estate for models and dashboards.

***

### 🎯 Tips for best results

- **Use location slugs** as they appear in Fotocasa URLs (madrid-capital, barcelona-capital, valencia-capital …), or paste a full search URL.
- **Filter to private owners** with **Only private owners** for cleaner lead lists.
- **Combine locations** to cover several cities in one run.
- **Filter after export** — pull broadly, then filter on `price`, `surface`, `rooms`, `advertiserType` or `district`.

***

### 🔌 Run it your way

- **Apify Console** — pick buy/rent, enter locations and click Start.
- **API** — start runs and pull the dataset programmatically.
- **Scheduler** — refresh listings and prices on a schedule.
- **Integrations** — push results to Google Sheets, Zapier, Make, webhooks, S3 and more.

***

### ❓ FAQ

**Which country does Fotocasa cover?**
Fotocasa is a Spanish real‑estate portal, covering property for sale and rent across Spain.

**Do I need an account or API key?**
No. Just pick buy/rent and enter locations (or paste URLs).

**Do I get phone numbers?**
Yes — listings include the advertiser's phone, agency name and whether the seller is a private owner or an agency.

**Can I get only private owners?**
Yes — enable **Only private owners** to skip agency listings.

**Why is a Spanish proxy required?**
Fotocasa geo‑restricts access, so a Spanish (ES) residential proxy is needed for reliable results.

**In what format is the data?**
Structured JSON by default, exportable to CSV, Excel, HTML and more.

**Can I run it on a schedule?**
Yes — use the Apify Scheduler, or start runs through the Apify API and its integrations.

***

### ⚖️ Legal & responsible use

This tool collects **publicly available** property‑listing information for legitimate business use such as market research and real‑estate lead generation. You are responsible for how you use the data and for complying with all applicable laws and regulations, the website's terms, and data‑protection rules (including the GDPR where personal data such as phone numbers is involved). Do not use the output to infringe intellectual‑property rights, to send unlawful communications, or for any unlawful purpose. This scraper is not affiliated with, endorsed by, or connected to Fotocasa; all trademarks belong to their respective owners.

***

#### Tags

`fotocasa` · `fotocasa scraper` · `spain real estate` · `spain property` · `real estate scraper` · `property scraper` · `idealista alternative` · `real estate leads` · `property listings` · `inmobiliaria` · `pisos` · `lead generation` · `real estate data` · `housing market` · `property prices`

# Actor input Schema

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

Buy or rent listings.

## `locations` (type: `array`):

Fotocasa location slugs (e.g. madrid-capital, barcelona-capital, valencia-capital, sevilla-capital, malaga-capital). Leave empty to use Madrid.

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

Paste Fotocasa search URLs directly (open fotocasa.es, set filters, copy the URL). Overrides operation/locations.

## `onlyPrivateOwners` (type: `boolean`):

Keep only listings posted by private owners (skip agencies) — useful for lead generation.

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

Stop after collecting this many listings.

## `maxPagesPerSearch` (type: `integer`):

Maximum result pages per search (each page has ~30 listings).

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

A Spanish (ES) residential proxy is required — datacenter IPs are geo‑blocked. Leave as the default.

## Actor input object example

```json
{
  "operation": "comprar",
  "locations": [
    "barcelona-capital",
    "valencia-capital"
  ],
  "onlyPrivateOwners": false,
  "maxItems": 200,
  "maxPagesPerSearch": 50,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ],
    "apifyProxyCountry": "ES"
  }
}
```

# Actor output Schema

## `dataset` (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 = {
    "locations": [
        "madrid-capital"
    ],
    "maxItems": 200,
    "proxyConfiguration": {
        "useApifyProxy": true,
        "apifyProxyGroups": [
            "RESIDENTIAL"
        ],
        "apifyProxyCountry": "ES"
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("haketa/fotocasa-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 = {
    "locations": ["madrid-capital"],
    "maxItems": 200,
    "proxyConfiguration": {
        "useApifyProxy": True,
        "apifyProxyGroups": ["RESIDENTIAL"],
        "apifyProxyCountry": "ES",
    },
}

# Run the Actor and wait for it to finish
run = client.actor("haketa/fotocasa-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 '{
  "locations": [
    "madrid-capital"
  ],
  "maxItems": 200,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ],
    "apifyProxyCountry": "ES"
  }
}' |
apify call haketa/fotocasa-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,haketa/fotocasa-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/JPApypM73i9KdISZK/builds/zDUrQ5BHBWlb4w100/openapi.json
