# Fotocasa Spain Real Estate Scraper (`elpatomaster/fotocasa-listings`) Actor

Scrape home listings for sale and rent from Fotocasa Spain by province: price, surface, rooms, address, coordinates, advertiser and full description. Fast JSON API, no browser.

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

## Pricing

$2.00 / 1,000 property listings

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 Spain Real Estate Scraper

Homes for sale and for rent from **Fotocasa Spain**, straight from the portal's own JSON search API. No browser, no login, fast and cheap to run.

### What you get

One record per listing, newest first. Pick sale or rent, optionally narrow to a province, or leave the province empty to list the latest listings of the whole country. Each record has price, surface, rooms, bathrooms, address, coordinates, advertiser, publication date and the full description.

### Input

| Field | Type | Description |
|---|---|---|
| `transaction` | `buy` | `rent` | Homes for sale or for rent. Default `buy`. |
| `province` | string | Spanish province name, for example `Madrid`, `Barcelona`, `Sevilla`. Empty = whole country. |
| `maxItems` | integer | Maximum listings to return (1 to 10000). Default 100. |

Example:

```json
{
    "transaction": "buy",
    "province": "Madrid",
    "maxItems": 100
}
```

### Output

Real item from a run with the input above (description shortened here):

```json
{
  "id": 191074821,
  "transaction": "buy",
  "price": 295000,
  "currency": "EUR",
  "surface": 103,
  "rooms": 3,
  "bathrooms": 2,
  "floor": null,
  "features": ["air_conditioner", "balcony", "elevator", "heater"],
  "isNewBuild": true,
  "address": "Calle Alcocer, 3,  Madrid Capital",
  "region": "Madrid",
  "province": "Madrid",
  "municipality": "Madrid Capital",
  "neighbourhood": "Villaverde",
  "zipCode": "28021",
  "latitude": 40.35079,
  "longitude": -3.6951344,
  "advertiser": null,
  "publishedAt": "2026-10-09T23:04:07.747Z",
  "description": "...",
  "imageCount": 9,
  "imageUrl": "https://static.fotocasa.es/images/ads/729c60b6-3844-450a-b6f7-efadf7fce134?rule=original",
  "url": "https://www.fotocasa.es/es/comprar/vivienda/madrid-capital/.../191074821/d"
}
```

`price` is in euros; for rentals it is the monthly rent. `surface` is in square metres. `features` lists the boolean amenities the listing declares (terrace, elevator, air_conditioner, and so on). `rooms`, `bathrooms`, `floor` and `advertiser` are `null` when the listing does not declare them.

### Notes

- Only homes (houses and flats) are covered, not garages, commercial premises or land.
- Only publicly visible listings are collected.
- An unknown province name fails fast with the list of valid names.

### Pricing

Pay per event: **USD 0.002 per listing** (USD 2 per 1,000 listings). The default input (100 listings) costs about USD 0.20. Apify platform usage is included in the price.

### Use cases

- Spanish real estate market research: prices per square metre by province or neighbourhood.
- Investors and agencies: track new listings for sale or rent as they appear.
- Property data for apps, maps and dashboards: coordinates, surface, rooms and features.
- Scheduled monitoring: run the actor daily and send new listings to a spreadsheet or webhook.

### FAQ

**Do I need an account or a proxy?** No. You only provide sale or rent and an optional province.

**Does it include houses and flats?** It covers homes (viviendas). Commercial properties and land are not included.

**Is the rent price monthly?** Yes, for rentals `price` is the monthly rent in euros.

**Can I call it from my own code?** Yes, through the Apify API or the Python and JavaScript clients, and with integrations such as Make, Zapier or n8n.

# Actor input Schema

## `transaction` (type: `string`):

Homes for sale or for rent.

## `province` (type: `string`):

Spanish province name, for example Madrid, Barcelona or Sevilla. Leave empty to list the whole country.

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

Maximum number of listings to return, newest first.

## Actor input object example

```json
{
  "transaction": "buy",
  "province": "Madrid",
  "maxItems": 100
}
```

# 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 = {
    "province": "Madrid"
};

// Run the Actor and wait for it to finish
const run = await client.actor("elpatomaster/fotocasa-listings").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 = { "province": "Madrid" }

# Run the Actor and wait for it to finish
run = client.actor("elpatomaster/fotocasa-listings").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 '{
  "province": "Madrid"
}' |
apify call elpatomaster/fotocasa-listings --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,elpatomaster/fotocasa-listings"
        }
    }
}
```

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/P5b7bwcINIYVsXmOw/builds/YElf27knzV3XaETom/openapi.json
