ZillowHow-to

Export Zillow search results to CSV or Excel with Python

Zillow search stops at 820 homes. A Python script exports every for-sale listing in a ZIP code to CSV: 338 homes in 9 calls.

4 min read

Short answer

  • Zillow search shows at most 20 pages of 41 homes, so a city search stops at 820 listings even when thousands match.
  • Search ZIP by ZIP instead: the ToolzerHub script exported all 338 for-sale homes in Austin's 78704 to CSV in 17 seconds.
  • A search page of 41 listings costs 1 credit, so 1,000 listings take about 25 credits. The CSV is UTF-8 with a header row.
On this page

To get Zillow search results into a spreadsheet, you page through a search API and write one CSV row per home. Zillow search stops at 820 homes, 20 pages of 41, so the script below searches ZIP by ZIP. It exported every for-sale listing in Austin's 78704, 338 homes, in 9 calls.

The 820-listing ceiling

A Zillow search returns 41 homes per page and stops at page 20, so you reach at most 820 homes. A search for austin-tx reports 5,642 homes for sale but only 20 reachable pages. Search smaller areas instead: ZIP 78704 has 338 matches across 9 pages and ZIP 78745 has 352 across 9. Check total_pages; 20 means the search was capped.

Zillow listings with ToolzerHub

We make ToolzerHub. Our Zillow API returns search results as JSON, 41 listings per page at 1 credit a page. Zillow's own Data & APIs are for businesses and invited partners; see does Zillow have an API. You need Python 3, requests and an API key from the dashboard.

Export ZIP codes to CSV

region takes a ZIP code, a Zillow URL slug like austin-tx, or a state like ca. Pass several ZIPs separated by commas; seen drops homes that show up in two of them. FIELDS picks 14 of the 30-odd fields each listing has. cell() puts an apostrophe in front of text that starts with =, +, - or @, so a spreadsheet shows it as text.

python
import csv
import os
import sys
import time

import requests

URL = "https://api.toolzerhub.com/v1/zillow/search"
HEADERS = {"x-api-key": os.environ["TOOLZERHUB_API_KEY"]}
FIELDS = ["zpid", "address", "city", "state", "zipcode", "price", "bedrooms",
          "bathrooms", "living_area", "status_text", "broker_name", "latitude",
          "longitude", "url"]


def cell(value):
    # Spreadsheets run text that starts with = + - or @ as a formula; an apostrophe keeps it text.
    if isinstance(value, str) and value[:1] in ("=", "+", "-", "@", "\t", "\r"):
        return "'" + value
    return value


def get(params, tries=5):
    # 429 and 503 are retryable; the error body says how long to wait.
    for attempt in range(tries):
        r = requests.get(URL, headers=HEADERS, params=params, timeout=90)
        if r.status_code not in (429, 503) or attempt == tries - 1:
            r.raise_for_status()
            return r.json()["data"]
        wait = int(((r.json().get("error") or {}).get("details") or {}).get("retryAfter") or r.headers.get("Retry-After") or 5 * (attempt + 1))
        time.sleep(min(wait, 60))


def listings(region, status, max_pages):
    page = 1
    while page <= max_pages:
        data = get({"region": region, "status": status, "page": page})
        yield data, data["results"]
        if not data["has_more"]:
            break
        page = data["next_page"]


def main(regions, status="for_sale", max_pages=20, out="listings.csv"):
    seen = set()
    with open(out, "w", newline="", encoding="utf-8") as f:
        writer = csv.DictWriter(f, fieldnames=FIELDS)
        writer.writeheader()
        for region in regions.split(","):
            for data, rows in listings(region, status, int(max_pages)):
                if data["page"] == 1:
                    print(f"{region}: {data['total_results']} matches, {data['total_pages']} pages reachable")
                for home in rows:
                    if home["zpid"] not in seen:
                        seen.add(home["zpid"])
                        writer.writerow({k: cell(home.get(k)) for k in FIELDS})
    print(f"wrote {len(seen)} listings to {out}")


if __name__ == "__main__":
    main(*sys.argv[1:])

Run it with a ZIP code, a status, a page cap and a file name:

bash
export TOOLZERHUB_API_KEY=your_key
python zillow_to_csv.py 78704 for_sale 20 78704.csv

What came out

The run printed:

text
78704: 338 matches, 9 pages reachable
wrote 338 listings to 78704.csv

It took 17 seconds and 9 calls. The first two rows:

address price beds baths sq ft broker
1709 Brackenridge St, Austin, TX 78704 $1,645,000 4 3 2,301 AustinRealEstate.com
606 Josephine St, Austin, TX 78704 $2,250,000 4 3 2,483 Moreland Properties
  • The file is UTF-8 with a header row. If Excel shows accented characters wrongly, change encoding="utf-8" to "utf-8-sig".
  • The median asking price, leaving out the one $0 row, is $749,900. That row has status_text "Auction", so filter zeros before averaging.
  • 12 rows have no living_area and one has no bedrooms; drop them before working out price per square foot.
  • Rentals are not in search; use /v1/zillow/sitemap with family=for_rent. For one home's price and tax history, pass its zpid to /v1/zillow/history.

What it costs

Each search page is 1 credit for up to 41 listings, so 1,000 listings take about 25 credits. The 338-home export cost 9 credits. You get 100 free credits a month; $19 buys 10,000 credits that never expire, and plans for higher volume cover more ZIP codes. Set your key and your first ZIP code is a CSV in under a minute.

To compare this route with free Zillow scrapers, read best Zillow scrapers, tested on 10 homes. To log flight fares the same way, see the Skyscanner API post. For short-term rentals, see Airbnb listings and calendars as JSON. For Redfin, see Redfin listings as JSON.

We are not affiliated with Zillow.

Get this data from your own code

The Zillow API returns it as JSON with one x-api-key header. 100 free credits monthly.