Idealista listings by API in Python: Spain, Italy and Portugal
This guide gets Idealista listings into Python as JSON: rentals and homes for sale in Spain, Italy and Portugal, filtered by price and bedrooms, past the 500 listings one request returns, and into a CSV. It also says what each 1,000 listings cost and which fields you will not get. The whole script was run on 13 November 2026: 9 requests, 115 listings, 35 seconds, 115 credits. A free key has 250, so you can run all of it without paying.
What Idealista's own API allows
Idealista has an official Search API for the three countries. You cannot sign up for it. You fill in the access request form with a description of your project and Idealista decides whether you get a key. It publishes no documentation, price or quota before that. What is known about the API itself comes from people who have a key: community clients describe a search by centre point and distance with 50 results per page. We could not confirm those numbers with Idealista.
If your request is approved, use it: it is the official route. This guide is for everyone else. It uses Listingrail, which reads the public Idealista search at the moment you ask and returns the listings in one JSON shape. The Idealista API page keeps the official facts and their sources up to date, and the shorter scraping guide explains why a scraper of your own gets HTTP 403.
1. Get a key and write one helper
One request with your email returns a key. It is shown once, so put it in an environment variable.
curl -X POST https://listingrail.com/v1/signup \
-H "content-type: application/json" \
-d '{"email": "you@example.com"}'
export LISTINGRAIL_KEY=re_...Install requests (pip install requests) and start a file, say idealista.py, with this. Every later snippet goes below it in the same file.
import csv
import os
import time
import requests
API = "https://listingrail.com/v1/listings/search"
HEADERS = {"Authorization": f"Bearer {os.environ['LISTINGRAIL_KEY']}"}
def search(**query):
for attempt in range(3):
r = requests.post(API, headers=HEADERS, json={"source": "idealista", **query}, timeout=300)
if r.status_code != 502: # 502: Idealista could not be read, nothing was charged
break
time.sleep(5)
r.raise_for_status()
return r.json()The helper retries on HTTP 502, which means Idealista could not be read at that moment. A 502 is never charged. Other errors raise: 400 names the field that is wrong, 402 means the credits are used up, 429 means more than 5 requests a second on one key.
2. First search: Madrid rentals
data = search(location="madrid", type="rent", limit=10)
print(data["count"], "listings,", data["credits_used"], "credits used,", data["credits_remaining"], "left")
for home in data["listings"][:3]:
print(home["price"], home["currency"], "|", home["beds"], "bed |", home["area"], "m2 |", home["address"])Output:
10 listings, 10 credits used, 183 left
2200 EUR | 2 bed | 90 m2 | Piso en Calle de Jorge Juan, Madrid, Goya, Madrid
1915 EUR | 2 bed | 48 m2 | Piso en Guindalera, Madrid
1990 EUR | 2 bed | 64 m2 | Piso en Adelfas, Madridtype is "rent" or "sale"; without it you get homes for sale. limit is how many listings you want, 1 to 500, 20 if you leave it out. You are charged for the listings returned, not for the limit. The order is Idealista's own and it moves: the same search a few minutes earlier started with three other flats.
One listing of that search in full, without its raw object and with the photo link shortened:
{
"id": "112655232",
"url": "https://www.idealista.com/inmueble/112655232/",
"source": "idealista",
"title": "Piso en Calle de los Astros, Estrella, Madrid",
"address": "Piso en Calle de los Astros, Estrella, Madrid",
"city": "Madrid",
"region": "Madrid",
"postal_code": null,
"country": "ES",
"lat": 40.4096174,
"lng": -3.6664825,
"price": 2100,
"currency": "EUR",
"price_period": "month",
"beds": 3,
"rooms": null,
"baths": 1,
"area": 110,
"area_unit": "sqm",
"property_type": "flat",
"listed_at": null,
"photos": [
"https://img4.idealista.com/s/v1/..."
],
"agent": {
"name": "Diplomatic",
"phone": "+34919387081",
"company": "Diplomatic"
}
}beds is the number of bedrooms as Idealista counts them, and 0 is a studio. area is in square metres. address starts with the property type in the language of the site ("Piso en", "Bilocale in", "Apartamento T3 na"). agent.name is the contact the advert shows, agent.company the agency. These keys are the same on all 22 portals Listingrail reads, so code written for Idealista also reads Fotocasa or Immobiliare.it.
3. Italy and Portugal
A place name on its own is searched in Spain. Add , it for Italy or , pt for Portugal, and write the place as that country's Idealista site does (roma, lisboa).
for place, kind in [("barcelona", "sale"), ("roma, it", "rent"), ("lisboa, pt", "sale")]:
data = search(location=place, type=kind, limit=10)
home = data["listings"][0]
print(place + ":", data["count"], "listings, first:", home["price"], home["currency"] + ",", home["country"] + ",", home["address"])Output:
barcelona: 10 listings, first: 1800000 EUR, ES, Casa o chalet independiente en Calle de Benedetti, Sant Gervasi - La Bonanova, Barcelona
roma, it: 10 listings, first: 1600 EUR, IT, Bilocale in Via di San Giovanni in Laterano, 85, Rione Celio, Roma
lisboa, pt: 10 listings, first: 695000 EUR, PT, Apartamento T3 na Rua Maestro António Taborda, Lapa, EstrelaA sale has price_period null and the full asking price in price. A rental has "month". All three countries answer in EUR.
4. Filters: price, bedrooms, and everything else by link
Three filters are part of the request: minPrice, maxPrice and minBeds. For rentals the prices are per month.
data = search(location="madrid", type="rent", minPrice=1000, maxPrice=1500, minBeds=2, limit=10)
print(data["count"], "listings,", data["credits_used"], "credits used")
print(sorted(home["price"] for home in data["listings"]))
print(sorted(home["beds"] for home in data["listings"]))Output:
10 listings, 10 credits used
[1000, 1200, 1200, 1300, 1300, 1350, 1469, 1500, 1500, 1500]
[2, 2, 2, 2, 2, 2, 2, 2, 3, 3]Listings outside the range are dropped before the answer is counted, so you do not pay for them.
For any other filter (terrace, lift, a district, a map area, new builds), set it on the Idealista website, copy the address of the result page and pass it as location. Links from idealista.com, idealista.it and idealista.pt are accepted. A link keeps the filters it carries, so leave minPrice, maxPrice and minBeds out of the request and set them in the link. This one is "to rent, Madrid, Centro district, with a terrace":
link = "https://www.idealista.com/alquiler-viviendas/madrid/centro/con-terraza/"
data = search(location=link, type="rent", limit=5)
for home in data["listings"]:
print(home["price"], "|", home["raw"]["features"]["hasTerrace"], "|", home["raw"]["district"], "|", home["address"])Output:
5500 | True | Centro | Ático en Calle de San Agustín, Huertas-Cortes, Madrid
2200 | True | Centro | Piso en Calle del Prado, Huertas-Cortes, Madrid
1950 | True | Centro | Piso en Calle de Campoamor, Chueca-Justicia, Madrid
1650 | True | Centro | Piso en Calle Barbieri, 23, Chueca-Justicia, Madrid
1800 | True | Centro | Piso en Calle de Santa Isabel, 22, Lavapiés-Embajadores, MadridThe second column is raw.features.hasTerrace. raw is the record as it was read from Idealista, and it holds what the shared keys have no place for: description (the first 300 characters), floor, has_lift, exterior, condition, neighborhood, district, price_per_sqm, photo_count and agent_type ("professional" or "private").
5. More than 500 listings: walk the price ranges
One request returns at most 500 listings, and there is no page number or cursor to ask for "the next 500". Asking twice gives you the top of the list twice. To go deeper, cut the search into price ranges that do not overlap, ask for each, and merge by id. The example uses a limit of 20 to stay inside the free credits; for a real pull set limit=500 and make a range narrower when it comes back full.
bands = [(0, 900), (901, 1200), (1201, 1600)]
homes = {}
for low, high in bands:
data = search(location="valencia", type="rent", minPrice=low, maxPrice=high, limit=20)
for home in data["listings"]:
homes[home["id"]] = home # the id is Idealista's own, so a repeat overwrites itself
print(str(low) + "-" + str(high), "EUR:", data["count"], "listings,", data["credits_remaining"], "credits left")
fields = ["id", "price", "beds", "baths", "area", "address", "url"]
with open("valencia-rent.csv", "w", newline="", encoding="utf-8") as f:
writer = csv.DictWriter(f, fieldnames=fields, extrasaction="ignore")
writer.writeheader()
writer.writerows(homes.values())
print(len(homes), "distinct listings saved to valencia-rent.csv")Output:
0-900 EUR: 20 listings, 118 credits left
901-1200 EUR: 20 listings, 98 credits left
1201-1600 EUR: 20 listings, 78 credits left
60 distinct listings saved to valencia-rent.csvThe first lines of valencia-rent.csv:
id,price,beds,baths,area,address,url
112998919,900,1,1,28,"Piso en En Corts, València",https://www.idealista.com/inmueble/112998919/
113073379,800,0,1,30,"Estudio en El Pilar, València",https://www.idealista.com/inmueble/113073379/
113071186,900,3,1,90,"Piso en Calle de José María Haro s/n, Beteró, València",https://www.idealista.com/inmueble/113071186/A range that returns exactly its limit probably has more. Split it in two and ask again; the listings you already hold cost credits a second time, so start with narrow ranges where a city is dense (Madrid rentals between 1,000 and 2,000 EUR) and wide ones at the ends. The limit per key is 5 requests a second, and a larger request takes longer than the 3 to 5 seconds measured here for 5 to 20 listings: in an earlier measurement 300 Idealista rentals took 7 seconds.
Cost per 1,000 listings
One credit is one listing returned. A search that finds nothing, or that fails at Idealista, costs nothing. The free key has 250 credits a month and needs no card.
The script on this page used 115 credits. Pulling every rental in a city of 5,000 adverts once is 5,000 credits; doing that daily is 150,000 a month, which is the Scale plan. If you only need what changed since yesterday, a monitor is the cheaper shape. Plans are on the pricing page.
The limits, plainly
Counted on 105 listings from a run of the same searches, without Barcelona, a few minutes earlier:
postal_codeandlisted_atwerenullon all 105. Idealista's search results carry neither, so there is no "days on market" to compute.roomsis alwaysnullfor Idealista; the room count it gives is inbeds.photosholds one picture (103 of 105; two adverts had none).raw.photo_countsays how many the advert has. Photo links are signed and expire, so download a picture if you need to keep it.agent.phonewas filled on 97 of 105. All eight without a number were adverts by private people (15 of the 105,raw.agent_type"private"). Since 14 November 2026 an advert by a private person comes back without name, phone and description text, so expectagentto be empty on about one advert in seven.latandlngwere on every listing, but only 45 of 105 adverts show their exact address (raw.exact_address_shown). For the others the point is the approximate one Idealista publishes.- There is no details call for Idealista. What a result row has is what you get; the first 300 characters of the advert text are in
raw.description. - No sold or rented prices and no removed adverts in a search. Price history exists from 13 November 2026 on, only for listings some request has fetched, through
GET /v1/listings/idealista/LISTING_ID/historyon paid plans. A monitor reports changes from the day you create it. - 500 listings per request and no cursor, as shown above.
- The data is read when you ask. That keeps it current, and it means a request takes seconds and can answer 502 when Idealista refuses the read.
Questions
Is this Idealista's official API?
No. Idealista's own Search API is given out by application and has no public documentation or price. This guide uses Listingrail, which reads the public Idealista listings at the moment of your request and returns them as JSON.
Which countries does it cover?
The three Idealista sites: Spain (idealista.com), Italy (idealista.it) and Portugal (idealista.pt). A place name without a suffix is searched in Spain; add ", it" or ", pt" for the other two.
How many Idealista listings can one request return?
Up to 500. For more, split the search into price ranges with minPrice and maxPrice and merge the answers by id, as in the price range section.
What does 1,000 Idealista listings cost?
$3.60 on Pack, $4.00 on Lite, $1.96 on Starter, $1.66 on Growth. One credit is one listing returned; a search that finds nothing or fails costs nothing, and a free key has 250 listings a month.
Can I get the description and features of a listing?
Partly. raw.description holds the first 300 characters of the advert text (nothing for adverts by private people), and raw.features has flags such as hasTerrace, hasAirConditioning and hasSwimmingPool. There is no separate details call for Idealista.
Does it return sold prices or price history?
No sold prices. A search returns what is advertised now. To follow a search over time, save it as a monitor: it is checked once a day and reports new listings, removed ones and price changes. Paid plans can also read the price changes recorded for one listing since 13 November 2026.