Skip to content
ListingrailGet an API key

Real estate listings API in JavaScript (Node.js)

This guide gets live property listings into Node.js as JSON with the built-in fetch: no SDK and no npm package. It covers a search, getting past the 500 listings one request returns, the errors you will meet, saving to JSON and CSV, and a TypeScript type for a listing. The API is Listingrail, which reads 22 property portals at the moment you ask and returns every listing in the same shape.

The code is the files that ran against the live API, and every output block is what they printed: 3 requests, 13 listings, 13 credits. A free key has 250 a month, so you can run all of it without paying.

Updated . Run on Node 22; fetch is built in from Node 18.

Try it without a key

GET /v1/demo returns a few listings from a stored snapshot. It needs no key and uses no credits, so it is a quick way to see the JSON. Save this as demo.mjs and run node demo.mjs:

// demo.mjs: no key needed. Run with: node demo.mjs
const r = await fetch("https://listingrail.com/v1/demo?source=rightmove&city=Manchester&type=sale");
const data = await r.json();

console.log(data.count, "listings from the snapshot of", data.snapshot_date);
for (const home of data.listings) {
  console.log(home.price, home.currency, "|", home.beds, "bed |", home.property_type, "|", home.url);
}

Output:

3 listings from the snapshot of 2026-10-19
160000 GBP | 1 bed | Apartment | https://www.rightmove.co.uk/properties/94431885
230000 GBP | 1 bed | Apartment | https://www.rightmove.co.uk/properties/94455420
280000 GBP | 3 bed | Terraced | https://www.rightmove.co.uk/properties/94429656

The demo is a snapshot, as its date says. Call https://listingrail.com/v1/demo without parameters for the list of sample cities. Everything below reads the portals live.

1. Get a key

One request with your email returns a key with 250 free listings a month. It is shown once, so keep it in an environment variable and out of your code.

curl -X POST https://listingrail.com/v1/signup \
  -H "content-type: application/json" \
  -d '{"email": "you@example.com"}'

export LISTINGRAIL_KEY=re_...

You can also enter your email on the home page. The key goes into the Authorization: Bearer header of every request.

Put one helper in listingrail.mjs. Every search is a POST to /v1/listings/search with a JSON body.

// listingrail.mjs: one helper for every search. Node 18 or later, no dependency.
const BASE = "https://listingrail.com";
const KEY = process.env.LISTINGRAIL_KEY;
const sleep = (ms) => new Promise((done) => setTimeout(done, ms));

export async function search(body, tries = 3) {
  const r = await fetch(`${BASE}/v1/listings/search`, {
    method: "POST",
    headers: { Authorization: `Bearer ${KEY}`, "content-type": "application/json" },
    body: JSON.stringify(body),
    signal: AbortSignal.timeout(180_000), // a portal is read at request time
  });
  if (r.ok) {
    const data = await r.json();
    if (data.notice) console.warn(data.notice, data.buy_url); // only below the low-balance line
    return data;
  }
  // 502: the portal could not be read, nothing was charged. 429: more than 5 requests a second.
  if ((r.status === 502 || r.status === 429) && tries > 1) {
    await sleep(r.status === 429 ? 1000 : 5000);
    return search(body, tries - 1);
  }
  const { detail } = await r.json().catch(() => ({}));
  const err = new Error(`HTTP ${r.status}: ${typeof detail === "string" ? detail : JSON.stringify(detail)}`);
  err.status = r.status;
  err.detail = detail; // on 402: buy_url, upgrade_url and plans
  throw err;
}

The timeout is 180 seconds because the portal is read while you wait: an answer can take from a few seconds up to two minutes on a large search. Then the first search, at the top of run.mjs:

// run.mjs: search, walk two price ranges, save JSON and CSV. Run with: node run.mjs
import { writeFile } from "node:fs/promises";
import { search } from "./listingrail.mjs";

