# Fotocasa Scraper (`datahamster/fotocasa-scraper`) Actor

Fotocasa scraper for Spain: homes, flats, garages, offices and land for sale or rent by city, district or pasted search URL, with price, size, bedroom and bathroom filters. Price per m2, price cuts, duplicate listings flagged. Monitor mode alerts on new listings and price drops.

- **URL**: https://apify.com/datahamster/fotocasa-scraper.md
- **Developed by:** [Viktor Dubnytskiy](https://apify.com/datahamster) (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 $0.80 / 1,000 result items

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.
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

## Fotocasa Scraper

Get property listings from Fotocasa.es, Spain's large real estate portal, as one flat row per listing: price, price per m², the latest price cut, size, bedrooms, bathrooms, floor, amenities, address, district, neighbourhood, map coordinates, the agency's name (or "private" for a private seller), the publication date and the photo URLs. Search by city, province or district with price, size, bedroom and bathroom filters, or paste Fotocasa search URLs. No account, no cookies.

**Try it:** the prefilled example returns 20 rows in about 6 seconds and costs about $0.02. Results cost $1.00 per 1,000.

Coverage: Fotocasa serves 30 listings per page and at most 333 pages (about 10,000 listings) per search. Split a bigger search by district or price range to read more of it.

**Why this one** (compared with igolaizola/fotocasa-scraper, the most-used Fotocasa actor in the Store with 107 users in 30 days, input schema and README checked 2026-11-06):

- **Monitor mode for new listings and price drops.** Save a search as a task and each run returns only listings published since the last run and known listings whose price dropped, with the `previous` price, `previousPrice` and `priceChangePercent`. Set `minPriceDropPercent: 5` to hear only about cuts of 5% or more. A re-published old advert is not sold to you as new: listing ids grow with creation time, so an old id that jumps to the top is recorded silently. The leader has no monitor mode, no change tracking and no alerts.
- **The same flat listed by several agencies is flagged.** `duplicateOf` points at the earlier row when two adverts match on type, map point (150 m), size, bedrooms, bathrooms and price (5%); `duplicates: "drop"` skips the repeats, and they are not charged. Measured on 2026-11-06: 8 of the 90 cheapest homes for sale in Madrid were repeats, for example one flat in calle Fermín Donaire 15 listed by BHORUS and by GRUPINVAL SUBASTAS. The leader has no duplicate handling.
- **Price per m² and the price cut on every row.** `pricePerM2`, `priceReduction`, `priceBeforeReduction` and `priceReductionPercent` come with each listing, and `onlyReduced: true` returns only listings with a price cut. The leader's sample output has neither field and its input has no price-cut filter.
- **Bedroom and bathroom filters, many places in one run, pasted search URLs.** `minRooms`, `maxRooms`, `minBathrooms`; `locations` takes a list (one search each); `searchUrls` keeps every filter you set on fotocasa.es. The leader takes one `location` and has no bedroom or bathroom filter.
- **Price.** $1.00 per 1,000 listings and no start fee, plus Apify platform usage that you pay (about $0.005 to $0.02 per 1,000 listings at 512 MB, measured on 90- and 20-row runs). The leader charges $1.00 per 1,000 plus $0.001 per run start on the Free plan, and its price already includes platform usage. On the Free plan this actor therefore costs slightly more in total (by our usage); on paid plans the leader is cheaper per row ($0.70 to $0.90 per 1,000 against our $0.80 to $1.00), so pick it if you only need plain search rows on a paid plan.

What the leader has and this actor does not: a publication-date filter (`last48h`, `lastWeek`, `lastMonth`), a search by coordinates and radius, and the rent-to-buy, share and transfer operations. Use `sort: "newest"` (or monitor mode) instead of the date filter, and districts instead of a radius.

### What you get

```json
[
  {
    "id": "189312219",
    "url": "https://www.fotocasa.es/es/comprar/vivienda/madrid/calefaccion-ascensor-amueblado/189312219/d",
    "title": "Flat for sale in Goya, Madrid",
    "operation": "sale",
    "propertySubtype": "intermediate_floor",
    "price": 400000,
    "currency": "EUR",
    "pricePerM2": 8888.89,
    "priceReduction": 20000,
    "priceBeforeReduction": 420000,
    "priceReductionPercent": 4.8,
    "surfaceM2": 45,
    "rooms": 1,
    "bathrooms": 1,
    "floor": "ground",
    "features": [
      "heating",
      "lift",
      "furnished"
    ],
    "address": "Goya",
    "municipality": "Madrid",
    "district": "Barrio de Salamanca",
    "neighborhood": "Goya",
    "zipCode": "28001",
    "latitude": 40.427313550573174,
    "longitude": -3.6769051023697554,
    "exactAddress": false,
    "advertiserType": "agency",
    "agencyName": "Aproperties Real Estate Madrid",
    "publishedAt": "2026-04-07T19:15:30",
    "images": [
      "https://static.fotocasa.es/images/ads/cefea551-f2f7-40bb-a5dc-c7074d15cb31?rule=original"
    ],
    "imageCount": 28,
    "duplicateOf": null,
    "description": "PISO REFORMADO A ESTRENAR EN EL BARRIO DE SALAMANCA\n\nPresentamos este coqueto apartamento de diseño a estrenar ubicado e"
  },
  {
    "id": "190909371",
    "url": "https://www.fotocasa.es/es/comprar/vivienda/madrid-capital/aire-acondicionado-calefaccion-terraza-trastero-ascensor-amueblado/190909371/d",
    "title": "Penthouse for sale in Goya, Madrid",
    "operation": "sale",
    "propertySubtype": "penthouse",
    "price": 2990000,
    "currency": "EUR",
    "pricePerM2": 14306.22,
    "priceReduction": null,
    "priceBeforeReduction": null,
    "priceReductionPercent": null,
    "surfaceM2": 209,
    "rooms": 3,
    "bathrooms": 4,
    "floor": "8",
    "features": [
      "air conditioning",
      "heating",
      "terrace",
      "storage room",
      "lift",
      "furnished",
      "exterior",
      "luxury",
      "modern"
    ],
    "address": "Goya, Goya",
    "municipality": "Madrid",
    "district": "Barrio de Salamanca",
    "neighborhood": "Goya",
    "zipCode": "28009",
    "latitude": 40.424659837285795,
    "longitude": -3.673746019086735,
    "exactAddress": false,
    "advertiserType": "agency",
    "agencyName": "ESPÍGUL IMMOBILIARIA",
    "publishedAt": "2026-09-22T18:31:10",
    "images": [
      "https://static.fotocasa.es/images/ads/84ee115f-2dac-478d-8a0a-8ccf4aa6820c?rule=original"
    ],
    "imageCount": 44,
    "duplicateOf": null,
    "description": "Piso ubicado en una de las zonas más demandadas de Madrid, Salamanca, con excelente conectividad y servicios cercanos qu"
  }
]
```

(two of the 20 rows of the prefilled run, `images` and `description` shortened)

`price` is in EUR; for rentals it is the monthly rent (`pricePeriod: "monthly"`). `priceReduction` is the latest price cut Fotocasa shows on the card. `floor` is `basement`, `ground`, `mezzanine`, a floor number, or `other`. `exactAddress: false` means Fotocasa shows an approximate map point. `publishedAt` is Fotocasa's publication time to the second, without a time zone: Fotocasa stores UTC for some adverts and Spanish local time for others, so treat it as accurate to about an hour. `advertiserType` is `agency` or `private`; `agencyName` is the agency's trade name or `"private"`. Each row also has `propertyType`, `province`, `region`, `agencyUrl`, `hasVideo`, `hasFloorPlan`, `hasVirtualTour`, `newConstruction`, `search` (the input that found it) and `rank`.

### Use cases

- **Price-drop alerts.** A monitor task on your target district, scheduled daily, returns new listings and the ones that got cheaper, with the old price next to the new one.
- **Investor deal sourcing.** Sort by lowest price per m² (`price_per_m2_low`) or use `onlyReduced`, and read `pricePerM2` to spot listings below the area's level.
- **Market analysis.** Asking prices and rents per m² by district, neighbourhood or floor, without double-counting flats listed by two agencies.
- **Agency benchmarking.** Count listings per agency in a city.

### Try it

Hit **Start**: the prefilled input reads the first 20 homes for sale in Madrid. Change `operation`, `propertyType` and the filters, list several places in `locations`, or paste search URLs from fotocasa.es into `searchUrls`.

**Monitor mode.** Save the input as a task and set:

```json
{
  "mode": "monitor",
  "monitorStateId": "madrid-chamberi-rent",
  "locations": ["Madrid, Chamberí"],
  "operation": "rent",
  "maxPrice": 2000,
  "maxPagesPerSearch": 26,
  "minPriceDropPercent": 3,
  "maxItems": 200,
  "webhookUrl": "https://your-endpoint.example.com/hook"
}
```

Put the task on a schedule (Apify, Schedules, cron `0 7 * * *` for daily).

- **How it reads:** newest first, every page up to `maxPagesPerSearch` on every run, so price changes of every listing within that depth are compared, not only of the newest ones. New listings are always caught; price drops only within the depth. To watch the whole search, set `maxPagesPerSearch` to its result count divided by 30 (Chamberí rentals had 753 on 2026-11-06, so 26 pages). When the depth is shorter, the run log warns and `RUN_SUMMARY.monitorDepthShort` gives the pages needed.
- **`onlyReduced` is ignored in monitor mode**: the monitor records every listing so that a later price cut can be reported.
- **What is returned:** `changeType: "new"` for a listing published since the last run; `changeType: "price_drop"` (or `"price_increase"` with `priceAlerts: "any"`) with `changedFields: ["price"]`, `previous`, `previousPrice` and `priceChangePercent` for a known listing whose price moved by at least `minPriceDropPercent`. Smaller moves add up against the last reported price until they reach the threshold.
- **Old adverts stay out:** a listing the monitor never saw whose id is older than the newest one of the last run (minus about a day and a half of ids) is recorded without being returned (`watch.unseenOld` in `RUN_SUMMARY`).
- **The first run of a search is the baseline:** it records what it reads and returns nothing (one monitor-check, no rows; `emptyReason: "baseline"`). A changed filter or depth starts a new baseline for that search.
- **Stuck runs:** a run that crashes holds its lease until its timeout; later runs of the same task end as `overlapping_run` without charging. Wait for the timeout or use a new `monitorStateId`.

### Input

| Field | Meaning | Default |
|---|---|---|
| `searchUrls` | Fotocasa search URLs (`/es/comprar/...` or `/es/alquiler/...`), filters kept | empty |
| `locations` | cities, provinces, districts (`Madrid`, `Madrid, Chamberí`, `Pamplona`, `madrid-capital/barajas`, `malaga-provincia`) | `Madrid` (prefill) |
| `operation` | `sale` or `rent` for `locations` | `sale` |
| `propertyType` | homes, flats, garages, offices, premises, land, buildings, storageRooms | `homes` |
| `minPrice`, `maxPrice` | EUR (monthly for rent) | any |
| `minRooms`, `maxRooms`, `minBathrooms` | bedrooms and bathrooms | any |
| `minSize`, `maxSize` | m² | any |
| `sort` | relevance, newest, price_low, price_high, size_high, price_per_m2_low, url | `relevance` |
| `maxPagesPerSearch` | 1-333, 30 listings per page | 10 |
| `onlyReduced` | only listings with a price cut (scrape mode) | `false` |
| `duplicates` | flag, drop, off | `flag` |
| `includeDescription` | advert text without phones, e-mails and contact names | `true` |
| `priceAlerts`, `minPriceDropPercent` | monitor mode: drops or any change, minimum % | `drops`, 0 |
| `maxItems` | stop after this many rows (monitor: new/changed rows), shared between searches | 100 |
| `mode`, `monitorStateId`, `webhookUrl`, `telegramBotToken`, `telegramChatId` | monitor mode and alert targets | `scrape` |

### Pricing

| Event | Price |
|---|---|
| result | $0.001 per listing ($1.00 per 1,000) |
| monitor-check | $0.005 per monitor run |
| change | $0.001 per new or changed listing in monitor mode |

Apify Store discounts: SILVER -10%, GOLD and higher -20%. You pay only for pushed rows; a listing found by two searches is charged once, and dropped duplicates are not charged. Apify platform usage is billed by Apify on top (about $0.0004 for the prefilled run at 512 MB); no proxy is needed for Fotocasa.

**Found it useful?** A short review on the Store page helps other people find this actor.

### Related actors

- [Rightmove Scraper](https://apify.com/datahamster/rightmove-scraper) for UK listings with price-drop alerts.
- [Otodom, Storia, Imovirtual Scraper](https://apify.com/datahamster/olx-group-real-estate) for Poland, Romania and Portugal.
- [Immowelt.de Scraper](https://apify.com/datahamster/immowelt-listings) for Germany.
- [Zillow Scraper](https://apify.com/datahamster/zillow-scraper) for US listings.

### Limits

- 30 listings per page, at most 333 pages per search (Fotocasa's own cap).
- New-construction developments (`obra nueva`) and room shares are not covered as their own search types; new homes that appear in a homes search are returned with `newConstruction: true` and are never matched as duplicates.
- Duplicate matching works within one run. Coordinates are approximate on many adverts, so a match means "very likely the same property"; check `duplicateOf` before deleting anything.
- The data is for analysis. Fotocasa's terms forbid republishing its adverts on other websites.
- Descriptions are cleaned of phones, e-mails and contact names by rules tuned on about 3,500 descriptions; an isolated name can remain in free text. Agency trade names that contain a person's name stay as they are.

### FAQ

**Do I need a Fotocasa account?** No. The actor reads the public search pages.

**Why did my search return nothing?** `RUN_SUMMARY` in the run's key-value store has `emptyReason`; `FOTOCASA_STATS` lists `unknownLocations`, `invalidUrls`, `resultCounts` and why each search stopped. A place name Fotocasa does not know ends as `no_matches`: use the name as it appears in Fotocasa URLs (`madrid-capital`, `sevilla-capital`, `malaga-provincia`) or paste the search URL. In monitor mode the first run is a baseline.

**Do you collect agents' or sellers' personal details?** No. Rows hold the listing and the agency's trade name (a business). Private sellers are shown as "private" and never named. No phone numbers are read; phone numbers and e-mail addresses are removed from descriptions, and sentences that name a contact person ("Contacta con ...", an agent's signature next to a phone, "Soy ..., la propietaria") are dropped; neighbours named in cadastral boundaries ("Linda: norte, ...") become "colindante". These rules were tuned on about 3,500 Fotocasa descriptions, so an isolated name can still remain in free text: check descriptions before you reuse them. Person names that are part of an agency's trade name (for example "FELIPE BLANCO" or "Jorge Katouch Real Estate") stay in `agencyName`, because that is the business name.

### Changelog

- 0.1.11: neighbour names in cadastral boundaries become "colindante"; owner sentences ("Soy ..., la propietaria") are dropped; Pamplona, San Sebastián and Vitoria resolve to their bilingual Fotocasa names.
- 0.1.8: phone numbers split over lines, spaces or commas are removed; sentences naming a contact person are dropped from descriptions.
- 0.1.5: phone pairs written as "613 60 72 19 / 603 36 34 87" are removed from descriptions; lowest price per m² sort; monitor warns when the depth is shorter than the search; `onlyReduced` is ignored in monitor mode.
- 0.1: initial release: locations and search URLs, sale and rent, eight property types, price, size, bedroom and bathroom filters, price per m², price cuts, duplicate flagging, monitor mode for new listings and price drops with a percent threshold.

# Actor input Schema

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

Stop after this many results (you are charged only for pushed items)

## `mode` (type: `string`):

scrape = full results; monitor = only new/changed items since the previous run of this task

## `monitorStateId` (type: `string`):

Optional state id when not running as a saved task (monitor mode)

## `webhookUrl` (type: `string`):

POST a change summary here in monitor mode

## `telegramBotToken` (type: `string`):

Optional: bot token for monitor-mode change summaries

## `telegramChatId` (type: `string`):

Optional: chat id that receives monitor-mode summaries

## `searchUrls` (type: `array`):

Paste Fotocasa search URLs from your browser (sale or rent, any type, district and filters), e.g. https://www.fotocasa.es/es/alquiler/viviendas/madrid-capital/chamberi/l?maxPrice=1500. Every filter in the URL is kept.

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

Cities, provinces or districts, one per line, e.g. "Madrid", "Valencia", "Madrid, Chamberí" or a Fotocasa location path such as "madrid-capital/barajas" or "malaga-provincia". A city name tries the city first, then the wider area. Each line is a separate search with the filters below.

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

For the Locations searches. Pasted URLs keep their own. Example: rent.

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

For the Locations searches. Example: homes.

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

Sale price, or monthly rent for rentals. Example: 150000.

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

Example: 400000.

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

Example: 2.

## `maxRooms` (type: `integer`):

Example: 3.

## `minBathrooms` (type: `integer`):

Example: 2.

## `minSize` (type: `integer`):

Example: 60.

## `maxSize` (type: `integer`):

Example: 120.

## `sort` (type: `string`):

Monitor mode always reads newest first. Example: newest.

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

30 listings per page; Fotocasa serves at most 333 pages (about 10,000 listings) per search. In monitor mode this is the depth read and compared on every run: price drops are seen only within it, so set it to the search's result count divided by 30 to watch the whole search. Example: 10.

## `onlyReduced` (type: `boolean`):

true = return only listings that show a price cut on Fotocasa (priceReduction, priceBeforeReduction). Scrape mode only: monitor mode ignores it, because it must record every listing to report later price drops. Example: false.

## `duplicates` (type: `string`):

The same flat is often listed by two or more agencies. flag = keep both rows and set duplicateOf on the later one; drop = skip the later one. Match: same type, map points within 150 m, size within 3 m² or 3%, same bedrooms and bathrooms, price within 5%. Example: flag.

## `includeDescription` (type: `boolean`):

The advert text, with phone numbers, e-mail addresses and sentences naming a contact person removed. Example: true.

## `priceAlerts` (type: `string`):

Monitor mode: which price changes of known listings come back. Example: drops.

## `minPriceDropPercent` (type: `number`):

Monitor mode: report a price change only when it is at least this many percent of the last reported price. Smaller moves add up until they reach it. 0 = every change. Example: 5.

## Actor input object example

```json
{
  "maxItems": 20,
  "mode": "scrape",
  "searchUrls": [],
  "locations": [
    "Madrid"
  ],
  "operation": "sale",
  "propertyType": "homes",
  "sort": "relevance",
  "maxPagesPerSearch": 10,
  "onlyReduced": false,
  "duplicates": "flag",
  "includeDescription": true,
  "priceAlerts": "drops",
  "minPriceDropPercent": 0
}
```

# Actor output Schema

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

All pushed rows (dataset, JSON)

## `resultsTable` (type: `string`):

Dataset in the Console viewer

## `runSummary` (type: `string`):

RUN_SUMMARY record

# 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 = {
    "maxItems": 20,
    "locations": [
        "Madrid"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("datahamster/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 = {
    "maxItems": 20,
    "locations": ["Madrid"],
}

# Run the Actor and wait for it to finish
run = client.actor("datahamster/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 '{
  "maxItems": 20,
  "locations": [
    "Madrid"
  ]
}' |
apify call datahamster/fotocasa-scraper --silent --output-dataset

```

## MCP server setup

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