Skip to content

Get full property by zpid

You have a zpid and want everything about the home: core facts, photos, price history, and schools. There are two ways to get there, and they cost different amounts.

Option 1: one call, 1 credit

The main record already contains the photos, history, and schools. Fetch it once and pull out the parts you need.

const API = "https://api.zillodata.com";
const headers = { Authorization: `Bearer ${process.env.ZILLODATA_KEY}` };
async function getHome(zpid) {
const res = await fetch(`${API}/v1/properties/${zpid}`, { headers });
const body = await res.json();
if (!res.ok) throw new Error(`${body.error.code}: ${body.error.message}`);
const home = body.data;
return {
zpid: home.zpid,
address: home.address,
price: home.price,
zestimate: home.zestimate,
photos: home.responsivePhotos ?? home.originalPhotos ?? [],
priceHistory: home.priceHistory ?? [],
taxHistory: home.taxHistory ?? [],
schools: home.schools ?? [],
};
}
const home = await getHome("29384412");
console.log(home.address.streetAddress, home.photos.length, "photos");

This is the cheapest way to get everything, since one lookup is one credit.

Option 2: sub-resources, 1 credit each

Each sub-resource returns one part of the record in a small, predictable shape. They’re useful when you need only one part, or want the tidier responses:

Endpoint Returns
/v1/properties/{zpid}/photos Photo list, plus photo_count, has_3d, and has_video in meta
/v1/properties/{zpid}/price-history Price change and sale events
/v1/properties/{zpid}/tax-history Yearly tax and assessment rows
/v1/properties/{zpid}/schools Nearby schools
/v1/properties/{zpid}/zestimate zestimate, rent_zestimate, tax_assessed_value, last_sold_price, currency
/v1/properties/{zpid}/agent Listing agent, broker, and MLS fields

Each call is billed on its own. Requesting the record plus three sub-resources in parallel costs 4 credits:

async function getHomeParts(zpid) {
const get = (path) =>
fetch(`${API}/v1/properties/${zpid}${path}`, { headers }).then((r) => r.json());
const [record, photos, history, schools] = await Promise.all([
get(""),
get("/photos"),
get("/price-history"),
get("/schools"),
]);
return {
...record.data,
photos: photos.data,
priceHistory: history.data,
schools: schools.data,
};
}

If you need all of these together, Option 1 gets the same data for a quarter of the credits.

Making the response smaller

When you only need a few fields, add fields to the lookup. The cost stays at 1 credit, but the response is a fraction of the size.

const fields = "zpid,price,zestimate,bedrooms,bathrooms,livingArea,address.city";
const res = await fetch(`${API}/v1/properties/29384412?fields=${fields}`, { headers });

See Field projection for the path syntax.

Handling misses

  • 400 invalid_zpid: the zpid has non-digit characters.
  • 404 property_not_found: nothing matched. The home may have been removed.
  • 502 property_lookup_failed or 504 lookup_timeout: retry after a short wait. These aren’t charged.