// 1. One search: three homes for sale in Austin from Zillow.
const first = await search({ source: "zillow", location: "Austin, TX", limit: 3 });
console.log(first.count, "listings,", first.credits_used, "credits used");
for (const home of first.listings) {
  console.log(home.price, home.currency, "|", home.beds, "bed |", home.area, home.area_unit, "|", home.address);
}

Output:

3 listings, 3 credits used
498000 USD | 3 bed | 1438 sqft | 12703 Timberside Dr, Austin, TX 78727
1275000 USD | 4 bed | 4767 sqft | 3601 Denbar Ct, Austin, TX 78739
250000 USD | 4 bed | 1952 sqft | 5810 Vasey Blvd, Austin, TX 78724

The body takes source (the portal key), location (written the way that portal expects), and optionally type ("rent" or "sale"), minPrice, maxPrice, minBeds and limit (1 to 500, 20 if you leave it out). You are charged for the listings returned, not for the limit. The order is the portal's own, so the same search can start with other homes a few minutes later.

One listing of that run in full, with its raw object left out:

{
  "id": "70344560",
  "url": "https://www.zillow.com/homedetails/5810-Vasey-Blvd-Austin-TX-78724/70344560_zpid/",
  "source": "zillow",
  "title": "5810 Vasey Blvd, Austin, TX 78724",
  "address": "5810 Vasey Blvd, Austin, TX 78724",
  "city": "Austin",
  "region": "TX",
  "postal_code": "78724",
  "country": "US",
  "lat": 30.257196,
  "lng": -97.57937,
  "price": 250000,
  "currency": "USD",
  "price_period": null,
  "beds": 4,
  "rooms": null,
  "baths": 3,
  "area": 1952,
  "area_unit": "sqft",
  "property_type": "SINGLE_FAMILY",
  "listed_at": null,
  "photos": [
    "https://photos.zillowstatic.com/fp/82f54ff4cba647cb68fc02fd1927cabf-p_e.jpg"
  ],
  "agent": {
    "name": null,
    "phone": null,
    "company": "Opendoor Brokerage LLC"
  },
  "raw": {
    "…": "the portal's own record, left out here"
  }
}

Around the listings the answer carries source, location, type, count, credits_used and credits_remaining. The API docs describe every field.

3. More than 500 listings

The search endpoint has no offset and no page number: limit goes from 1 to 500 and one request returns the first listings of the search. For a whole city, split the search into pieces that do not overlap and merge the answers. Price ranges are the simplest split:

// 2. More than one request: price ranges that do not overlap, merged by id.
const ranges = [[0, 299999], [300000, 449999]];
const byId = new Map();
for (const [minPrice, maxPrice] of ranges) {
  const part = await search({ source: "zillow", location: "Austin, TX", minPrice, maxPrice, limit: 5 });
  for (const home of part.listings) byId.set(home.id, home);
  console.log(`${minPrice} to ${maxPrice}: ${part.count} listings`);
}
const homes = [...byId.values()];

Output:

0 to 299999: 5 listings
300000 to 449999: 5 listings

This run used two ranges and limit: 5 to keep the test small. For a real pull set limit: 500 and choose the ranges so that each one returns fewer than 500 listings. A range that comes back full (count equal to limit) holds more than you got, so split it again.

  • The Map is keyed by id, the portal's own listing id, so a home that shows up twice is kept once. If a portal gives no id for a row, id is null, so home.id ?? home.url is the safer key.
  • 14 of the 24 sources accept minPrice and maxPrice. kleinanzeigen takes maxPrice only. zoopla, immobilienscout24, fotocasa, daft, otodom, imovirtual, hemnet, bayut, propertyfinder take neither: a request that sends a filter the source does not accept is refused with HTTP 400. Split those by area (district, postcode, neighbouring towns), or set the filters on the portal's own site and pass that search link as location where the source takes links. GET /v1/sources lists the filters and the location format of every source.
  • Each listing returned costs one credit in every piece, and a piece that finds nothing costs nothing.
  • Keep it under 5 requests a second on one key; a loop that waits for each answer, as above, stays well below that.

