# Fotocasa Scraper — Spain Property Listings, GPS & Agencies (`ocrad/fotocasa-scraper`) Actor

Scrape Fotocasa.es Spanish listings: € price, rooms, size, GPS coordinates, agency, features, description and photos from any search URL. Export JSON/CSV/Excel.

- **URL**: https://apify.com/ocrad/fotocasa-scraper.md
- **Developed by:** [Ocrad](https://apify.com/ocrad) (community)
- **Categories:** Real estate, Lead generation, Agents
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.90 / 1,000 records

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 Property Scraper

***

By providing any fotocasa.es search URL, you can retrieve structured property data across multiple result pages.

***

#### **📋 Example Output**

**Basic record** (`detailedInfo: false`):

```json
{
  "id": "184727064",
  "url": "https://www.fotocasa.es/es/comprar/vivienda/madrid-capital/aire-acondicionado-calefaccion-terraza-trastero/184727064/d",
  "title": "Piso de 98 metros cuadrados de diseño, salón independiente con acceso a dos terrazas, 2 dormitorios dobles con armarios ",
  "price": "380000 €",
  "address": null,
  "city": "Madrid",
  "typeAndIntro": "Flat / Flat",
  "availability": null,
  "tags": [],
  "imageUrl": "https://static.fotocasa.es/images/ads/70c29364-e918-4b77-9259-5671fd730fdb?rule=original",
  "bedrooms": null,
  "bathrooms": null,
  "areaSize": "99 m²",
  "coordinates": {
    "lat": 40.38294304263986,
    "lon": -3.674329182347558
  },
  "agentNames": null,
  "agencyName": "TORRESRUBI GESTION INMOBILIARIA",
  "listedAt": {
    "diff": 616,
    "unit": "DAYS",
    "timestamp": 1730220814647
  },
  "scrapedAt": "2026-07-08T14:47:30.592Z"
}
```

**Detailed record** (`detailedInfo: true`, additional fields):

```json
{
  "title": "Piso en venta en Calle Lagartera",
  "levels": null,
  "livingSpaceArea": "99 m²",
  "propertyFeatures": {},
  "featureGroups": [],
  "rooms": null,
  "images": [
    "https://static.fotocasa.es/images/ads/70c29364-e918-4b77-9259-5671fd730fdb?rule=original",
    "https://static.fotocasa.es/images/ads/dde9e641-9051-4da1-85cd-e9ccfa757811?rule=original",
    "https://static.fotocasa.es/images/ads/08ccb586-3a9e-4daa-90d9-7968311cdb6e?rule=original",
    "… 31 more"
  ],
  "description": "Piso de 98 metros cuadrados de diseño, salón independiente con acceso a dos terrazas, 2 dormitorios dobles con armarios empotrados , anteriormente 3 dormitorios y él principal con vestidor forrado, co…"
}
```

#### ⚙️ **Configuration**

| Parameter | Type | Default | Description |
|-----------|------|---------|-------------|
| `url` | String | *(required)* | Fotocasa search URL with filters pre-applied. |
| `maxPages` | Integer | `1` | Number of result pages to scrape (1–1000). Each page typically contains 30 listings. |
| `detailedInfo` | Boolean | `false` | Visit each listing's detail page for full property data (slower, more data). |
| `proxyConfiguration` | Object | Apify Proxy (auto) | Proxy settings. Switch to a RESIDENTIAL group if you see blocks or empty results. |

##### Example Input

```json
{
  "url": "https://www.fotocasa.es/es/comprar/viviendas/madrid-capital/todas-las-zonas/l",
  "maxPages": 5,
  "detailedInfo": false
}
```

##### Getting your search URL

1. Go to [fotocasa.es](https://www.fotocasa.es)
2. Run a search (comprar / alquiler) and apply your filters
3. Copy the full URL from your browser address bar (it usually ends in `/l`)
4. Paste it as the `url` input — pagination is handled automatically via the `/l/N` path

***

#### 💬 **Support and Feedback**

Need help or have suggestions? Reach out via Apify support channels or leave feedback on the Actor's page.

***

#### **Is it legal to scrape fotocasa.es data?**

It is legal to scrape publicly available data such as property prices, addresses, and listing details. However, you should be aware that results may contain personal information (agent names, contact details).

Personal data is protected by GDPR and other regulations. You should not scrape personal data unless you have a legitimate reason to do so. If you're unsure whether your reason is legitimate, please consult your lawyers. You can also read Apify's blog post on the legality of web scraping.

# Actor input Schema

## `url` (type: `string`):

A Fotocasa.es search results page URL with your filters already applied.

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

How many result pages to scrape (~30/page). Pagination: path /l/N (1-based).

## `detailedInfo` (type: `boolean`):

Visit each listing's detail page (slower, more requests).

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

Proxy settings. Defaults to Apify Proxy (auto). Switch to RESIDENTIAL if blocked.

## Actor input object example

```json
{
  "url": "https://www.fotocasa.es/es/comprar/viviendas/madrid-capital/todas-las-zonas/l",
  "maxPages": 1,
  "detailedInfo": false,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}
```

# Actor output Schema

## `id` (type: `string`):

Listing ID

## `url` (type: `string`):

Full listing detail URL

## `title` (type: `string`):

Listing title / address

## `price` (type: `string`):

Formatted price string

## `address` (type: `string`):

Street address when available

## `city` (type: `string`):

City / locality

## `typeAndIntro` (type: `string`):

Property type and short intro

## `availability` (type: `string`):

Availability / status label

## `tags` (type: `string`):

Array of tag / badge strings

## `imageUrl` (type: `string`):

Primary image URL

## `bedrooms` (type: `string`):

Number of bedrooms (null when not provided)

## `bathrooms` (type: `string`):

Number of bathrooms (null when not provided)

## `areaSize` (type: `string`):

Area string

## `levels` (type: `string`):

Floor / levels (detail mode)

## `livingSpaceArea` (type: `string`):

Living space string (detail mode)

## `propertyFeatures` (type: `string`):

Object of label to value spec pairs (detail mode)

## `featureGroups` (type: `string`):

Array of grouped feature lists (detail mode)

## `rooms` (type: `string`):

Rooms info (site-specific) (detail mode)

## `images` (type: `string`):

Array of image URLs (detail mode)

## `description` (type: `string`):

Listing description text (detail mode)

## `coordinates` (type: `string`):

GPS coordinates object when available (detail mode)

## `agentNames` (type: `string`):

Agent / broker name(s)

## `agencyName` (type: `string`):

Agency / office name

## `scrapedAt` (type: `string`):

ISO 8601 scrape timestamp

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

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

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

```

## MCP server setup

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