Skip to content
ListingrailGet an API key

How to scrape Leboncoin listings in Python

By the end of this guide you have a CSV of Lyon homes to rent under 1,200 euros a month, with rooms, floor area and postcode, from one script you can run again tomorrow. It starts with what a hand-written Leboncoin scraper runs into, then takes the shorter route: an API that does the scraping and returns JSON. Everything below was run on 18 November 2026; the output table is what it returned.

Why scraping Leboncoin yourself breaks

  • Leboncoin has no public API for searching or reading its ads, and no developer portal for real estate. The one developer site under its name documents a car valuation API.
  • What it offers professionals is automatic posting: an estate agency with a paid professional offer sends its own ads from its business software. Nothing in it reads other advertisers' ads.
  • Leboncoin's robots.txt opens with the statement that automatic access is forbidden without special permission, and it disallows the search path for the crawlers it names.
  • The general terms page answers automated readers with HTTP 403.

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 Leboncoin API page has the official options with sources.

1. Get a key

One request with your email returns a key with 250 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":"leboncoin","location":"Lyon","type":"rent","maxPrice":1200,"limit":50},
    timeout=300,
)
r.raise_for_status()
listings = r.json()["listings"]

fields = ["price", "currency", "rooms", "area", "postal_code", "city", "url"]
with open("leboncoin-lyon.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 leboncoin-lyon.csv")

The request body, on its own:

{
  "source": "leboncoin",
  "location": "Lyon",
  "type": "rent",
  "maxPrice": 1200,
  "limit": 50
}

Each listing returned costs one credit. A search that finds nothing, or fails at Leboncoin, costs nothing. A request can take up to a minute or two, because Leboncoin is read at that moment.

3. What comes back

The first three rows of the run on 18 November 2026:

ListingPriceSizeAgent
leboncoin.fr/ad/locations/3310745305640 EUR / month1 rooms · 1 ba · 22 m²Lefortimmo
leboncoin.fr/ad/locations/33121994701,106 EUR / month3 bd · 1 ba · 86 m²–
leboncoin.fr/ad/locations/3312179111870 EUR / month1 bd · 1 ba · 53 m²–

Every listing has the same keys on all 22 portals, so the code for Leboncoin reads the others too. Fields Leboncoin 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", "postal_code", "city", "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": "leboncoin",
        "location": "Lyon",
        "filters": {"type":"rent", "maxPrice":1200},
        "webhook_url": "https://example.com/new-listings",
    },
    timeout=30,
)

Changes can also be read with GET /v1/monitors/MONITOR_ID/changes or downloaded as CSV. Plans and limits are on the monitors page.

Leboncoin quirks worth knowing

  • Write the city or town by its French name as written, accents included: "Paris", "Lyon", "Sarlat-la-Canéda".
  • minPrice, maxPrice and minBeds work with a place name. Rows outside the range are dropped and not charged.
  • address was empty in all five rows read on 18 November 2026: the ads came back with city, postal_code and coordinates, not a street. The CSV here uses postal_code and city.
  • rooms is the French count of pièces and was filled on every row. beds was empty on the two one-room flats.
  • agent.company is the agency where a professional posted the ad; two of the three rows in the table above had none. agent.name and agent.phone were empty in the rows read on 18 November 2026. Each row carries photo links.
  • Measured on 14 November 2026: ten searches (Paris, Lyon, Sarlat-la-Canéda, Saint-Malo and Annecy, sale and rent, 20 listings each) answered in 3.8 to 27.0 seconds, nine of them in under 7 seconds.

Questions

Should I write my own Leboncoin scraper or use an API?

A scraper of your own costs nothing but your time and can work for a few pages from a home connection. For repeated or scheduled runs from a server you take on the points listed under "Why scraping Leboncoin yourself breaks". An API moves that work to someone else: here one request returns clean JSON and you pay per listing, with 250 free listings a month.

Is there an official Leboncoin API?

Not for reading ads. Leboncoin offers professionals automatic posting of their own ads from their business software, and its one developer site documents a car valuation API.

Does Leboncoin give the street address of a listing?

Not in the rows we read on 18 November 2026: address was empty, while city, postal_code and coordinates were filled.

Can I get alerts for new Leboncoin listings?

Yes, for a search the monitor can read in full. A monitor checks your saved search once a day and reports new listings, removed ones and price changes, by webhook or as CSV from the monitors page. When the search holds more listings than the monitor reads (its limit, up to 500), a Leboncoin monitor reports price changes only, so keep the search narrow with a price range or a smaller place.

Get 250 free listingsAPI docsOther guides