4. Errors, and the notice before the credits run out

The helper throws an Error with the HTTP status in err.status and the body's detail in err.detail. A request the API refuses costs nothing. This one asks Zoopla for a price filter it does not take:

// errors.mjs: what a refused request looks like. Costs nothing.
import { search } from "./listingrail.mjs";

try {
  await search({ source: "zoopla", location: "Bristol", maxPrice: 900, limit: 3 });
} catch (err) {
  console.log(err.status, err.message);
}

Output:

400 HTTP 400: Source 'zoopla' does not accept ['maxPrice']. Accepted filters: none.
StatusMeaningWhat to do
400The source is unknown, the source does not offer that type or filter, or the portal knows no such place (detail.error is "unknown_location").Fix the request; the message says what is accepted. Do not retry.
401The key is missing or unknown.Check that LISTINGRAIL_KEY is set.
402No credits left. detail is an object with error: "insufficient_credits", buy_url, upgrade_url and plans.Stop the loop. Open buy_url, or wait for the monthly renewal.
422The body is invalid, for example limit: 501 or a missing location. detail is a list that names the field.Fix the request.
429More than 5 requests a second on one key.Wait a second and retry; the helper does.
502The portal could not be read just now. Nothing was charged.Retry after a few seconds; the helper tries three times.

Only 429 and 502 are worth retrying. The 402 and 502 rows come from the API's own code and documentation; this guide's run did not produce them.

Before the 402. A successful answer starts to carry three more fields when the balance is low: under 20 credits, or under 50 on a free key. notice is one sentence that says how many credits are left, buy_url is the checkout for the one-time $9 pack of 2,500 listings, filled with the email of your key, and upgrade_url points to the plans. If you ask for more listings than you have credits, the search still runs and returns as many as the balance covers: count is then below limit, and notice says so. The helper prints the notice with console.warn, so a script that runs unattended leaves a trace in its log before it stops.

5. Save JSON and CSV

The end of run.mjs writes the merged listings twice: the full records as JSON, and a few columns as CSV for a spreadsheet.

// 3. Save: the full records as JSON, a few columns as CSV.
await writeFile("austin.json", JSON.stringify(homes, null, 2));
const fields = ["id", "price", "currency", "beds", "baths", "area", "address", "postal_code", "url"];
const cell = (v) => (v == null ? "" : `"${String(v).replaceAll('"', '""')}"`);
const lines = [fields.join(","), ...homes.map((home) => fields.map((f) => cell(home[f])).join(","))];
await writeFile("austin.csv", lines.join("\n") + "\n");
console.log(homes.length, "listings saved to austin.json and austin.csv");

Output, and the first lines of austin.csv:

10 listings saved to austin.json and austin.csv
id,price,currency,beds,baths,area,address,postal_code,url
"70344560","250000","USD","4","3","1952","5810 Vasey Blvd, Austin, TX 78724","78724","https://www.zillow.com/homedetails/5810-Vasey-Blvd-Austin-TX-78724/70344560_zpid/"
"2090097416","298000","USD","3","3","1302","4509 Kind Way, Austin, TX 78725","78725","https://www.zillow.com/homedetails/4509-Kind-Way-Austin-TX-78725/2090097416_zpid/"
"80090024","250000","USD","3","3","1590","8301 Shallot Way, Austin, TX 78748","78748","https://www.zillow.com/homedetails/8301-Shallot-Way-Austin-TX-78748/80090024_zpid/"

Every cell is quoted and a quote inside a value is doubled, which is what Excel, Google Sheets and pandas expect; addresses contain commas. raw, photos and agent are objects or arrays, so they stay in the JSON file. To add the agency to the CSV, write home.agent.company into a column of its own.

6. The TypeScript type

Every portal returns the same keys. A field a portal does not give is null, so the type has many nullable fields, and raw holds the portal's own record with whatever it adds.

