# Fotocasa Spain Scraper — Property Listings & Agency Leads (`noahadler/fotocasa-spain-property-scraper`) Actor

Scrape Fotocasa.es sale and rent listings across Spain: price, m², rooms, location, agency contacts and listing URLs. Built for market analysis, lead gen and pricing intel. Clean property schema — not a bloated multi-portal scraper.

- **URL**: https://apify.com/noahadler/fotocasa-spain-property-scraper.md
- **Developed by:** [Noah Adler](https://apify.com/noahadler) (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 $3.50 / 1,000 properties

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 Real Estate Listings (Sale & Rent)

**Fotocasa scraper** for **Spain property listings**: extract ads from **Fotocasa.es** (comprar / alquiler) with price, m², rooms, bathrooms, neighborhood, coordinates and agency contacts.

Ideal if you need a **Fotocasa API**, **pisos Fotocasa Madrid/Barcelona**, **alquiler Fotocasa scraper**, or Spain **real estate data** for market analysis, leads and pricing intel.

> **Input:** city / `location` **or** a Fotocasa list URL.\
> **Output:** one Dataset row per property.

**Why this Actor:** Spain-focused · Buy & rent · Agency fields · Pagination · Cleaner Idealista alternative channel

***

### Table of contents

1. [What this Actor does](#what-this-actor-does)
2. [What you get](#what-you-get)
3. [Features](#features)
4. [Input](#input)
5. [Output example](#output-example)
6. [Output fields](#output-fields)
7. [Quick start (API)](#quick-start-api)
8. [Use cases](#use-cases)
9. [Limitations](#limitations)
10. [FAQ](#faq)
11. [Keywords](#keywords)

***

### What this Actor does

| Step | Action |
|------|--------|
| 1 | Open Fotocasa search result pages (venta or alquiler) |
| 2 | Read structured listing JSON embedded in the page |
| 3 | Paginate (`/l`, `/l/2`, …) until `maxItems` |
| 4 | Normalize price, size, rooms, geo and agency fields |

***

### What you get

**Pricing & property**

- `price`, `pricePerM2`, `currency`
- `surfaceM2`, `rooms`, `bathrooms`, `floor`

**Location**

- Municipality, district, neighborhood, zip, lat/lng

**Agency**

- Name, phone (when public), type, URL

***

### Features

| Capability | Detail |
|------------|--------|
| **Location or URL** | `Madrid` / slug **or** paste list URL |
| **Buy & rent** | `operation`: `buy` | `rent` |
| **Filters** | Optional min/max price |
| **Pagination** | `maxPages` + `maxItems` caps |
| **Spain SEO** | Built for ES real-estate queries |

***

### Input

| Field | Required | Description |
|-------|----------|-------------|
| `location` | Cond. | City or slug (`Madrid`, `barcelona-capital`) |
| `searchUrls` | Cond. | Full Fotocasa list URLs |
| `operation` | No | `buy` (default) or `rent` |
| `propertyType` | No | `home` |
| `maxItems` | No | Default 50 (max 500) |
| `maxPages` | No | Default 10 |
| `minPrice` / `maxPrice` | No | EUR filters |
| `proxyConfiguration` | No | Use RESIDENTIAL + ES if blocked |

#### Example — Madrid sale

```json
{
  "location": "Madrid",
  "operation": "buy",
  "maxItems": 100,
  "proxyConfiguration": { "useApifyProxy": true }
}
```

#### Example — Barcelona rent via URL

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

***

### Output example

```json
{
  "listingId": "189717534",
  "listingUrl": "https://www.fotocasa.es/es/comprar/vivienda/madrid-capital/.../d",
  "operation": "buy",
  "price": 650000,
  "currency": "EUR",
  "surfaceM2": 99,
  "rooms": 3,
  "bathrooms": 2,
  "municipality": "Madrid",
  "district": "Barrio de Salamanca",
  "agencyName": "Lucas Fox"
}
```

***

### Output fields

| Group | Fields |
|-------|--------|
| Identity | `listingId`, `listingUrl`, `operation`, `propertyType` |
| Price | `price`, `priceFormatted`, `pricePerM2`, `currency` |
| Specs | `surfaceM2`, `rooms`, `bathrooms`, `floor` |
| Geo | `address`, `district`, `neighborhood`, `municipality`, `province`, `zipCode`, `latitude`, `longitude` |
| Agency | `agencyName`, `agencyPhone`, `agencyType`, `agencyUrl` |
| Meta | `publishedAt`, `features`, `scrapedAt` |

***

### Quick start (API)

```python
from apify_client import ApifyClient

client = ApifyClient("<YOUR_TOKEN>")
run = client.actor("YOUR_USERNAME/fotocasa-spain-property-scraper").call(
    run_input={"location": "Barcelona", "operation": "rent", "maxItems": 40}
)
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)
```

***

### Use cases

- Track sale & rent prices by neighborhood
- Build agency lead lists (when phone is public)
- Compare inventory vs Idealista or your CRM
- Investor dashboards for Spanish cities

***

### Limitations

- Focused on **viviendas** list search in v0.1.
- Some agency phones are gated / missing.
- Site changes can require parser updates.
- Respect Fotocasa Terms of Service.

***

### FAQ

**Madrid vs `madrid-capital`?**\
Both work — we slugify common city names.

**Rent vs buy?**\
Set `operation` to `rent` or `buy` (or use an alquiler/comprar URL).

**Blocked?**\
Enable Apify Proxy (RESIDENTIAL + ES often helps).

***

### Keywords

fotocasa scraper, fotocasa api, fotocasa.es, spain real estate scraper, pisos fotocasa, alquiler fotocasa, madrid property listings, barcelona real estate data

# Actor input Schema

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

Fotocasa location text or slug. Examples: Madrid, Barcelona, madrid-capital, valencia-capital.

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

Optional. Full Fotocasa listing page URLs (…/l or …/l/2). Overrides location when set.

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

buy = comprar, rent = alquiler

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

Currently supports homes/viviendas.

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

Maximum number of property ads to return (1–500).

## `maxPages` (type: `integer`):

Maximum Fotocasa result pages to visit.

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

Optional minimum price filter.

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

Optional maximum price filter.

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

Apify Proxy recommended (RESIDENTIAL + ES if blocked).

## Actor input object example

```json
{
  "location": "Madrid",
  "operation": "buy",
  "propertyType": "home",
  "maxItems": 50,
  "maxPages": 10,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}
```

# Actor output Schema

## `listings` (type: `string`):

Spain real estate ads scraped from Fotocasa.

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

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

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

```

## MCP server setup

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