# Idealista Scraper (`one-api/idealista-scraper`) Actor

Scrape Idealista property listings across Spain, Italy, and Portugal. Look up properties by adId or URL, search by location name, ZIP, coordinates, polygon, or Idealista URL, and pull agency profiles + the geographies they list in.

- **URL**: https://apify.com/one-api/idealista-scraper.md
- **Developed by:** [ONE API](https://apify.com/one-api) (community)
- **Categories:** Lead generation, Real estate
- **Features:** Limited permissions
- **Stats:** 49 total users, 8 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $3.00 / 1,000 results

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

## Idealista Scraper

Scrape Idealista property listings across **Spain, Italy, and Portugal**. Look up properties by adId or URL, search by location name, ZIP, coordinates, polygon, or Idealista URL, and pull full agency profiles plus the geographies they list in.

### What it does

- **Property Details** — auto-detects each input as `adId` (digits) or `idealista.com` URL; returns the full record (price, beds/baths, size, photos, agent contact, energy rating, multimedia URLs).
- **5 search modes** — by location name, ZIP, coordinates, polygon, or Idealista URL. Country, operation (sale / rent / share), property type, price/beds/size filters all apply.
- **Agency profiles** — for each microsite shortName: one row with `/agent/details` (commercial name, phone, address, totals) plus one row per province / municipality the agency lists in, via `/agent/locations`.

### Output

- **One flat dataset row per listing** / agent / agent-location — sortable, filterable, CSV-exportable.
- Columns: `Mode`, `Country`, `Property ID`, `URL`, `Address`, `City`, `District`, `Neighborhood`, `Price`, `Currency`, `Beds`, `Baths`, `Size m²`, `PropertyType`, `Operation`, `Latitude`, `Longitude`, `Cover Photo`, `Listing URL`.
- Full upstream JSON kept in the `Raw` column for power users.

### Inputs

- Each section is independent — fill only the ones you need.
- Multiple inputs per section: one per line.
- Country / operation / propertyType / price-bed-size filters apply to every search and every agency call.

### Pricing

- Pay per result: **$3 per 1,000 dataset items** — same rate on every Apify plan tier.
- Apify start fee: $0.00005 per run.

### Notes

- Idealista caps each search page at ~50 results — increase `pages` to fetch more.
- `/agent/locations` uses the **operation + propertyType filter** above to scope which geographies the agency lists in (e.g. "where does this agency list homes for sale?").
- Spain, Italy, and Portugal each have their own `idealista.com` / `.it` / `.pt` site — set `country` accordingly.

### Errors

- Failures land in the dataset as rows with `Mode = "ERROR"` and the upstream error message in `Agent Name` — nothing is silently dropped.

# Actor input Schema

## `property_inputs` (type: `array`):

Auto-detects each entry and calls the right endpoint:
• Digits only (e.g. `106387165`) → `/details/byid`
• `https://www.idealista.com/...` (or `.it` / `.pt`) → `/details/byurl`

Each row in the dataset = one full property record (address, price, beds/baths, size, photos, agent contact).

## `search_inputs` (type: `array`):

Auto-detects each entry and routes to the right `/search/*` endpoint:
• `https://www.idealista.com/...` → `/search/byurl`
• 5-digit ZIP (e.g. `28001`) → `/search/byzip`
• `lat,lng` or `lat,lng,radius` (e.g. `40.4168,-3.7038,2`) → `/search/bycoordinates`
• `lng lat,lng lat,...` (≥4 vertices, space-separated pair, comma-delimited list) → `/search/bypolygon`
• Anything else (city / region name, e.g. `Madrid`) → `/search/bylocation`

Filters below apply to every search call. Each hit returns one row per listing.

## `agency_shortnames` (type: `array`):

Idealista agency microsite shortNames (e.g. `walterhauschamberi`). For each shortName the actor fetches `/agent/details` (one summary row) plus `/agent/locations` (one row per province / municipality the agency lists in).

## `country` (type: `string`):

Idealista marketplace. Spain (`es`), Italy (`it`), or Portugal (`pt`).

## `searchType` (type: `string`):

What kind of listings to fetch in `/search/*`.

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

Which Idealista typology to search.

## `priceRange` (type: `string`):

Format: `min:200000,max:600000` — or just `min:200000` / `max:600000`.

## `bedsRange` (type: `string`):

Format: `min:1,max:3`. Studio = `0`.

## `sqftRange` (type: `string`):

Format: `min:60,max:120`.

## `pages` (type: `integer`):

How many pages to fetch for each `/search/*` query.

## `resultCount` (type: `integer`):

Idealista caps each search page at ~50 results.

## Actor input object example

```json
{
  "property_inputs": [
    "106387165",
    "https://www.idealista.com/inmueble/106387165/"
  ],
  "search_inputs": [
    "Madrid",
    "Barcelona"
  ],
  "agency_shortnames": [],
  "country": "es",
  "searchType": "For_Sale",
  "propertyType": "homes",
  "priceRange": "",
  "bedsRange": "",
  "sqftRange": "",
  "pages": 1,
  "resultCount": 50
}
```

# 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 = {
    "property_inputs": [
        "106387165",
        "https://www.idealista.com/inmueble/106387165/"
    ],
    "search_inputs": [
        "Madrid",
        "Barcelona"
    ],
    "agency_shortnames": []
};

// Run the Actor and wait for it to finish
const run = await client.actor("one-api/idealista-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 = {
    "property_inputs": [
        "106387165",
        "https://www.idealista.com/inmueble/106387165/",
    ],
    "search_inputs": [
        "Madrid",
        "Barcelona",
    ],
    "agency_shortnames": [],
}

# Run the Actor and wait for it to finish
run = client.actor("one-api/idealista-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 '{
  "property_inputs": [
    "106387165",
    "https://www.idealista.com/inmueble/106387165/"
  ],
  "search_inputs": [
    "Madrid",
    "Barcelona"
  ],
  "agency_shortnames": []
}' |
apify call one-api/idealista-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,one-api/idealista-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/91WJJdeAgdaTxCtvk/builds/tIRCySTjlieneaZOl/openapi.json