// listing.ts: one listing and one search answer, as the API returned them on 18 November 2026.
export interface Listing {
  id: string;
  url: string;
  source: string; // the source key you asked for, such as "zillow"
  title: string | null;
  address: string | null; // null on the Leboncoin rows we read
  city: string | null;
  region: string | null;
  postal_code: string | null;
  country: string; // ISO 3166 code, such as "US"
  lat: number | null;
  lng: number | null;
  price: number | null;
  currency: string; // ISO 4217 code, such as "USD"
  price_period: string | null; // "month" on rentals, null on homes for sale
  beds: number | null; // 0 is a studio
  rooms: number | null; // where the portal counts rooms
  baths: number | null;
  area: number | null;
  area_unit: "sqft" | "sqm" | null;
  property_type: string | null; // as the portal names it
  listed_at: string | null;
  photos: string[];
  agent: { name: string | null; phone: string | null; company: string | null };
  raw: Record<string, unknown>; // the portal's own record
}

export interface SearchAnswer {
  source: string;
  location: string;
  type: "rent" | "sale";
  count: number;
  credits_used: number;
  credits_remaining: number;
  listings: Listing[];
  // only below the low-balance line (under 20 credits, under 50 on a free key):
  upgrade_url?: string;
  buy_url?: string;
  notice?: string;
}

In a TypeScript project, type the helper's return value as Promise<SearchAnswer>. property_type is the portal's own word ("SINGLE_FAMILY" on Zillow, "Apartment" on Rightmove), so do not treat it as a fixed list.

The same code for other portals

Change source and location and the helper reads another portal. Each portal page says how to write the location, which filters it takes and whether the portal has an official API of its own:

  • Zillow: { source: "zillow", location: "Austin, TX" } for homes for sale, zillow-rentals for rentals.
  • Rightmove: { source: "rightmove", location: "Manchester", type: "rent" }.
  • Idealista: { source: "idealista", location: "madrid", type: "rent" }; add , it or , pt for Italy and Portugal.
  • All 22 portals, with their countries and source keys.

Without type a source answers with the first kind it offers, which is homes for sale on most and rentals on some; GET /v1/sources lists the kinds in that order. For a daily job, a monitor stores a search, checks it once a day and posts what changed to a webhook, so you do not compare files yourself. Working in Python? The Python guides do the same per portal. In an AI agent, the same key works through the MCP server.

Questions

Do I need an SDK or an npm package to use the API from JavaScript?

No. The API is plain HTTPS with JSON, and Node.js has fetch built in from version 18. The helper on this page is one file of about 30 lines with no dependency; the run shown here used Node 22.

How do I get more than 500 listings in JavaScript?

One request returns at most 500 listings and the search endpoint has no offset or page parameter. Split the search into price ranges that do not overlap with minPrice and maxPrice, or into smaller areas, and merge the answers in a Map keyed by the listing id. When a range comes back with as many listings as the limit, split that range again.

Can I call the real estate API from the browser?

The API answers cross-origin requests, but a key in front-end code can be read and spent by every visitor. Keep the key on your server, for example in a Node.js route that calls Listingrail and passes the listings on.

What do the HTTP errors mean?

400: the source, type, filter or place is not accepted, and the message names it. 401: the key is missing or unknown. 402: no credits left. 422: the body is invalid, for example a limit above 500. 429: more than 5 requests a second on one key. 502: the portal could not be read just now. None of them uses credits.

What does a search cost?

One credit per listing returned, whatever the portal. A search that finds nothing or fails costs nothing. The run on this page returned 13 listings and used 13 credits; a free key has 250 a month. On the paid plans 1,000 listings cost $3.60 on Pack, $4.00 on Lite, $1.96 on Starter, $1.66 on Growth.

Does it work with TypeScript?

Yes. The answer is plain JSON, and this page has an interface for one listing and for the search answer, written from the fields the API returned. Every portal returns the same keys; a field a portal does not give is null.

Get 250 free listingsAPI docsPricingOther guides