# Portugal Real Estate Scraper: Imovirtual & Casa Sapo (`allanmxr/portugal-real-estate-scraper`) Actor

Sale and rental listings from Imovirtual and Casa Sapo in one flat dataset: price, typology (T0 to T5+), area, price per m², parish, municipality, district, energy certificate and coordinates. Search by distrito, concelho and freguesia. No login or API key.

- **URL**: https://apify.com/allanmxr/portugal-real-estate-scraper.md
- **Developed by:** [Allan Marcelino](https://apify.com/allanmxr) (community)
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per event

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

## Portugal Real Estate Scraper: Imovirtual, OLX, SUPERCASA, Casa Sapo and Idealista

Scrape **sale and rental listings from Imovirtual, OLX Portugal, SUPERCASA, Casa Sapo and Idealista** in one run, in one flat dataset with the same fields for every portal.

**Em português:** extraia anúncios de **imóveis para comprar e arrendar em Portugal** do Imovirtual, OLX, SUPERCASA, Casa Sapo e Idealista por distrito, concelho e freguesia, com filtros de tipologia (T0 a T5+), preço, área, certificado energético, anunciante (agência ou particular) e data de publicação. Exemplos de pesquisa: *apartamento T2 para arrendar em Lisboa*, *moradia à venda em Cascais*, *casas para comprar no Porto*, *T1 para alugar em Vila Nova de Gaia*, *terreno à venda no Algarve*, *imóveis na Madeira e nos Açores*.

Search by district (distrito), municipality (concelho) and parish (freguesia), or paste a search URL from Imovirtual or Casa Sapo. You get typology, area, price per m², parish, municipality, district, advertiser type and, optionally, coordinates, bathrooms, energy certificate, condition and build year.

No login, no API key and no proxy of your own needed. Imovirtual and OLX run on plain HTTP; SUPERCASA and Idealista open in a real browser that waits for the portal's own check to pass by itself (it never clicks a checkbox, solves a CAPTCHA or logs in).

### Why this one

- **Five portals, one schema.** The same fields in the same units from Imovirtual, OLX, SUPERCASA, Casa Sapo and Idealista, so you can compare them in one table. The `maxItems` budget is shared between the portals.
- **No duplicates between Imovirtual and OLX.** Many OLX ads are republished from Imovirtual; with both selected, OLX only adds its own ads (mostly private owners), so the run does not pay twice for the same flat.
- **Search by place name, not only by pasted URL.** Pick `Lisboa`, type `Cascais`, optionally `Cascais e Estoril`, and run. Madeira and the Azores are searchable island by island.
- **Portuguese filters that matter:** typology T0 to T5+, energy certificate (A+ to G), agency or private owner, last N days.
- **Clean places.** Unknown municipalities or parishes are reported instead of silently returning the whole country, as the portals do. Imovirtual also pads a place's results with ads from the next municipality (about 8% in Lisboa). Those are dropped, so a Lisboa search only returns Lisboa.
- **Fast and cheap.** Imovirtual is read through its light JSON pages, 72 listings per request: about 7,000 listings per minute without details.
- **Privacy by design (GDPR).** Agency and developer names only. No private owner names, agent names, phone numbers, e-mails or free text descriptions.

### Use cases

- Rental and sale **price monitoring** per parish or municipality
- **Investment analysis**: price per m², typology mix, energy rating of the stock
- Building a **Portuguese real estate dataset** for dashboards, maps or models
- Market research for agencies, proptechs, relocation and Golden Visa advisors

### Input

| Field | Description |
|---|---|
| `sources` | Any of `imovirtual`, `olx`, `supercasa`, `casasapo`, `idealista`; default `imovirtual` and `olx`. SUPERCASA, Casa Sapo and Idealista are opt-in, see below. OLX lists apartments and houses only. |
| `dealType` | `sale` (comprar) or `rent` (arrendar). |
| `district` | District, island (Madeira, Porto Santo, Azores islands) or All of Portugal, chosen from a list. |
| `municipalities` | Optional municipality (concelho) names, e.g. `Cascais`, `Vila Nova de Gaia`. Empty = the whole district. |
| `parishes` | Optional parish (freguesia) names as the portal writes them, e.g. `Alvalade`, `Cascais e Estoril`. Only with exactly one municipality. |
| `startUrls` | Optional search pages from imovirtual.com (`/pt/resultados/...`) or casa.sapo.pt (`/comprar-apartamentos/lisboa/`). They keep the filters you set on the site; the typology, energy certificate, advertiser, date and sort options of this form are applied on top. The portal of each URL must be selected in `sources`. |
| `maxItems` | Total listings, default 100. Shared equally between sources and between property types, places and pasted URLs. |
| `fetchDetails` | Imovirtual only, default off. Opens each listing (one light JSON request) for coordinates, bathrooms, energy certificate, condition and build year. |
| `proxyConfiguration` | Optional. By default the actor starts without a proxy and climbs by itself if a portal blocks it. |

#### Filters

| Filter | Imovirtual | OLX | SUPERCASA | Casa Sapo | Idealista |
|---|---|---|---|---|---|
| `propertyTypes` (`apartment`, `house`, `land`, `room`, `garage`; empty = apartments and houses) | yes | apartments and houses only | yes (rooms for rent only) | yes | no rooms |
| `typologies` (`T0` to `T5+`) | yes | yes | yes (T4 or more asked, exact typology kept by the actor) | yes (`T5+` asks the portal for T5) | yes (T4 or more asked, exact typology kept by the actor) |
| `minPrice`, `maxPrice` | yes | yes | yes | yes | yes |
| `minArea`, `maxArea` | yes | yes | yes, re-checked by the actor (the portal filters usable area, the card shows gross) | yes | yes (gross area) |
| `energyCertificates` | after opening each listing (slower) | yes | source skipped | yes, one certificate only (the source is skipped with more) | source skipped |
| `advertiserType` (`any`, `agency`, `private`) | yes | yes | source skipped (the listing does not say; `advertiserType` is `unknown`) | after the search | source skipped (filtering after the search would spend residential traffic on discarded pages) |
| `publishedWithinDays` | yes | after the search (newest first) | 2, 7 or 30 day steps, then cut to the exact day by the actor | 8, 15 or 30 day steps, then cut to the exact day by the actor | 48 hours only (source skipped for more than 2 days); no date in the output |
| `sortBy` (`relevance`, `newest`) | yes | yes | yes | yes | yes |
| Location fields in the output | parish, municipality, district | parish, municipality, district | the parish, municipality and district you searched | parish, municipality, district | the parish, municipality and district you searched |
| Photos, coordinates | photos; coordinates with details, not for private owners | photos; coordinates for companies | none | photo; coordinates for companies | photo; no coordinates |

SUPERCASA and Idealista only return what their search cards show (no listing is opened), and neither has island or country-wide pages: add municipalities (for example `Funchal`) to include them for Madeira or the Azores.

#### SUPERCASA

SUPERCASA sits behind a Cloudflare check. The actor opens a real Chromium once per IP, lets the check pass by itself (up to 45 seconds, no clicks) and then reads the pages with plain HTTP using the clearance cookie. The first page takes about 20 to 50 seconds; the following ones are quick (25 listings per page).

#### Idealista (opt-in, slower, costlier)

Idealista is off by default because it only opens in a real browser on a **residential Portuguese IP** (billed per GB by Apify Proxy), takes one to two minutes to open the first page and every page is a browser navigation (30 listings each, 60 pages per search at most, so 1,800 listings per search; narrow it with municipalities or filters to go further). The datacenter proxy and the container's own IP get an interactive challenge, which this actor never tries to solve: if the residential proxy is not available, Idealista is skipped with a note; if the challenge does not pass by itself, Idealista is reported as `failed (see RUN_SUMMARY)` in the status message and the other portals carry on.

#### Casa Sapo is slow on purpose (experimental)

Casa Sapo answers "Site Offline" (HTTP 429 or 503) after a few quick pages from one IP. The actor reads it from one IP at a time, waits one minute between pages (25 listings each) and, when it is limited, changes IP (a new Apify Proxy session) after a 15, 30 or 60 second backoff. After 4 limited IPs in a row it moves to the residential proxy for 3 more, and it stops Casa Sapo after 12 IP changes in a run, keeping what it has. Expect at most about 25 Casa Sapo listings per minute. The other portals are not affected and run at full speed in parallel.

Casa Sapo has no island-wide or country-wide search: for Madeira, the Azores or All of Portugal, add municipalities (e.g. `Funchal`, `Ponta Delgada`) to include it.

#### Memory

The actor's default memory is 1024 MB because of Chromium. A run with Imovirtual, OLX and Casa Sapo only works in 256 MB (set it in the run options).

#### Example input

```json
{
  "sources": ["imovirtual", "olx"],
  "dealType": "rent",
  "district": "lisboa",
  "municipalities": ["Lisboa"],
  "parishes": ["Alvalade", "Avenidas Novas"],
  "typologies": ["T1", "T2"],
  "maxPrice": 1800,
  "sortBy": "newest",
  "maxItems": 200
}
```

### Output

One item per listing:

```json
{
  "source": "imovirtual",
  "listingId": "19361090",
  "url": "https://www.imovirtual.com/pt/anuncio/t2-no-monte-estoril-jardim-dos-passarinhos-ID1jeHE",
  "dealType": "rent",
  "propertyType": "apartment",
  "title": "T2 apartment for rent in Cascais e Estoril, Cascais",
  "price": 2300,
  "currency": "EUR",
  "pricePerSqm": 29.49,
  "area": 78,
  "landArea": null,
  "typology": "T2",
  "bedrooms": 2,
  "bathrooms": 2,
  "energyCertificate": "D",
  "floor": null,
  "condition": "used",
  "buildYear": 1985,
  "street": "Travessa do Hangar",
  "neighborhood": "Monte Estoril",
  "parish": "Cascais e Estoril",
  "municipality": "Cascais",
  "district": "Lisboa",
  "latitude": 38.70558,
  "longitude": -9.409439,
  "advertiserType": "agency",
  "agencyName": "KW Select Cascais",
  "coverImage": "https://ireland.apollo.olxcdn.com/...",
  "images": ["https://ireland.apollo.olxcdn.com/..."],
  "imageCount": 6,
  "publishedAt": "2026-11-18T17:52:14Z",
  "firstPublishedAt": "2026-11-18T17:52:14+00:00",
  "updatedAt": "2026-11-18T17:52:20Z",
  "scrapedAt": "2026-11-18T22:00:00+00:00"
}
```

Field notes:

- `price` is in whole euros: monthly rent for rentals, asking price for sales; null when the advertiser hides it.
- `typology` and `bedrooms` only for apartments and houses. On Imovirtual they come from the portal's room count (T2 = 3 rooms).
- On Imovirtual, `bathrooms`, `energyCertificate`, `buildYear` and coordinates need `fetchDetails` (or the energy certificate filter); coordinates are left empty for private owners. OLX gives bathrooms, energy rating and condition in the search; its coordinates are only kept when OLX marks the pin as exact and the advertiser is a company (a private owner's exact pin is a home address). Casa Sapo gives coordinates for company listings only (a private advertiser's pin is a home address), never bathrooms or energy rating. OLX names an advertiser only through its registered company name, so many OLX agencies come without `agencyName`.
- `street` is filled on Imovirtual when the advertiser published it; never on Casa Sapo, SUPERCASA or Idealista, whose cards mix streets and neighbourhoods.
- `area` is the usable area on Imovirtual, OLX and Casa Sapo, and the gross built area on SUPERCASA and Idealista (the plot for land).
- SUPERCASA does not say who advertises: `advertiserType` is `unknown` there. Idealista marks professional ads, so `agency` or `private`; agency names come from the card logo.
- `publishedAt` is the last publication or republication; `firstPublishedAt` the first one (Imovirtual).

### Pricing

Pay per result: one `listing` event per item stored. No start fee, no proxy surcharge. Use the run option *Max total charge* or `maxItems` to cap the cost.

### FAQ

**Can I get the advertiser's phone or e-mail?** No. Only company names are collected (GDPR).

**Why did I get fewer items than `maxItems`?** The search had fewer matches, or a filter is applied after the search (see the filter table). The run's status message and the `RUN_SUMMARY` record in the key-value store tell you how many each source returned and why one stopped.

**Is the data for model training?** The portals publish `Content-Signal: ai-train=no` in their robots.txt. Use the data for search, analysis and monitoring, not to train AI models.

**A parish is not found.** Write it as the portal shows it, including unions of parishes (e.g. `Cascais e Estoril`, `Avenidas Novas`). The status message lists the places a portal did not know.

# Actor input Schema

## `sources` (type: `array`):

Portals to search. The listing budget (Max items) is shared equally between them. OLX only adds the ads that are not republished from Imovirtual when both are selected, and only lists apartments and houses. Casa Sapo is experimental and off by default: it rate-limits hard, so the actor spaces its pages out and changes IP when it is limited. SUPERCASA and Idealista open in a real browser (Chromium); Idealista is opt-in because it only works on a residential proxy, which is slower and billed per GB.

## `dealType` (type: `string`):

Buy (comprar) or rent (arrendar).

## `district` (type: `string`):

District or island of the municipalities below. Not needed when you only paste search URLs.

## `municipalities` (type: `array`):

Municipality names, one per line, for example Cascais or Vila Nova de Gaia. They must belong to the district above. Leave empty to search the whole district.

## `parishes` (type: `array`):

Narrow the search to these parishes, written as the portal names them, for example Cascais e Estoril or Alvalade. Works with exactly one municipality.

## `startUrls` (type: `array`):

Search pages copied from imovirtual.com (/pt/resultados/comprar/apartamento/lisboa/...) or casa.sapo.pt (/comprar-apartamentos/lisboa/...), one per line. They keep their own filters (the typology, energy certificate, advertiser, date and sort options below are applied on top) and are searched in addition to the place above. The portal of each URL must be selected in Sources. SUPERCASA and Idealista only take the place fields above, not URLs.

## `propertyTypes` (type: `array`):

Leave empty for apartments and houses. OLX only lists apartments and houses; Idealista has no rooms; SUPERCASA lists rooms for rent only.

## `typologies` (type: `array`):

Number of bedrooms as Portuguese listings write it: T0 is a studio, T2 has two bedrooms. Applies to apartments and houses. All portals; Casa Sapo asks for T5 only when T5 or more is picked, SUPERCASA and Idealista ask for T4 or more and the actor keeps the exact typologies.

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

Monthly rent for rentals, asking price for sales. All portals.

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

Monthly rent for rentals, asking price for sales. All portals.

## `minArea` (type: `integer`):

Usable area (SUPERCASA and Idealista filter gross built area). All portals.

## `maxArea` (type: `integer`):

Usable area (SUPERCASA and Idealista filter gross built area). All portals.

## `energyCertificates` (type: `array`):

Only these energy ratings. Imovirtual shows the rating only on the listing page, so this opens every candidate listing (slower). Casa Sapo takes one rating only and is skipped when you pick more. SUPERCASA and Idealista are skipped when you pick any.

## `advertiserType` (type: `string`):

Agencies and developers, or private owners only. Imovirtual filters it itself; on Casa Sapo and Idealista the actor filters after the search. SUPERCASA does not say who advertises, so it is skipped unless this is Any.

## `publishedWithinDays` (type: `integer`):

Only listings published or republished in the last N days, newest first. All portals except that Idealista only filters the last 48 hours (it is skipped for more than 2 days) and does not show the date.

## `sortBy` (type: `string`):

Order of the results, which matters most when Max items is smaller than the number of matches. All portals.

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

Total listings across all sources.

## `fetchDetails` (type: `boolean`):

Opens each Imovirtual listing to add coordinates, bathrooms, energy certificate, condition and build year. One extra light request per listing, so the run takes longer. Casa Sapo already returns coordinates in the search and ignores this option.

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

Leave empty: runs start without a proxy and, if a portal blocks (403), the actor climbs by itself to Apify Proxy datacenter, then residential in Portugal. On the residential rung the detail pages are skipped. SUPERCASA starts on datacenter; Idealista only runs on the residential proxy (through a browser). Set a proxy here only to replace that default.

## Actor input object example

```json
{
  "sources": [
    "imovirtual",
    "olx"
  ],
  "dealType": "rent",
  "district": "lisboa",
  "municipalities": [
    "Cascais"
  ],
  "advertiserType": "any",
  "sortBy": "relevance",
  "maxItems": 20,
  "fetchDetails": false
}
```

# Actor output Schema

## `results` (type: `string`):

All scraped items in the default dataset.

# 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 = {
    "sources": [
        "imovirtual",
        "olx"
    ],
    "dealType": "rent",
    "district": "lisboa",
    "municipalities": [
        "Cascais"
    ],
    "maxItems": 20
};

// Run the Actor and wait for it to finish
const run = await client.actor("allanmxr/portugal-real-estate-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 = {
    "sources": [
        "imovirtual",
        "olx",
    ],
    "dealType": "rent",
    "district": "lisboa",
    "municipalities": ["Cascais"],
    "maxItems": 20,
}

# Run the Actor and wait for it to finish
run = client.actor("allanmxr/portugal-real-estate-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 '{
  "sources": [
    "imovirtual",
    "olx"
  ],
  "dealType": "rent",
  "district": "lisboa",
  "municipalities": [
    "Cascais"
  ],
  "maxItems": 20
}' |
apify call allanmxr/portugal-real-estate-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,allanmxr/portugal-real-estate-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/2hvJblk3X0i7uaNxO/builds/EtiyDAxNXHZkSayG1/openapi.json
