# Fotocasa Scraper: Spain Property Listings (`kareninatech/fotocasa-scraper`) Actor

Scrape Fotocasa.es property listings (inmuebles) in Spain from a search URL or filters. Extract price, EUR/m², price drops, rooms, baths, m², amenities, optional energy certificate, address, coordinates, agency contacts, days on market, and monitor mode.

- **URL**: https://apify.com/kareninatech/fotocasa-scraper.md
- **Developed by:** [Karen Gisela Gallegos Aguilar](https://apify.com/kareninatech) (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

from $1.00 / 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?

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: Spain property listings API

Use this Fotocasa API alternative to scrape Fotocasa.es listings (inmuebles en venta y alquiler) across Spain and export JSON, CSV or Excel.

Want to find your next flat in Madrid, track rental prices in Barcelona, or analyze the Spanish housing market? This scraper makes it super easy!

Paste an `input_url` from your browser once you have already filtered on Fotocasa (great for people), or use structured filters such as operation, property type, location, price, bedrooms, bathrooms, and surface (great for AI agents). When `input_url` is set, it overrides the filters. Either way, you get up to 1000 Fotocasa.es listings per run with price, EUR per m2, price drops, days on market, decoded amenities, optional energy certificate, agency details, and photos as CSV, Excel, or JSON.

#### Perfect for...

- **Home buyers and renters:** Monitor new listings and spot the best deals in your city or neighborhood.
- **Real estate agencies:** Track competitor inventory, pricing, and how fast listings appear.
- **Investors:** Compare price per m2 across cities, districts, and property types to find yield opportunities.
- **Market research:** Analyze average prices, rent levels, and supply by zone across Spain.
- **Data analysts:** Download clean, flat rows ready for dashboards, spreadsheets, or models.
- **Proptech builders:** Feed listing data into valuation tools, alerts, and price trackers.
- **AI agents:** Power bots that need live Spanish property listings on demand.
- **RAG systems:** Feed listing descriptions, specs, and pricing into retrieval pipelines.
- **AI workflows:** Plug structured real estate data into LangChain, AutoGPT, CrewAI, and similar stacks.

#### Why you'll love this scraper

- 🔗 **Input URL or filters:** Paste a search URL if you already filtered in the browser, or use structured filters for agent friendly runs. `input_url` always wins when set.
- 🏷️ **Website matched filters:** Operation, property type, location, and zone use the same slugs as Fotocasa, so what you see on the site is what you get.
- 📊 **Rich listings:** Price, price per m2, price drops, previous price, days on market, rooms, bathrooms, surface, decoded floor, conservation, orientation, antiquity, amenity flags, address, coordinates, agency, and every photo out of the box.
- ⚡ **Fast and light:** Reads the data Fotocasa already ships in each results page. No browser needed, so runs are quick and cheap.
- 🔋 **Optional energy certificate:** Turn on `fetch_details` to open each listing page for CEE rating, consumption, emissions, agency website/email when present, and the Spanish amenities list. Competitors often bill this as an extra event.
- 🔔 **Monitor mode:** Remember listings across scheduled runs and emit only new or price-changed rows (`monitor_status`). The main Store competitor does not ship this.
- 🏙️ **Multi-city and more ops:** Search several locations in one run, plus buy, rent, shared room, transfer, and rent-to-buy.
- 🧹 **Clean output:** Flat snake_case fields, deduplicated by listing id, with consistent `null` values when something is missing.
- 🛑 **Hard caps:** Returns at most `max_properties` listings per run (up to 1000), then stops cleanly.
- 🇪🇸 **All of Spain:** Any city, province, or the whole country (`espana`), for sale or for rent.

#### What's inside the data?

**Core**

- `id`, `title`, `url`, `operation` (sale or rent), `property_type`, `building_type`, `building_subtype`

**Pricing**

- `price`, `currency`, `price_period` (month for rentals), `price_per_m2`, `price_reduced_by`, `is_price_reduced`, `previous_price` (before the drop, or from monitor memory)

**Specs**

- `rooms`, `bathrooms`, `surface_m2`, `floor` (decoded number), `floor_label`, `floor_code`
- `conservation_status`, `orientation`, `antiquity`, `hot_water`, `heating` (human labels plus `*_code` fields)
- Amenity flags from the listing URL: `has_elevator`, `has_terrace`, `has_parking`, `has_heating`, `has_air_conditioning`, `has_pool`, `has_garden`, `has_storage`, `has_patio`, `has_balcony`, `is_furnished`, `has_tv`, `has_internet`, plus `amenities` list
- `is_exterior`, `is_luxury`, `is_modern` from Fotocasa dynamic features
- `extra_features` (raw Fotocasa feature codes)

**Location**

- `address`, `street`, `street_number`, `neighborhood`, `district`, `city`, `province`, `region`, `zip_code`, `latitude`, `longitude`, `is_exact_address`

**Description and media**

- `description_snippet` (always), `description` (full text, optional), `main_image`, `images`, `image_count`

**Advertiser**

- `agency_name`, `advertiser_type` (professional or private), `agency_phone`, `agency_url`, `agency_logo`, `agency_id`
- With `fetch_details`: `agency_website`, `agency_email` when Fotocasa exposes them

**Flags**

- `is_new_construction`, `is_new_listing`, `is_highlighted`, `is_opportunity`, `has_video`, `has_virtual_tour`, `has_floor_plans`, `is_occupied`, `is_bare_ownership`, `is_auctioned`, `is_rented_with_tenants`, `is_temporary_rental`, `has_subsidies`, `has_quality_seal`

**Energy certificate** (when `fetch_details` is true)

- `energy_rating`, `energy_consumption`, `emissions_rating`, `emissions`, `energy_certificate_status`, `construction_type`, `ground_surface_m2`, `occupancy_status`, `detail_fetched`

**Meta**

- `publication_date`, `listed_date`, `days_on_market`, `monitor_status` (`new` or `changed` in monitor mode), `scraped_at`

#### Sort options

Use `sort_by` with one of these values (ignored when `input_url` is set, because the URL already carries its own order):

| Value | Order |
|---|---|
| empty | Relevance (Fotocasa default) |
| `newest` | Newest listings first |
| `price_asc` | Price, low to high |
| `price_desc` | Price, high to low |
| `surface_desc` | Largest first |
| `surface_asc` | Smallest first |

#### Quick start

**Option A. Input URL (great for people)**

1. Open [fotocasa.es](https://www.fotocasa.es), search a location, and apply your filters.
2. Copy the results URL from the address bar (it ends in `/l`, sometimes followed by `?` and filters).
3. Paste it into `input_url`.
4. Set `max_properties` and click Start.

**Option B. Structured filters (great for AI agents)**

1. Leave `input_url` empty.
2. Pick `operation`, `property_type`, and `location` (for example `madrid-capital`).
3. Add any price, bedroom, bathroom, or surface filters you need.
4. Choose `sort_by`, set `max_properties`, and click Start.
5. Export CSV, Excel, or JSON when done.

#### Tech details for developers

**Input example (filters)**

```json
{
  "operation": "alquiler",
  "property_type": "viviendas",
  "location": "barcelona-capital",
  "min_rooms": 2,
  "max_price": 2000,
  "sort_by": "newest",
  "max_properties": 100
}
```

**Input example (URL)**

```json
{
  "input_url": "https://www.fotocasa.es/es/comprar/viviendas/madrid-capital/barrio-de-salamanca/l?maxPrice=900000",
  "max_properties": 200,
  "include_full_description": false
}
```

**Output example**

```json
{
  "id": 189130087,
  "title": "Piso en venta en Carrer de les Agudes 26, Nou Barris",
  "url": "https://www.fotocasa.es/es/comprar/vivienda/barcelona-capital/ascensor-no-amueblado/189130087/d",
  "operation": "sale",
  "property_type": "HOMES",
  "building_type": "Flat",
  "building_subtype": "GroundFloorWithGarden",
  "price": 93000,
  "currency": "EUR",
  "price_period": null,
  "price_per_m2": 1309.86,
  "price_reduced_by": 1000,
  "is_price_reduced": true,
  "rooms": 1,
  "bathrooms": 1,
  "surface_m2": 71,
  "floor": 3,
  "address": "Carrer de les Agudes 26, Nou Barris",
  "street": "Carrer de les Agudes",
  "neighborhood": "Ciutat Meridiana",
  "district": "Nou Barris",
  "city": "Barcelona",
  "province": "Barcelona",
  "region": "Cataluña",
  "zip_code": "08033",
  "latitude": 41.4620944,
  "longitude": 2.1772116,
  "is_exact_address": true,
  "description_snippet": "Espacio de 70 metros actualmente como almacén, con puerta de acceso como el resto de vecinos dentro de la portería, sumando persiana exterior directa a la calle, que puedes reformar como vivienda o...",
  "description": null,
  "agency_name": "INMOBILIARIA VENDOPOR",
  "advertiser_type": "professional",
  "agency_phone": "+34 900 000 000",
  "agency_url": "https://www.fotocasa.es/es/inmobiliaria-inmobiliaria-vendopor/comprar/viviendas/espana/todas-las-zonas/l?clientId=9202769691649&publisherId=8dbe36f2-4489-4e00-82e7-e21319808b07",
  "agency_logo": null,
  "main_image": "https://static.fotocasa.es/images/ads/2e26e3db-ebaf-4dc2-b8f0-83ab5b2a08a0?rule=original",
  "images": [
    "https://static.fotocasa.es/images/ads/2e26e3db-ebaf-4dc2-b8f0-83ab5b2a08a0?rule=original",
    "https://static.fotocasa.es/images/ads/e6b42013-d801-4d13-8000-db2d2f4f3781?rule=original",
    "..."
  ],
  "image_count": 47,
  "publication_date": "2026-03-17T14:14:55.953",
  "is_new_construction": false,
  "is_highlighted": false,
  "is_opportunity": false,
  "has_video": true,
  "has_virtual_tour": false,
  "has_floor_plans": false,
  "is_occupied": false,
  "is_bare_ownership": false,
  "is_auctioned": false,
  "is_rented_with_tenants": false,
  "extra_features": {
    "antiquity": 7,
    "bathrooms": 1,
    "conservationStatus": 4,
    "floor": 3,
    "orientation": 5,
    "rooms": 1,
    "surface": 71
  },
  "scraped_at": "2026-11-05T12:53:51.669Z"
}
```

#### Input reference

| Field | Type | Default | Description |
|---|---|---|---|
| `input_url` | string | empty | Fotocasa search results URL. Overrides all filters when set. |
| `start_urls` | array | empty | Extra search URLs for the same run. Also overrides filters. |
| `operation` | string | `comprar` | `comprar`, `alquiler`, `compartir`, `traspaso`, or `alquiler-con-opcion-a-compra`. |
| `property_type` | string | `viviendas` | `viviendas`, `pisos`, `aticos`, `duplex`, `estudios`, `lofts`, `bajos`, `chalets`, `adosados`, `casas-rurales`, `oficinas`, `locales`, `garajes`, `terrenos`, `trasteros`, `naves-industriales`, `edificios`. |
| `location` | string | `madrid-capital` | Fotocasa location slug, for example `barcelona-capital`, `valencia-provincia`, `espana`. |
| `locations` | array | empty | Extra locations to search in the same run (same filters). |
| `zone` | string | empty | Optional district slug inside the location, for example `chamberi` or `barrio-de-salamanca`. |
| `min_price` / `max_price` | integer | empty | Price range in EUR (monthly rent for rentals). |
| `min_rooms` / `max_rooms` | integer | empty | Bedroom range. |
| `min_bathrooms` | integer | empty | Minimum bathrooms. |
| `min_surface` / `max_surface` | integer | empty | Surface range in m2. |
| `sort_by` | string | empty | See Sort options above. |
| `max_properties` | integer | `100` | Max listings per run, up to 1000. |
| `include_full_description` | boolean | `true` | Adds the full description text. |
| `fetch_details` | boolean | `false` | Open each detail page for energy certificate, amenities list, agency website/email. |
| `monitor_mode` | boolean | `false` | Emit only new or changed listings vs the last run. |
| `monitor_key` | string | `default` | Namespace for monitor memory across schedules. |
| `proxyConfiguration` | object | Apify Proxy | Proxy settings. Switch to RESIDENTIAL with country ES if you hit blocks. |

#### Notes on filters

- **Location slugs:** Fotocasa uses `-capital` for the city and `-provincia` for the whole province, for example `madrid-capital` vs `madrid-provincia`. If you type a plain name like `Sevilla`, the scraper tries `sevilla`, then `sevilla-capital`, then `sevilla-provincia`.
- **Zones:** Copy the district slug from the Fotocasa URL after choosing a zone on the site, for example `/madrid-capital/chamberi/l`.
- **Rentals:** For `alquiler`, prices are monthly and `price_period` is `month`.
- **Price drops:** `price_reduced_by` is the amount Fotocasa shows as a reduction, `is_price_reduced` is `true` when it is above zero, and `previous_price` is the price before that drop (or the last seen price in monitor mode).
- **Floor codes:** Fotocasa search JSON stores floor as an opaque code. This Actor decodes it to a real floor number (`0` = ground / Bajos) and keeps `floor_code` for the raw value.
- **Amenity flags without detail fetch:** Search result URLs already embed amenity tokens (ascensor, terraza, parking...). Those become boolean flags at no extra request cost.
- **Energy certificate:** Only available when `fetch_details` is enabled. One extra HTTP request per listing.
- **Monitor mode:** Stores seen ids under a named key-value store. Unchanged listings (same price and listed date) are skipped. Emitted rows get `monitor_status` = `new` or `changed`.
- **Contact data:** Phone numbers are only returned for professional advertisers (agencies). Listings from private individuals never include a phone. Agency email/website come from the detail page when present.
- **Public data only:** The scraper reads public search and detail pages. Please use the data responsibly and in line with Fotocasa's terms and applicable privacy laws such as GDPR.

### FAQ

**What is the best way to start?** Paste a Fotocasa.es search URL after you set filters in the browser, or use the structured filters (operation, property type, location, price, rooms). If `input_url` is set, it overrides the filters.

**Do I need to code?** No. Run it in Apify Console and export JSON, CSV or Excel. You can also call this Fotocasa API alternative from your own code or tools.

**When do I get the energy certificate?** Turn on `fetch_details`. That opens each listing page for CEE rating and extra agency fields. It is optional and uses one extra request per listing.

**What does monitor mode do?** On a schedule, the Actor emits only new or price-changed listings (`monitor_status`) compared with the last run.

**Is this an official Fotocasa API?** No. It reads public search and detail pages and is not affiliated with Fotocasa. Use the data in line with their terms and privacy laws such as GDPR.

### Related Actors

More data extractors by [kareninatech](https://apify.com/kareninatech):

- [Habitaclia Scraper — Spain property listings](https://apify.com/kareninatech/habitaclia-scraper)
- [BOE Subastas Scraper — Spain official auctions](https://apify.com/kareninatech/boe-subastas-scraper)
- [Argenprop Scraper — Argentina and Uruguay listings](https://apify.com/kareninatech/argenprop-scraper)
- [Fincaraiz Scraper — Colombia property listings](https://apify.com/kareninatech/fincaraiz-scraper)

#### Need a custom scraper or AI agent?

Need extra fields, another Spanish portal, scheduled price alerts, or a full data pipeline? Open an issue on this Actor and let's build it together.

# Actor input Schema

## `input_url` (type: `string`):

Optional. Paste a Fotocasa search results URL after filtering on the website (it ends in /l, for example https://www.fotocasa.es/es/comprar/viviendas/madrid-capital/todas-las-zonas/l). When set, it overrides all the filters below. Leave empty to use structured filters, which is better for AI agents.

## `start_urls` (type: `array`):

Optional. More Fotocasa search result URLs to scrape in the same run. Also overrides the filters.

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

Buy, rent, shared room, transfer, or rent-to-buy. Ignored when input_url is set.

## `property_type` (type: `string`):

Same category slugs as on Fotocasa. Ignored when input_url is set.

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

Fotocasa location slug, for example madrid-capital, barcelona-capital, valencia-provincia or espana. A plain city name like Sevilla also works: the scraper tries sevilla, then sevilla-capital, then sevilla-provincia. Ignored when input_url is set.

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

Optional. Search several cities in one run. Each uses the same operation, property type, zone and filters. Ignored when input_url is set.

## `zone` (type: `string`):

Optional neighborhood or district slug used by Fotocasa inside the location, for example barrio-de-salamanca or chamberi for madrid-capital. Leave empty for all zones (todas-las-zonas).

## `min_price` (type: `integer`):

Minimum price. For rentals this is the monthly rent.

## `max_price` (type: `integer`):

Maximum price. For rentals this is the monthly rent.

## `min_rooms` (type: `integer`):

Minimum number of bedrooms, for example 2. Leave empty for no minimum.

## `max_rooms` (type: `integer`):

Maximum number of bedrooms, for example 4. Leave empty for no maximum.

## `min_bathrooms` (type: `integer`):

Minimum number of bathrooms, for example 1. Leave empty for no minimum.

## `min_surface` (type: `integer`):

Minimum built surface in square metres, for example 60. Leave empty for no minimum.

## `max_surface` (type: `integer`):

Maximum built surface in square metres, for example 180. Leave empty for no maximum.

## `sort_by` (type: `string`):

Order of results. Empty keeps Fotocasa's default relevance order. Ignored when input_url is set.

## `max_properties` (type: `integer`):

Maximum number of listings to return per run (up to 1000).

## `include_full_description` (type: `boolean`):

Adds the full listing description. A short description_snippet is always included.

## `fetch_details` (type: `boolean`):

Open each listing detail page for energy certificate (A-G + consumption + emissions), agency website/email when present, Spanish amenity list, construction type and exact street number. One extra request per property.

## `monitor_mode` (type: `boolean`):

Remember listing ids across runs in a named key-value store. Later runs skip listings that still have the same price and listed date, and emit rows with monitor_status new or changed when something moved. Pair with Apify Schedules for alerts.

## `monitor_key` (type: `string`):

Namespace for monitor mode so two schedules (for example Madrid vs Barcelona) do not share seen ids. Letters, numbers and dashes only. Leave empty for default.

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

Proxy settings. Apify Proxy is recommended. If you see blocks, switch to the RESIDENTIAL group with country ES.

## Actor input object example

```json
{
  "input_url": "",
  "operation": "comprar",
  "property_type": "viviendas",
  "location": "madrid-capital",
  "zone": "",
  "sort_by": "",
  "max_properties": 50,
  "include_full_description": true,
  "fetch_details": false,
  "monitor_mode": false,
  "monitor_key": "default",
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}
```

# Actor output Schema

## `overview` (type: `string`):

Table view of scraped results using the dataset 'overview' view.

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

All scraped results from the default dataset without view transformation.

# 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 = {
    "input_url": "",
    "location": "madrid-capital",
    "max_properties": 50,
    "proxyConfiguration": {
        "useApifyProxy": true
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("kareninatech/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 = {
    "input_url": "",
    "location": "madrid-capital",
    "max_properties": 50,
    "proxyConfiguration": { "useApifyProxy": True },
}

# Run the Actor and wait for it to finish
run = client.actor("kareninatech/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 '{
  "input_url": "",
  "location": "madrid-capital",
  "max_properties": 50,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}' |
apify call kareninatech/fotocasa-scraper --silent --output-dataset

```

## MCP server setup

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