# Imovirtual Scraper with Rental Yield & Deal Score – Portugal (`data-nest/imovirtual-rental-yield`) Actor

Rental yield by freguesia and typology in Lisbon and Porto, plus deal score, estimated rent and yield for every flat for sale on Imovirtual. All sale and rent listings, price filter.

- **URL**: https://apify.com/data-nest/imovirtual-rental-yield.md
- **Developed by:** [Datanest](https://apify.com/data-nest) (community)
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.85 / 1,000 scored 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/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

## Imovirtual Scraper with Rental Yield & Deal Score – Portugal

Web scraping of Imovirtual listings turned into investment numbers: this Actor calculates the gross rental yield by freguesia and typology, the price per m², and a deal score for every flat for sale in Lisbon and Porto. Use it for rental yield in Portugal, gross yield by freguesia, real estate data for Lisbon and Porto, and spotting apartments priced below their neighbourhood, whether you are a buy-to-let investor, a proptech team or an analyst. One run reads the whole market of a city – apartments for sale and for long-term rent – and returns:

- **Gross rental yield per freguesia and typology**, with medians, quartiles and sample sizes.
- **A 0–100 deal score for every listing for sale**, against the median price per m² of comparable flats.
- **Everything in EUR.** Imovirtual lists in euro, so there is no currency conversion and cities compare directly.

Asking prices and advertised rents, honestly labelled. Gross, not net. The full market of the city, not a sample.

### Typology and freguesia in plain words

- **Typology.** Portuguese listings use a typology instead of a room count: **T0** is a studio, **T1** is roughly one bedroom plus a living room, **T2** two bedrooms, **T3** three, and **T4+** four or more. The portal stores the number of rooms including the living room; the Actor converts it (rooms − 1) and drops listings whose title states a different typology.
- **Freguesia.** A freguesia is the Portuguese civil parish, the smallest administrative level used in the listings (Lisbon has 24; Porto has 7 larger, merged units). In the results the field `district` holds the freguesia, taken from the listing's own location.

### Example output

One yield group (`areaYield`), from a full Lisbon run on 25 November 2026:

```json
{
  "recordType": "areaYield",
  "country": "PT", "city": "Lisboa", "district": "Santa Maria Maior", "typology": "T1",
  "groupLevel": "district", "confidence": "high",
  "saleCount": 125, "rentCount": 98,
  "currency": "EUR", "flags": [],
  "salePricePerM2": {"median": 7333, "p25": 6063, "p75": 8864},
  "rentPerM2Monthly": {"median": 34.9, "p25": 27.1, "p75": 41},
  "grossYieldPct": 5.72, "grossYieldRangePct": [3.66, 8.11],
  "sample": {
    "sale": {"medianAgeDays": 134, "oldestListingDays": 2057, "share": 0.922, "fetched": 7282, "totalItems": 7899},
    "rent": {"medianAgeDays": 252.5, "oldestListingDays": 1163, "share": 1.0, "fetched": 3379, "totalItems": 3379}
  },
  "priceBasis": "asking", "sources": ["imovirtual"], "computedAt": "2026-11-25T11:22:11Z"
}
```

In `sample`, the ages describe the listings of the group itself; `fetched`, `totalItems` and `share` describe the whole city, because the portal reports no totals per freguesia.

One scored listing (`scoredListing`) from the same group (identifiers shortened, link anonymised):

```json
{
  "recordType": "scoredListing",
  "source": "imovirtual", "listingId": "…", "url": "…/pt/anuncio/…",
  "country": "PT", "city": "Lisboa", "district": "Santa Maria Maior", "typology": "T1", "areaM2": 33,
  "isPrimaryMarket": null,
  "currency": "EUR", "price": 159000,
  "pricePerM2": 4818, "groupMedianPricePerM2": 7333,
  "dealScore": 93, "discountVsMedianPct": 34.3,
  "estimatedRentMonthly": 1153, "grossYieldPct": 8.7,
  "saleGroupLevel": "district", "rentGroupLevel": "district", "confidence": "high",
  "daysOnMarket": 21, "flags": [], "identicalListingIds": [],
  "firstSeenAt": null, "changeType": null, "priceCutPct": null
}
```

### Yields by city

Gross rental yield from test runs on 25 November 2026 (asking prices and advertised rents, medians):

| City | Gross yield | Sale price, EUR/m² | Rent, EUR/month per m² | Yield groups | Listings after cleaning (sale / rent) | Shown by the portal (sale / rent) |
|---|---|---|---|---|---|---|
| Lisbon | 4.43% | 7,213 | 26.6 | 73 | 5,088 / 3,022 | 7,899 / 3,379 |
| Porto | 4.88% | 5,325 | 21.7 | 34 (33 charged, 1 low-confidence group free) | 4,852 / 1,504 | 9,254 / 1,864 |

Among high-confidence groups, the highest gross yields were Porto Bonfim T0 (6.13%), Lisbon São Vicente T1 (5.81%) and Lisbon Santa Maria Maior T1 (5.72%); the lowest were Porto Aldoar, Foz do Douro e Nevogilde T3 (2.44%) and Lisbon Marvila T3 (2.79%).

Lisbon is reported by 24 freguesias, Porto by 7 larger units, so freguesia-level results are not equally detailed in the two cities.

### How to use it without code

1. Open the Actor in Apify Console.
2. Choose the cities, the typologies and the mode: `listings`, `yieldReport`, `scoreListings` or `both`.
3. Click **Start**.
4. Download the results as Excel, CSV or JSON from the Output tab. Yield groups are in the `yields` dataset, except in `yieldReport` mode, where they are in the default dataset.

The first run with the default example (prefill: Lisbon, the 360 newest listings per side) costs about $0.39 (5 yield groups and 292 scored listings in the test run) and takes about 1 minute. A full run of one city reads every results page and takes about 4–8 minutes (both cities: about 10–16 minutes).

### What you get

- **Yield by freguesia** (`areaYield` records): for every freguesia × typology group, the median sale price per m², the median monthly rent per m², quartiles, the number of listings behind each number, and the gross yield with a range. Groups with too few listings fall back to the city level and say so (`groupLevel`, `confidence`).
- **Scored listings** (`scoredListing` records): for every apartment for sale, a 0–100 deal score, its discount against comparable flats, an estimated monthly rent and gross yield, and a link to the listing. Sorted best deal first.
- **Listings** (`listing` records, `mode: "listings"`): every apartment for sale and for rent, one row each, with our analytics on the sale rows (see *Listings mode*).
- **Sample transparency**: every yield record reports how recent its sample is (median age, oldest listing) and what share of all listings it covers.
- **Two datasets**: scored listings in the default dataset, yield groups in a second dataset called `yields` (see *Where the results are*).
- **Two reports in the key-value store**: `YIELD_REPORT` (yield groups per city; which ones depends on `mode`, see *Where the results are*) and `RUN_SUMMARY` (what was fetched, rejected and charged, per city and market side).

### Quick start

Run with no settings to analyse Lisbon and Porto (every results page of both cities):

```json
{
  "cities": ["lisboa", "porto"],
  "mode": "both"
}
```

**Proxy.** By default the Actor uses Apify Proxy's residential group with addresses in Portugal: many datacenter addresses are blocked, and residential ones give successful runs. The proxy cost is included in the price, so you pay nothing extra for it. You can pass your own `proxyConfiguration` instead. If Apify Proxy refuses the connection, the run fails with a message saying so, and none of the result events are charged.

### Listings mode

`mode: "listings"` returns every apartment for sale and for rent, one row each (`recordType: "listing"`), after the exclusions listed in *Data quality*. Each row written is one `scored-listing` event: **$0.001 per row** at the Free plan price (less on higher plans, see *Pricing*). No yield records are written and no `area-yield` events are charged; the group medians are still computed, because the scores and estimates rest on them.

```json
{"cities": ["lisboa"], "mode": "listings"}
```

- **All rows:** `transaction` (`sale` or `rent`), `listingId`, `url`, `city`, `district` (the freguesia), `typology`, `areaM2`, `currency` (`EUR`), `price` (asking price, or monthly rent on rent rows), `daysOnMarket`, `flags`, `identicalListingIds` and the monitoring fields.
- **Sale rows:** `pricePerM2`, `groupMedianPricePerM2`, `dealScore`, `discountVsMedianPct`, `saleGroupLevel`, `rentGroupLevel`, `confidence`, `estimatedMonthlyRent` (median rent per m² of the comparable group × the flat's area, rounded to 10 EUR), `estimatedGrossYieldPct` (12 × estimated rent ÷ asking price) and `comparable`: `sale` (`groupLevel`, `district`, `typology`, `saleCount`, `confidence`) and `rent` (`groupLevel`, `district`, `typology`, `rentCount`).
- **Rent rows:** `monthlyRentPerM2`; all sale-side fields are `null`.
- **No estimate:** when the comparable group has `low` confidence, or no group has enough rentals, the estimate fields are `null` and `estimateNote` says why; the deal score is still returned. Flats in a city with too few listings for sale to compare are returned (and charged) with `dealScore` and the estimates `null`; if you narrowed the selection, `estimateNote` refers to the selected filters instead of the city.
- **Not returned, not charged:** listings priced more than 40% below their group's median (`scoredExcludedOutliers`).
- **Order:** per city, sale and rent rows are interleaved, each in the portal's order (newest first), so a run stopped by your maximum charge returns a slice of both sides.
- **Filters:** `typology`, `areaMin` and `areaMax` apply to all rows. `minScore` applies to sale rows only; above 0 it also drops sale rows without a score. `maxScoredListings` is ignored: `maxListingsPerSide` sets how much is read. For price bounds see *Price filter*.
- `RUN_SUMMARY.cities.*.listings` reports `saleRows`, `rentRows`, `withEstimate`, `withoutEstimate`, `scoredExcludedOutliers`, `saleNotComparable` and `charged`.

### Price filter

Four optional inputs, whole EUR, bounds included: `minSalePrice` and `maxSalePrice` for listings for sale, `minMonthlyRent` and `maxMonthlyRent` for rentals. Leave a field empty for no limit.

```json
{"cities": ["lisboa"], "mode": "listings", "maxSalePrice": 300000, "maxMonthlyRent": 1500}
```

- **Only the returned rows change.** Medians, comparable groups, deal scores and rent and yield estimates are still computed from the whole market of the city, including the listings the filter leaves out.
- **Where it works:** `mode: "listings"` (sale and rent rows) and `scoreListings` (sale rows; the rent fields are ignored with a warning in the log). In `both` it narrows the scored listings in the same way and leaves the yield groups unchanged. `yieldReport` ignores all four with a warning.
- **Filtered rows** are not returned, not charged and not recorded by monitoring. The filter applies after the outlier exclusion and `minScore`, and before `maxScoredListings`.
- **Nothing matches:** the run succeeds with no listing rows, its status message names the price filter, and no listing rows are charged.
- A minimum greater than its maximum is an input error: the run stops before reading any page.
- `RUN_SUMMARY.cities.*.priceFiltered` counts the rows left out per side (`sale`, `rent`).

### Example inputs

**Rental yield by freguesia in Lisbon** – one yield record per freguesia and typology group, in the default dataset.

```json
{"cities": ["lisboa"], "mode": "yieldReport"}
```

**Underpriced T2 flats in Porto** – scored listings of two-bedroom flats with a deal score of at least 80, best deals first.

```json
{"cities": ["porto"], "mode": "scoreListings", "typology": ["T2"], "minScore": 80}
```

**Resales only in Lisbon** – leaves new builds out of the sale comparison.

```json
{"cities": ["lisboa"], "mode": "yieldReport", "includePrimaryMarket": false}
```

### Primary and secondary market (`includePrimaryMarket`)

- **On (default):** resales and new builds are compared together. The portal does not mark new builds on a listing, so `isPrimaryMarket` is always `null`.
- **Off:** the Actor asks the portal for resales only on the sale side. `isPrimaryMarket` is then `false`. Rents are not split by market, so the rent side is always read in full.

Effect in Lisbon: In a Lisbon test run, leaving out new builds lowered the median asking price per m² by 5.0% and raised the city-wide gross yield from 4.45% to 4.69%.

### Where the results are

- **Scored listings** (and, in `mode: "listings"`, all listing rows) go to the run's default dataset. This is what `run-sync-get-dataset-items`, the API "last run dataset items" endpoints and the Export button return.
- **Yield groups** (`areaYield` records) go to a second dataset named `yields`. It is linked from the run's Output tab and listed in the Storage tab; its API URL is in the run's `output`.
- **Exception:** with `mode: "yieldReport"` there are no scored listings, so the yield groups stay in the default dataset. The same groups are also copied to the `yields` dataset, so the yield view on the Output tab shows them.
- **`YIELD_REPORT`** in the key-value store depends on the mode: `yieldReport` and `both` list the yield groups delivered by the run, `scoreListings` only the free (`low` confidence) groups, and `listings` no groups.

### For AI agents

Call the Actor `data-nest/imovirtual-rental-yield` from an agent or over MCP with a small input, for example one city in yield-report mode:

```json
{"cities": ["lisboa"], "mode": "yieldReport"}
```

The result is a list of `areaYield` records in the default dataset, one per freguesia and typology group, with `city`, `district` (the freguesia), `typology`, `groupLevel`, `confidence`, `flags`, `saleCount`, `rentCount`, `currency` (always `EUR`), `salePricePerM2.median`, `rentPerM2Monthly.median` and `grossYieldPct`. Set a maximum charge per run to cap the cost.

### Output notes

`flags` lists reasons to look at a record twice:

- `suspectTypology` (listing) – less than 8 m² per room, so the typology looks wrong. The listing is compared at city level only; `typology` in the record is unchanged.
- `large_discount` (listing) – price per m² more than 30% below the group median. Check the listing before relying on it.
- `rent_anomaly` (yield group) – a freguesia whose rent per m² is more than 1.4× the city rent of the same typology on fewer than 20 rental listings. Its confidence is set to `low`, so the group is free, and listings in that freguesia use the city-level rent for their estimate.

Listings priced more than 40% below their group's median are not returned and not charged; they are counted in `RUN_SUMMARY` (`scoredExcludedOutliers`) because they are more likely a data problem than a deal. Identical listings for sale (same freguesia, typology, area and price, for example identical units of one development) are merged into one record, the one with the lowest listing ID; the other IDs are in `identicalListingIds` and the group counts once in the medians and the charges (`identicalMerged` in `RUN_SUMMARY`). Results are sorted by deal score, then by discount against the median.

### How the numbers are computed

- **Groups.** Listings are grouped by city, freguesia and typology (T0, T1, T2, T3, T4+). Sale prices and rents fall back to the city level independently: a listing's price is compared with at least 15 comparable flats for sale, and its rent is estimated from at least 10 comparable rentals. Each record says which level it used.
- **Gross yield** = 12 × median monthly rent per m² ÷ median sale price per m². The range uses the quartiles (low rent against high price, and the reverse).
- **Deal score.** A listing's price per m² is compared with the median of its group on a log scale, divided by the group's typical spread (median absolute deviation). 50 means priced at the median; about 84 is one typical deviation cheaper; about 98 is two. In tight groups the score reaches 100 at a moderate discount.
- **Estimated rent** for a listing = median rent per m² of its group × the flat's area.
- **Prices** are asking prices in EUR and advertised monthly rents; building fees are not counted as rent.
- **Confidence.** `high`: compared within the freguesia with at least 40 sale listings. `medium`: freguesia with fewer listings, or city × typology. City-level rows are `high` when the run covers at least 80% of the city's listings and has at least 100 (city × typology) or 200 (whole city) sale listings and 30 or 50 rentals; otherwise `medium` or `low`.

### Data quality

Everything removed is counted in `RUN_SUMMARY`.

- **Duplicates and ads.** Repeated listing IDs, advertising inserts and development project tiles (a project is not a single flat) are dropped.
- **Outside the city.** Listings whose own location is not in the council of the requested city are dropped (`outsideCity`).
- **Hidden or missing prices and areas**, and areas outside your `areaMin`–`areaMax` range.
- **Price outliers.** The cheapest 1% and the most expensive 1% of each city's listings by price per m² are dropped before scoring, and listings more than 40% below their group's median are not returned (`scoredExcludedOutliers`).
- **Typology conflicts.** If the title states a typology that disagrees with the portal's room data, the listing is left out of the medians and the results (`typologyConflicts`). Titles are used in memory only and are never stored or returned.
- **Not an apartment.** Houses, whole buildings, shops, offices, warehouses and land that are listed among apartments are excluded when the first word of the title names that property type (moradia, vivenda, casa, prédio, terreno, quinta, loja, escritório, armazém). Counts per word are in `excludedPropertyType`.
- **Rooms and shared accommodation.** For rentals, rooms and shared flats (for example a room inside a flat) are excluded; for sales, special legal forms such as trespasse, nua propriedade, leilão (auction), usufruto, direito de superfície, ruína and renda vitalícia are excluded. Counts per phrase are in `excludedKeywords`.
- **Repeated rentals.** Repeated posts of the same rental count once (`near_duplicate_rent`).
- **Rent anomalies.** Thin freguesia rent samples far above the city rent get `rent_anomaly` and `low` confidence.
- **No personal data.** Names, phone numbers, agency names, photos, descriptions and addresses are never read into the results; records contain our numbers and a link. The output is restricted to a fixed list of fields.
- **Loud failures.** If the website blocks a request (HTTP 401 or 403, or a captcha), the run stops fetching: cities already completed are delivered and charged, the remaining ones are skipped, and `RUN_SUMMARY` shows `status: "partial"`. If no city was completed, or the run is empty for a reason other than your own selection, it fails with a clear message and none of the Actor's result events are charged; Apify charges only its standard start fee of $0.00005.
- **Empty because of your selection.** When only your filters leave no listing rows (`minScore`, `typology`, `areaMin` / `areaMax`, the price filter, or too few listings for a comparable group after you narrowed the area or typology or raised `minSaleSample` / `minRentSample`), the run succeeds, the status message says why, `RUN_SUMMARY.cities.*.emptyReason` names the cause and no listing rows are charged; yield groups that were delivered are charged as usual. In `listings` mode a city with no sale inside your area range still returns, and charges, the rentals that pass your filters.

### Monitoring

Set `onlyNewOrChanged: true` and schedule the Actor (for example daily). Each run returns only listings that are new, or at least 1% cheaper, since the last run with the same `watchlistName`, marked `changeType: "new"` or `"priceCut"` with `priceCutPct`. Use one schedule per watchlist name. A daily schedule is recommended. Unchanged listings are neither returned nor charged.

The monitoring memory is a named key-value store in your account. If it cannot be opened or written, the run does not fail: it returns the listings without change detection (`changeType` is `null`), and `RUN_SUMMARY.monitoring.warning` says what happened.

For schedules we recommend `mode: "scoreListings"`: yield groups follow `mode` in monitoring runs too, so with `both` every scheduled run also returns (and charges) the full set of yield groups. A run that finds nothing new still succeeds.

### Pricing

Pay per result:

| Event | Free plan | Bronze | Silver | Gold | When |
|---|---|---|---|---|---|
| Yield group (`area-yield`) | $0.02 | $0.019 | $0.018 | $0.017 | per `areaYield` record with high or medium confidence |
| Scored listing (`scored-listing`) | $0.001 | $0.00095 | $0.0009 | $0.00085 | per `scoredListing` record, or per row in `mode: "listings"` |
| Actor start | $0.00005 | $0.00005 | $0.00005 | $0.00005 | once per run, charged by Apify |

Low-confidence records are free. By default a run returns at most 1,000 scored listings, best deals first (`maxScoredListings`; 0 = all; ignored in `mode: "listings"`). To spend less: `mode: "yieldReport"` returns only the yield groups; `maxScoredListings`, `minScore`, `typology` and the price filter reduce the number of scored listings; and you can set a maximum charge per run. When that maximum is close, the run stops cleanly, staying below it, after delivering the free context records, the yield groups and the best-scored listings first.

**Very low maximum charge.** The Actor collects the data before it returns any result. If your maximum charge per run is too low to justify a full read, the run uses a smaller sample instead: the first city in your list and the 360 newest listings per side. The run still succeeds and `RUN_SUMMARY` shows `budgetReduced: true`. With an active price filter the sample is never reduced: the run reads the requested scope and stops writing rows at your maximum charge. **Recommended maximum charge per run (`maxTotalChargeUsd`): $2 per city for `yieldReport`; $3 per city for `both` with the default `maxScoredListings` of 1000.**

### What a report costs

A report (`mode: "yieldReport"`) is charged only for yield groups: $0.02 per `area-yield` event at the Free plan price (less on higher plans, see *Pricing*). No `scored-listing` events are charged in this mode, and low-confidence groups are free. Apify adds its own start event of $0.00005 per run.

| City | Yield groups in a recent run | About |
|---|---|---|
| Lisbon | 73 | 73 × $0.02 = $1.46 |
| Porto | 34 (1 low-confidence group is free) | 33 × $0.02 = $0.66 |

These are upper bounds: free groups are not charged. A full run with scored listings adds $0.001 per returned listing at the Free plan price.

Measured example of `mode: "listings"`: a Porto run on 28 November 2026 over the whole market with `maxSalePrice` 400000 and `maxMonthlyRent` 2000 returned 3,454 rows (2,120 sale + 1,334 rent) = 3,454 Scored listing events = $3.45 at the Free plan price.

### Limitations

- **Asking prices, not transaction prices.** Gross yield, not net (no taxes, vacancy, maintenance).
- **A snapshot of the whole listed market.** Listings are read newest first, all pages, so long-unsold stock is included too. Every yield record reports the sample's median age and oldest listing.
- **Development projects are not scored.** Project tiles have no single price or area and are left out; counts appear in `RUN_SUMMARY`. Some flats that the portal shows only inside development pages may be missing from the all-markets view.
- **New builds are not marked.** The portal does not flag them on a listing, so `isPrimaryMarket` is `null` by default and `false` when you request resales only.
- **Rentals are not split by market.** Rental figures always cover the whole rental market of the city.
- **Few, large freguesias in Porto.** The portal merges Porto's parishes into 7 units, so freguesia-level detail is coarser than in Lisbon.
- **Typology comes from the portal's room count.** The Actor converts it and checks it against the title, but a listing with wrong data on the portal can still slip through.
- **No information about the flat's condition.** A cheap listing may need renovation.
- **Lisbon and Porto only for now.**

### FAQ

**Why do the yields differ from the portal's averages?** We use medians per m² within comparable groups, not city-wide means, and only cleaned listings.

**What does `confidence` mean?** See *How the numbers are computed*: it depends on the comparison level, the number of listings and the share of the city that was read.

**Why does a listing score 100?** Its price per m² is far below its group's median. In tight groups that happens at a moderate discount. Check the listing before trusting it.

**Is this the same as the Otodom Actor?** It uses the same method for Portugal. The Polish version (Otodom) is here: https://apify.com/data-nest/cee-rental-yield (Apify Store).

**How often should I run it?** Daily monitoring catches new listings and price cuts; a full report weekly is enough to follow yields.

### Roadmap

- More Portuguese cities on request.
- Missing a city or a metric? Open an issue on the Issues tab – requests decide what comes next.

### Data sources and responsible use

- Data comes from Imovirtual search-result pages only, which its robots.txt allows. Listing detail pages are never opened.
- At most one request per second to the website.
- No personal data is collected or stored; each result links to the original listing instead of copying it.
- This Actor is independent and not affiliated with or endorsed by Imovirtual.

# Actor input Schema

## `cities` (type: `array`):

Cities to analyse. Each city fetches apartments for sale and for long-term rent: Lisbon (/lisboa/lisboa) and Porto (/porto/porto).

## `mode` (type: `string`):

yieldReport: gross rental yield per freguesia and typology. scoreListings: a 0–100 deal score for every listing for sale. both: yield report and scored listings. listings: every apartment for sale and for rent, one row each, with deal score and estimated rent and yield on the sale rows; no yield rows, and maximum scored listings is ignored.

## `typology` (type: `array`):

Portuguese typology counts bedrooms: T1 ≈ one bedroom + living room. T0 is a studio; "T4+" means four or more bedrooms.

## `areaMin` (type: `integer`):

Smallest flat size to include.

## `areaMax` (type: `integer`):

Largest flat size to include.

## `minScore` (type: `integer`):

Return only listings with a deal score at or above this value (50 = priced at the median of comparable flats). In mode listings it applies to sale rows only.

## `maxScoredListings` (type: `integer`):

Return at most this many listings, best deals first. 0 = all. Ignored in mode listings.

## `includePrimaryMarket` (type: `boolean`):

On (default): resales and new builds are compared together; isPrimaryMarket is then always null, because the portal does not mark new builds on listings. Off: the portal is asked for resales only on the sale side (rents are not split by market); isPrimaryMarket is then false.

## `minSalePrice` (type: `integer`):

Return only listings for sale asking at least this much. Filters returned rows only; scores compare with the whole market. Modes listings, scoreListings and both.

## `maxSalePrice` (type: `integer`):

Return only listings for sale asking at most this much. Filters returned rows only; scores compare with the whole market. Modes listings, scoreListings and both.

## `minMonthlyRent` (type: `integer`):

Return only rentals asking at least this much per month. Filters returned rows only; estimates use the whole market. Mode listings only.

## `maxMonthlyRent` (type: `integer`):

Return only rentals asking at most this much per month. Filters returned rows only; estimates use the whole market. Mode listings only.

## `maxListingsPerSide` (type: `integer`):

Listings for sale and, separately, for rent per city. 0 = all pages (the full market of the city).

## `minSaleSample` (type: `integer`):

Fewer listings for sale than this in a freguesia and typology group: the group falls back to the city level.

## `minRentSample` (type: `integer`):

Fewer listings for rent than this in a freguesia and typology group: the rent estimate falls back to the city level.

## `onlyNewOrChanged` (type: `boolean`):

Return only listings that are new or at least 1% cheaper since the last run with the same watchlist name.

## `watchlistName` (type: `string`):

Name of the monitoring memory. Use a different name for each watchlist; letters, digits, '.', '\_' and '-'.

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

Proxy used to reach the listing portal. The default is Apify Proxy's residential group with addresses in Portugal. You can pass your own proxyConfiguration instead.

## Actor input object example

```json
{
  "cities": [
    "lisboa"
  ],
  "mode": "both",
  "typology": [
    "T0",
    "T1",
    "T2",
    "T3",
    "T4+"
  ],
  "areaMin": 15,
  "areaMax": 250,
  "minScore": 0,
  "maxScoredListings": 1000,
  "includePrimaryMarket": true,
  "maxListingsPerSide": 360,
  "minSaleSample": 15,
  "minRentSample": 10,
  "onlyNewOrChanged": false,
  "watchlistName": "default",
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ],
    "apifyProxyCountry": "PT"
  }
}
```

# Actor output Schema

## `scoredListings` (type: `string`):

Apartments for sale with deal score, best deals first; in mode listings, every apartment for sale and for rent (default dataset).

## `rentalYield` (type: `string`):

Gross rental yield per freguesia and typology (areaYield records; in mode yieldReport they are 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 = {
    "cities": [
        "lisboa"
    ],
    "maxListingsPerSide": 360,
    "proxyConfiguration": {
        "useApifyProxy": true,
        "apifyProxyGroups": [
            "RESIDENTIAL"
        ],
        "apifyProxyCountry": "PT"
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("data-nest/imovirtual-rental-yield").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 = {
    "cities": ["lisboa"],
    "maxListingsPerSide": 360,
    "proxyConfiguration": {
        "useApifyProxy": True,
        "apifyProxyGroups": ["RESIDENTIAL"],
        "apifyProxyCountry": "PT",
    },
}

# Run the Actor and wait for it to finish
run = client.actor("data-nest/imovirtual-rental-yield").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 '{
  "cities": [
    "lisboa"
  ],
  "maxListingsPerSide": 360,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ],
    "apifyProxyCountry": "PT"
  }
}' |
apify call data-nest/imovirtual-rental-yield --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,data-nest/imovirtual-rental-yield"
        }
    }
}
```

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/6diGAlbJFG7QkNysT/builds/KZhkBUAbtJNhTyAES/openapi.json
