How to get Hemnet listings in Python
By the end of this guide you have a CSV of Stockholm apartments for sale on Hemnet with asking price, rooms, size and broker, from one script you can run again tomorrow. Everything below was run on 16 October 2026; the output table is what it returned.
Why scraping Hemnet yourself breaks
- Hemnet has no public API for reading listings. Its BostadsAPI is for broker systems publishing listings, behind a login with no self-service sign-up.
- Hemnet sits behind Cloudflare, which turns away a plain requests call. The results are in the page's Next.js data once you get it.
- Hemnet searches by its own location ids (Stockholm is 17744), not place names.
None of that is impossible, but each point is code you then maintain. The rest of this guide uses Listingrail, which does the reading and hands back clean JSON. The Hemnet API page has the official options with sources.
1. Get a key
One request with your email returns a key with 100 free listings. It is shown once, so keep 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_...2. Search and save to CSV
Install requests (pip install requests), then run:
import csv
import os
import requests
r = requests.post(
"https://listingrail.com/v1/listings/search",
headers={"Authorization": f"Bearer {os.environ['LISTINGRAIL_KEY']}"},
json={"source":"hemnet","location":"https://www.hemnet.se/bostader?location_ids%5B%5D=17744&item_types%5B%5D=bostadsratt","type":"sale","limit":50},
timeout=300,
)
r.raise_for_status()
listings = r.json()["listings"]
fields = ["price", "currency", "rooms", "area", "address", "url"]
with open("hemnet-stockholm.csv", "w", newline="", encoding="utf-8") as f:
writer = csv.writer(f)
writer.writerow(fields)
for home in listings:
writer.writerow([home[k] for k in fields])
print(len(listings), "listings saved to hemnet-stockholm.csv")The request body, on its own:
{
"source": "hemnet",
"location": "https://www.hemnet.se/bostader?location_ids%5B%5D=17744&item_types%5B%5D=bostadsratt",
"type": "sale",
"limit": 50
}Each listing returned costs one credit. A search that finds nothing, or fails at Hemnet, costs nothing. A request can take up to a minute or two, because Hemnet is read at that moment.
3. What comes back
The first three rows of the run on 16 October 2026:
Every listing has the same keys on all 17 portals, so the code for Hemnet reads the others too. Fields Hemnet does not show come back as null, and the portal's own record sits in raw. With pandas:
import pandas as pd
df = pd.DataFrame(listings)
df["agent"] = df["agent"].str.get("company")
print(df[["price", "rooms", "area", "address", "agent"]].head())4. Get new listings and price cuts every day
Running the script on a schedule works, but then you compare the files yourself. A monitor stores the search, checks it once a day, and sends only what changed: new listings and price cuts. The free key holds one monitor.
requests.post(
"https://listingrail.com/v1/monitors",
headers={"Authorization": f"Bearer {os.environ['LISTINGRAIL_KEY']}"},
json={
"source": "hemnet",
"location": "https://www.hemnet.se/bostader?location_ids%5B%5D=17744&item_types%5B%5D=bostadsratt",
"filters": {"type":"sale"},
"webhook_url": "https://example.com/new-listings",
},
timeout=30,
)Changes can also be read with GET /v1/monitors/{id}/changes or downloaded as CSV. Plans and limits are on the monitors page.
Hemnet quirks worth knowing
- Pass a hemnet.se search link or a location id. The link above keeps only bostadsrätter (apartments); the bare id 17744 also returns villas and new-build projects.
- price is the asking price in SEK. Hemnet only covers homes for sale, so there is no rent search.
- Hemnet counts half rooms ("2,5 rum"), so rooms can be 2.5 and area keeps its decimal. The exact text is in raw.rooms_text, and the monthly fee in raw.fee_per_month.
- New-build projects are one row each with ranges ("1-4 rum", "26-97 m²"); rooms and area hold the lower end. Check raw.record_type == "PROJECT" and read the ranges from raw. agent.name is the broker, agent.company the agency.
Questions
Is there a Hemnet API?
Only BostadsAPI, for broker systems that publish listings. There is none for searching.
How do I find a location id?
Search on hemnet.se and copy the link; the id is in it as location_ids[]. You can pass the whole link.
Can I get rentals?
No. Hemnet lists homes for sale.