# Fotocasa Scraper: Spanish Property Listings for Sale and Rent (`santamaria-automations/fotocasa-scraper`) Actor

Get property listings from Fotocasa.es list pages: price, old price, rooms, bathrooms, surface, address, coordinates, features, images, dates and agency details. Sale and rent, no login needed.

- **URL**: https://apify.com/santamaria-automations/fotocasa-scraper.md
- **Developed by:** [NanoScrape](https://apify.com/santamaria-automations) (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.00 / 1,000 listing delivereds

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

Get property listings from [Fotocasa](https://www.fotocasa.es/), the Spanish property portal. Give the actor a list page address or a city name, choose buy or rent, and it returns one record per listing: price, price drop, rooms, bathrooms, surface, address, coordinates, features, images, dates and the agency behind the ad. No login and no API key are needed.

### What you get

- One record per listing from Fotocasa list pages, about 30 listings per page.
- Sale and rent lists. Pass a list page address, or a city slug with the operation.
- Several pages in one run. Set `maxItems` and the actor reads as many pages as it needs.
- Each listing once per run, even if it shows up on more than one page.
- A run that is interrupted continues where it stopped. Listings already delivered are not delivered or charged again.
- You pay only for listings that were saved to the dataset.

### Use with AI agents (MCP)

Connect this actor to any MCP-compatible AI client, such as Claude Desktop, Cursor, VS Code, LangChain or LlamaIndex.

**MCP server URL:**

```
https://mcp.apify.com?tools=santamaria-automations/fotocasa-scraper
```

**Example prompt once connected:**

> "Use `fotocasa-scraper` to list 60 flats for sale in Madrid with price, rooms, surface and agency, as a CSV."

### Data extracted

| Field | Example |
|-------|---------|
| `id` | `"191064926"` |
| `url` | Link to the listing page |
| `operation` | `"buy"` or `"rent"` |
| `property_type`, `property_subtype` | `"Flat"`, `"Attic"` |
| `price` | `349900` |
| `price_text` | `"349.900 €"` |
| `currency` | `"EUR"` |
| `price_period` | `"month"` for monthly rents |
| `price_drop`, `old_price` | Reduction shown on the card and the price before it |
| `rooms`, `bathrooms` | `2`, `1` |
| `surface_m2` | `80` |
| `floor_code` | Site code for the floor |
| `attribute_codes` | Site codes for conservation status, orientation, antiquity and hot water |
| `features` | `["heating", "terrace", "elevator"]` |
| `highlights` | Highlight tags such as `IS_EXTERIOR` |
| `location`, `neighborhood`, `district`, `city`, `province`, `region`, `zip_code`, `country` | Address parts |
| `latitude`, `longitude` | Coordinates |
| `description` | Text written by the advertiser |
| `images`, `image_count` | Image links and their number |
| `other_media` | Videos, virtual tours and floor plans |
| `published_at`, `updated_at` | Dates in UTC |
| `is_new_construction`, `is_promotion`, `is_highlighted`, `is_top`, `is_opportunity`, `is_bare_ownership`, `is_occupied`, `is_auctioned`, `is_rented_with_tenants`, `is_temporary_rental` | Flags shown by the site |
| `promotion_title`, `promotion_url` | New development name and link, when the listing belongs to one |
| `advertiser_type` | `"professional"` or `"private"` |
| `agency_name`, `agency_id`, `agency_url`, `agency_logo`, `agency_phone` | Agency details, for professional advertisers only |
| `source_url`, `page`, `scraped_at` | Where and when the row was read |

Fields that a page does not show are returned empty. For private advertisers the actor returns only `advertiser_type`; their name, link and phone number are not copied.

### Pricing

Pay-per-event pricing. You pay only for listings that were saved to the dataset.

| Event | Price |
|-------|-------|
| Actor start (`actor-start`) | $0.001 |
| Listing scraped (`listing-result`) | $0.001 per listing ($1.00 per 1,000) |

The start event is charged once per run, together with the first saved listing. A run that returns nothing is not charged. If you set a maximum cost per run, the actor stops before it goes over that limit.

### Input

| Field | Type | Description | Default |
|-------|------|-------------|---------|
| `startUrls` | string\[] | Fotocasa list pages, for example `https://www.fotocasa.es/es/comprar/viviendas/madrid-capital/todas-las-zonas/l`. Filters that are part of the address are kept. | none |
| `locations` | string\[] | City slugs such as `madrid-capital` or `barcelona-capital`. Used with `operation` and `propertyType`. | none |
| `operation` | string | `buy` or `rent`, for `locations`. | `buy` |
| `propertyType` | string | `viviendas` (homes), `locales`, `oficinas`, `garajes` or `terrenos`, for `locations`. | `viviendas` |
| `maxItems` | integer | Most listings to return across all inputs. 0 uses 100. | `100` |

At least one of `startUrls` or `locations` is required.

### Usage examples

#### Flats for sale in Madrid

```json
{
  "locations": ["madrid-capital"],
  "operation": "buy",
  "maxItems": 60
}
```

#### Rentals in two cities

```json
{
  "locations": ["barcelona-capital", "valencia-capital"],
  "operation": "rent",
  "maxItems": 200
}
```

#### A list page you copied from the site

```json
{
  "startUrls": ["https://www.fotocasa.es/es/alquiler/viviendas/barcelona-capital/todas-las-zonas/l"],
  "maxItems": 100
}
```

### Output

Results are saved to the default dataset. Export them as JSON, CSV or Excel, or read them through the API.

```json
{
  "id": "191064926",
  "url": "https://www.fotocasa.es/es/comprar/vivienda/madrid-capital/calefaccion-terraza-ascensor-no-amueblado/191064926/d",
  "operation": "buy",
  "property_type": "Flat",
  "price": 349900,
  "price_text": "349.900 €",
  "currency": "EUR",
  "price_drop": 10000,
  "old_price": 359900,
  "rooms": 2,
  "bathrooms": 1,
  "surface_m2": 80,
  "features": ["heating", "terrace", "elevator", "balcony"],
  "location": "Calle de Benidorm, Ventas",
  "district": "Ciudad Lineal",
  "city": "Madrid",
  "province": "Madrid",
  "zip_code": "28017",
  "latitude": 40.43145,
  "longitude": -3.65245,
  "image_count": 8,
  "published_at": "2026-10-08T19:51:12Z",
  "advertiser_type": "professional",
  "agency_name": "TengoTuCasa",
  "agency_id": "9202776551264",
  "source_url": "https://www.fotocasa.es/es/comprar/viviendas/madrid-capital/todas-las-zonas/l",
  "page": 1,
  "scraped_at": "2026-11-07T15:00:00Z"
}
```

(The sample is shortened. Real rows also hold the description, image links and the other fields listed above.)

### Limitations

- Only list pages are read. The actor does not open single listing pages, so details that appear only there are not included.
- Floor, conservation status, orientation, antiquity and hot water come as site codes, not as text. The actor does not translate them.
- `price_drop` is the reduction the card shows; `old_price` is calculated as price plus that reduction.
- The site may limit how deep a long list goes. If a list ends early, the run ends with the listings it found.
- Only the home list type (`viviendas`) has been tested in depth. Other property types use the same address pattern.
- Descriptions are copied as the advertiser wrote them.
- Fotocasa terms limit commercial reuse of its content and images. You are responsible for how you use the data.

### FAQ

**How do I find the city slug?**
Open a list page on fotocasa.es and look at the address. In `.../comprar/viviendas/madrid-capital/todas-las-zonas/l` the slug is `madrid-capital`.

**Can I use filters such as price or rooms?**
Set them on the site, copy the list address and use it as a start URL. Filters that are part of the address are kept on every page.

**Why is a field empty?**
The card did not show it. Phone numbers, for example, are missing on some ads.

**Do I get private sellers?**
Yes, as rows with `advertiser_type` set to `private`. Their name, link and phone number are not returned.

**What happens when I set a maximum cost?**
The actor stops before the limit and the run status says so.

**What does a run cost?**
One start event plus one result event per listing saved. See the pricing table above.

# Actor input Schema

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

Fotocasa list pages, for example https://www.fotocasa.es/es/comprar/viviendas/madrid-capital/todas-las-zonas/l . Further pages (/l/2, /l/3) are read until Max items is reached. Leave empty when you use Locations.

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

City slugs as they appear in Fotocasa addresses, for example madrid-capital or barcelona-capital. Used with Operation and Property type.

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

Buy or rent. Used with Locations.

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

Kind of property for Locations. Homes (viviendas) is the main option.

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

Most listings to return across all lists. 0 or empty uses 100.

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

Connection settings. The default works for most runs; the actor chooses the level it needs.

## Actor input object example

```json
{
  "startUrls": [
    "https://www.fotocasa.es/es/comprar/viviendas/madrid-capital/todas-las-zonas/l"
  ],
  "operation": "buy",
  "propertyType": "viviendas",
  "maxItems": 60,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}
```

# Actor output Schema

## `defaultDataset` (type: `string`):

Dataset with one row per property listing

# 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": [
        "https://www.fotocasa.es/es/comprar/viviendas/madrid-capital/todas-las-zonas/l"
    ],
    "maxItems": 60,
    "proxyConfiguration": {
        "useApifyProxy": true
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("santamaria-automations/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 = {
    "startUrls": ["https://www.fotocasa.es/es/comprar/viviendas/madrid-capital/todas-las-zonas/l"],
    "maxItems": 60,
    "proxyConfiguration": { "useApifyProxy": True },
}

# Run the Actor and wait for it to finish
run = client.actor("santamaria-automations/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 '{
  "startUrls": [
    "https://www.fotocasa.es/es/comprar/viviendas/madrid-capital/todas-las-zonas/l"
  ],
  "maxItems": 60,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}' |
apify call santamaria-automations/fotocasa-scraper --silent --output-dataset

```

## MCP server setup

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