# Fotocasa Scraper: Spain Property Listings for Sale and Rent (`tagadanar/fotocasa-scraper`) Actor

Scrape fotocasa.es property listings in Spain by city, district or pasted search URL: price, price drop, m², rooms, floor, condition, full address, GPS, description, photos, agency name and phone. $0.80 per 1,000 listings.

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

## Pricing

from $0.56 / 1,000 listings

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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 for Sale and Rent

Get fotocasa.es property listings for any place in Spain as clean, flat rows. Type a city, district or neighbourhood ("Madrid", "Chamberí, Madrid", "Valencia") or paste a fotocasa search URL, pick buy or rent and your filters, and get one row per listing: price, price drop, price per m², size, bedrooms, bathrooms, floor, condition, features, full address with GPS coordinates, the full description, photo URLs, publication date, and the agency's name and phone.

**$0.80 per 1,000 listings on Free ($0.56 on Gold), plus $0.001 per run. Platform usage is included.** No API key, no login, no proxy to configure.

### What you get

One flat row per listing. Fields the site does not publish for a listing are null.

| Field | What it is |
| --- | --- |
| `search` | The location or URL that found this listing |
| `id` | Fotocasa listing ID |
| `url` | Listing page on fotocasa.es |
| `operation` | buy, rent, share, transfer or rent to own |
| `propertyType` / `propertySubtype` | homes, garages, land, offices...; flat, penthouse, house / chalet, studio, duplex... (the subtype is null where Fotocasa sets none, e.g. garages and offices) |
| `price` | Asking price in EUR (monthly rent for rentals); null when the price is on request |
| `pricePeriod` | `month` for rentals (null on room-share and rent-to-own listings, where Fotocasa gives no period) |
| `priceDrop` / `previousPrice` | How much the price was cut, and the price before the cut |
| `pricePerSqm` | Price divided by the built area |
| `size` | Built area in m² |
| `rooms` / `bathrooms` | Bedrooms and bathrooms |
| `floor` | Floor number, "ground floor" or "basement" (`floorCode` keeps the site's own code) |
| `condition` | almost new, very good, good, needs renovation, renovated, new build |
| `features` | air conditioning, heating, elevator, terrace, balcony, garden, parking... |
| `isNewBuildDevelopment` / `developmentName` | New-build development the unit belongs to |
| `street`, `neighborhood`, `district`, `city`, `province`, `region`, `zipCode` | Address as published |
| `latitude` / `longitude` | Map position |
| `description` | The full listing text |
| `imageUrls`, `floorPlanUrls`, `videoUrls`, `virtualTourUrls` | Media links |
| `publishedAt` | Publication (or last refresh) date, ISO 8601 |
| `advertiserType` | professional or private |
| `agencyName`, `agencyPhone`, `agencyId`, `agencyUrl`, `agencyLogoUrl` | The agency behind a professional listing |
| `retrievedAt` | When the row was fetched (ISO 8601) |

Private owners: the row says `advertiserType: private` and never carries their name or phone.

### Who uses it

- **Investors and analysts**: price per m², price drops and supply by district, sale vs rent, to size yields or follow a market week by week.
- **Agencies and proptech teams**: new listings in their area with the competing agency's name and phone, to prospect or benchmark.
- **Relocation and rental services**: fresh rentals with photos, coordinates and descriptions, filtered by budget and size.

### Examples

Prefill (homes for sale in Madrid):

```json
{"locations":["Madrid"],"operation":"BUY","propertyType":"HOMES","maxItems":100}
```

Rentals in two districts, 2+ bedrooms, up to €1,800 a month, newest first:

```json
{"locations":["Chamberí, Madrid","Gràcia, Barcelona"],"operation":"RENT","minRooms":2,"maxPrice":1800,"sort":"NEWEST","maxItems":500}
```

A search you already built on fotocasa.es (its filters and sort are kept):

```json
{"searchUrls":["https://www.fotocasa.es/es/alquiler/viviendas/barcelona-capital/todas-las-zonas/l?maxPrice=900&minRooms=3"],"maxItems":200}
```

Listings published this week across several cities, at most 300 per city:

```json
{"locations":["Valencia","Sevilla","Málaga"],"operation":"BUY","publishedWithin":"LAST_WEEK","maxItems":900,"maxItemsPerSearch":300}
```

### How places are found

Each location is looked up in fotocasa's own place search, the same one behind the site's search box, and only a place with exactly that name is used. When a city and a province share a name, the city wins: "Málaga" is the city, "Málaga, province" is the province. To pick between districts or towns with the same name, add the city or province after a comma ("Chamberí, Madrid"). A name the site does not know is reported as LOCATION NOT FOUND with the site's own suggestions. For a hand-tuned filter set, build the search on fotocasa.es and paste its URL into `searchUrls`.

### Results, zeros and errors

- The run status lists every search with its listings delivered and the site's own total.
- A search the site answered with 0 listings is reported as "no listing" and costs nothing beyond the run start.
- A search the site refused, or the run clock stopped, is named as such in the status and is never reported as "no listing"; the listings delivered before it are kept.
- Invalid input ends the run right away with an "Input error: ..." message and only the $0.001 start charge.

### Pricing

- $0.001 per run (start).
- $0.80 per 1,000 listings on Free, with lower prices on higher Apify plans ($0.56 per 1,000 on Gold). Platform usage is included.

You only pay for listings delivered. Set a maximum charge per run in Apify if you want a hard ceiling; the actor stops at it and says so in the status.

### FAQ

**How many listings can one search return?** As many as fotocasa shows for that search; `maxItems` (up to 10,000 per run) and `maxItemsPerSearch` cap the run.

**Does it open every listing page?** No. Everything in a row comes from the search results the site serves, so runs are fast and cheap. A few details shown only on the listing page (energy certificate, some extra amenities) are not included; `moreFeaturesOnPage` tells you how many extra features the listing page lists.

**Can I get only new listings every day?** Sort by `NEWEST` with `publishedWithin: LAST_24_HOURS` and schedule the run daily.

### Data use

Data comes from the public search results of fotocasa.es. Professional advertisers' business contact details are included as published; private owners' names and phones are never collected. You are responsible for using the data in line with the GDPR and fotocasa's terms.

# Changelog

This Actor's version history is a separate document: https://apify.com/tagadanar/fotocasa-scraper/changelog.md

# Actor input Schema

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

Places in Spain, resolved with fotocasa's own place search: a city ("Madrid", "Valencia"), a district or neighbourhood ("Chamberí, Madrid"), a province or region. Add ", <city or province>" after the name to pick between places with the same name. Up to 50 locations + URLs per run.

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

Optional: search result URLs copied from fotocasa.es (e.g. https://www.fotocasa.es/es/alquiler/viviendas/barcelona-capital/todas-las-zonas/l?maxPrice=1200). Each URL keeps its own place, operation, property type, sort and filters; the filter fields below do not change it.

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

Buy (for sale), rent, share (rooms), transfer of a business, or rent with an option to buy. Applies to Locations.

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

What kind of property. Applies to Locations.

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

Lowest price in euros (monthly rent for rentals). Leave empty for no minimum.

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

Highest price in euros (monthly rent for rentals). Leave empty for no maximum.

## `minSize` (type: `integer`):

Smallest built area in square metres.

## `maxSize` (type: `integer`):

Largest built area in square metres.

## `minRooms` (type: `integer`):

At least this many bedrooms (1 to 4; 4 means 4 or more).

## `minBathrooms` (type: `integer`):

At least this many bathrooms (1 to 3; 3 means 3 or more).

## `publishedWithin` (type: `string`):

Only listings published recently, as filtered by the site.

## `sort` (type: `string`):

Order of the results, as on the site. With a cap, this decides which listings you get first.

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

Total listings to deliver in this run (you pay per listing). Default 100, max 10,000.

## `maxItemsPerSearch` (type: `integer`):

Optional cap for each location or URL, so one big city does not use the whole run. 0 = no per-search cap.

## Actor input object example

```json
{
  "locations": [
    "Madrid"
  ],
  "operation": "BUY",
  "propertyType": "HOMES",
  "publishedWithin": "ANY",
  "sort": "RELEVANCE",
  "maxItems": 100,
  "maxItemsPerSearch": 0
}
```

# Actor output Schema

## `dataset` (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 = {
    "locations": [
        "Madrid"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("tagadanar/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 = { "locations": ["Madrid"] }

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

```

## MCP server setup

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