Skip to content

Get full property by zpid

Goal: given a zpid, get the full property detail plus photos and price history, without burning extra units.

const api = "https://api.zillapi.com";
const headers = { authorization: `Bearer ${process.env.ZILLOW_API_KEY}` };
async function getFullProperty(zpid) {
// First call may pull from upstream and warm the cache (24h TTL).
// Subsequent sub-resource calls reuse the cache for free.
const [detail, photos, priceHistory, schools] = await Promise.all([
fetch(`${api}/v1/properties/${zpid}`, { headers }).then(r => r.json()),
fetch(`${api}/v1/properties/${zpid}/photos`, { headers }).then(r => r.json()),
fetch(`${api}/v1/properties/${zpid}/price-history`, { headers }).then(r => r.json()),
fetch(`${api}/v1/properties/${zpid}/schools`, { headers }).then(r => r.json()),
]);
return {
...detail.data,
photos: photos.data,
priceHistory: priceHistory.data,
schools: schools.data,
};
}

The four calls run in parallel. The first one populates properties_cache; the next three are cache hits and cost zero units.

Reducing payload

The detail response is large. If you only need a handful of fields:

const r = await fetch(
`${api}/v1/properties/${zpid}?fields=zpid,address.streetAddress,price,zestimate,bedrooms,bathrooms`,
{ headers }
).then(r => r.json());

See Field projection.