Redfin documents no developer API. What it publishes is market data: medians and counts by area, as downloads. For individual for-sale listings as JSON, our Redfin API returns up to 1,000 homes for a ZIP code, city or neighborhood in one call.
What Redfin's Data Center is for
The Redfin Data Center publishes housing market data, updated weekly and monthly, for metros, states, cities, counties, neighborhoods and ZIP codes. The download is a filtered ZIP for the date range you choose. Its metrics are aggregates such as median sale price, pending sales, active listings and median days on market. It suits a market report, not a list of homes.
Redfin listings with ToolzerHub
We make ToolzerHub. Our Redfin API searches a region's for-sale listings with /v1/redfin/search, up to 1,000 homes per call, at 1 credit a call.
export TOOLZERHUB_API_KEY=your_key
curl -H "x-api-key: $TOOLZERHUB_API_KEY" \
"https://api.toolzerhub.com/v1/redfin/search?region=/zipcode/94110&num_homes=1000"
region is a Redfin region link or path, copied from the address bar: /zipcode/94110, /city/30818/TX/Austin or a neighborhood. San Francisco's 94110 returned 104 homes. The first one, trimmed:
{
"region": "/zipcode/94110",
"count": 104,
"results_may_be_capped": false,
"results": [{
"url": "https://www.redfin.com/CA/San-Francisco/2855-Folsom-St-94110/unit-A/home/175100230",
"mls_status": "Active",
"price": 2995000,
"price_per_sqft": 1308,
"beds": 3,
"baths": 3,
"sqft": 2290,
"year_built": 1902,
"days_on_market": 1,
"hoa": 918,
"is_new_construction": false
}]
}
There is no page 2. results_may_be_capped: true means the area holds more homes than you got. Each row also has the address, coordinates and the agent's description.
Export ZIP codes to CSV
The script takes Redfin region paths, asks for up to 1,000 homes in each and writes one row per home. For each region it prints the median price, price per square foot, new construction count and median days on market. Install requests (pip install requests) and save it as redfin_listings.py.
import csv
import os
import statistics
import sys
import time
import requests
URL = "https://api.toolzerhub.com/v1/redfin/search"
HEADERS = {"x-api-key": os.environ.get("TOOLZERHUB_API_KEY", "")}
FIELDS = ["region", "url", "mls_status", "price", "price_per_sqft", "beds", "baths", "sqft",
"year_built", "street", "city", "state", "zip", "days_on_market", "hoa",
"is_new_construction", "latitude", "longitude"]
def search(region, tries=3):
# Retry rate limits, server errors and dropped connections.
for attempt in range(tries):
last = attempt == tries - 1
try:
r = requests.get(URL, headers=HEADERS, params={"region": region, "num_homes": 1000}, timeout=120)
except requests.RequestException:
if last:
raise
time.sleep(5 * (attempt + 1))
continue
if r.status_code in (429, 500, 502, 503, 504) and not last:
time.sleep(5 * (attempt + 1))
continue
r.raise_for_status()
return r.json()["data"]
def median(rows, key):
values = [r[key] for r in rows if r.get(key) is not None]
return statistics.median(values) if values else None
def main(regions, out="redfin_listings.csv"):
with open(out, "w", newline="", encoding="utf-8") as f:
writer = csv.DictWriter(f, fieldnames=FIELDS, extrasaction="ignore")
writer.writeheader()
for region in filter(None, (r.strip() for r in regions.split(","))):
data = search(region)
homes = data["results"]
for h in homes:
writer.writerow({**h, "region": region})
days = [h["days_on_market"] for h in homes if h["days_on_market"] is not None]
new = sum(bool(h["is_new_construction"]) for h in homes)
print(f"{region}: {len(homes)} homes{' (capped)' if data['results_may_be_capped'] else ''}, "
f"median ${median(homes, 'price'):,.0f}, ${median(homes, 'price_per_sqft')}/sqft, "
f"{new} new construction, median {statistics.median(days) if days else '-'} days on market "
f"({len(homes) - len(days)} without)")
if __name__ == "__main__":
if len(sys.argv) < 2:
sys.exit('usage: python redfin_listings.py "/city/30818/TX/Austin,/zipcode/94110" [out.csv]')
if not HEADERS["x-api-key"]:
sys.exit("set TOOLZERHUB_API_KEY first")
main(*sys.argv[1:])
What 10 ZIP codes showed
Ten ZIP codes made 10 calls in 71 seconds and saved 2,705 homes:
python redfin_listings.py "/zipcode/78704,/zipcode/94110,/zipcode/33139,/zipcode/80205,/zipcode/02116,/zipcode/60614,/zipcode/98103,/zipcode/85004,/zipcode/37203,/zipcode/97201"
None hit the cap, so each row set is that ZIP's full for-sale inventory.
| ZIP | Area | Homes | Median price | Per sq ft | Median days on market |
|---|---|---|---|---|---|
| 78704 | Austin | 323 | $749,000 | $488.5 | 75 |
| 94110 | San Francisco | 104 | $1,474,000 | $880 | 34.5 |
| 33139 | Miami Beach | 990 | $535,000 | $709 | 106 |
| 80205 | Denver | 200 | $572,000 | $380 | 76 |
| 02116 | Boston | 157 | $2,200,000 | $1,352.5 | 55 |
| 60614 | Chicago | 128 | $994,450 | $499 | 34 |
| 98103 | Seattle | 240 | $749,500 | $543.5 | Not shown |
| 85004 | Phoenix | 52 | $514,000 | $362 | 73 |
| 37203 | Nashville | 381 | $675,000 | $609 | Not shown |
| 97201 | Portland | 130 | $499,900 | $309 | 126.5 |
Days on market is blank on 61 of 128 Chicago homes, 219 of 240 in Seattle and 367 of 381 in Nashville, so the last two medians would describe a handful of listings.
Query by ZIP for anything about the whole market. The same search for Austin, Miami, Denver, Boston and Chicago hit the 1,000 cap in each, and 90% of the returned homes had been listed for 42 days or fewer. In the eight full ZIP inventories with days on market, that figure ran from 170 to 593 days.
What it costs
A ZIP code is 1 credit, so a weekly pull of these 10 ZIPs is about 43 credits a month. The 100 free credits a month cover that; $19 buys 10,000 credits that never expire, and plans for higher volume cover daily pulls of a whole metro. Set your key and the first ZIP code is a CSV in under a minute.
For Zillow, see does Zillow have an API and Zillow search results to CSV.
We are not affiliated with Redfin.