Search then details (chained)
A search returns summary rows: price, beds, address, and a few other
fields. Sometimes you need the full record for every home it finds. You
could search, then look up each zpid yourself, but
POST /v1/search/with-details does both steps in one job and gives you back
only full records.
This recipe finds 3-bedroom homes for sale in Raleigh, NC under $750k and loads the full record for each one.
1. Start the job
const API = "https://api.zillodata.com";const headers = { Authorization: `Bearer ${process.env.ZILLODATA_KEY}`, "Content-Type": "application/json",};
const startRes = await fetch(`${API}/v1/search/with-details`, { method: "POST", headers, body: JSON.stringify({ filters: { status: "for_sale", bbox: { west: -78.75, south: 35.72, east: -78.55, north: 35.87 }, beds: { min: 3 }, price: { max: 750000 }, }, maxItems: 150, }),});const start = await startRes.json();if (!startRes.ok) throw new Error(start.error.message);
const jobId = start.data.job_id;console.log("started", jobId); // status "running", stage "search"filters.status and filters.bbox are required. The other filters are
optional. maxItems caps how many homes the search collects.
2. Wait for it to finish
In production, register a webhook and wait for
job.succeeded for this job ID. For a script, polling works:
const FINAL = new Set(["succeeded", "failed", "timed_out", "aborted"]);
async function waitForJob(id) { while (true) { const res = await fetch(`${API}/v1/jobs/${id}`, { headers }); const { data: job } = await res.json(); if (FINAL.has(job.status)) return job; console.log(`still working (stage: ${job.chain_stage})`); await new Promise((resolve) => setTimeout(resolve, 10_000)); }}
const job = await waitForJob(jobId);if (job.status !== "succeeded") { throw new Error(`job ${job.status}: ${job.error ?? "no details"}`);}chain_stage moves from search to detail partway through. The job’s
status stays running until both stages are done.
3. Read the full records
async function* fullRecords(id) { let offset = 0; while (true) { const res = await fetch( `${API}/v1/jobs/${id}/results?limit=500&offset=${offset}`, { headers }, ); const page = await res.json(); yield* page.data; if (!page.meta.has_more) return; offset += page.meta.count; }}
for await (const home of fullRecords(jobId)) { const lastEvent = home.priceHistory?.[0]; console.log(home.zpid, home.address?.streetAddress, home.price, lastEvent?.event);}Each row is a full property record, the same shape as
GET /v1/properties/{zpid}.
Options worth knowing
| Field | Default | Purpose |
|---|---|---|
searchUrls |
none | Use instead of filters: one or more zillow.com search URLs that include searchQueryState |
extractionMethod |
PAGINATION |
How the search walks the results |
propertyStatus |
FOR_SALE |
Status used for the detail lookups. Set RECENTLY_SOLD or FOR_RENT to match your search |
extractBuildingUnits |
disabled |
Whether to expand apartment and condo buildings into units |
Cost
The job is charged once it succeeds, at 1 credit per full record in the results. A job that returns 150 records costs 150 credits. If it fails or times out, nothing is charged.
To spend less, tighten the search first. A smaller box, a narrower price
range, or a lower maxItems all reduce the number of records you pay for.