Skip to content

realtyapi/Redfin-Scraper-API-Python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Redfin Scraper API - Python

A powerful Python scraper for extracting real estate data from Redfin. Search properties, get detailed listings, AVM estimates, walk scores, flood risk data, agent info, and more using the Redfin Scraper API by RealtyAPI.

Features

  • Property Search - Search by location, coordinates, polygon, region ID, or Redfin URL with 50+ filters
  • Property Details - Get full property data by address, property ID, or Redfin URL
  • AVM Estimates - Automated Valuation Model (home value estimates)
  • Walk/Transit/Bike Scores - Walkability, transit, and bikeability ratings
  • Flood Risk Data - FEMA flood zone and risk assessment
  • Agent Info - Listing agent details for any property
  • Amenities - Full amenity breakdown
  • Mortgage Calculator - Payment estimates and mortgage data
  • Market Insights - Hot market indicators, popularity metrics
  • Price Drop Tracking - Price reduction history
  • Tour Data - Tour insights and scheduling availability
  • Autocomplete - Location search suggestions
  • Bulk Mode - Process hundreds of properties from input.json with progress tracking
  • Export to JSON or CSV - Save results in your preferred format

Quick Start

1. Get Your API Key

Sign up at realtyapi.io to get your API key.

2. Install

git clone https://github.com/realtyapi/redfin-scraper-python.git
cd redfin-scraper-python
pip install -r requirements.txt

3. Run the Interactive Scraper

python scraper.py

The scraper will prompt you for your API key on first run and save it for future use.

4. Or Use the API Directly in Your Code

import requests

url = "https://redfin.realtyapi.io/detailsbyaddress"

params = {
    "property_address": "166 W 22nd St Unit 1D, New York, NY 10011"
}

headers = {
    "x-realtyapi-key": "YOUR_API_KEY"
}

response = requests.get(url, headers=headers, params=params)
print(response.json())

Usage Examples

Search by Location

from redfin_api import RedfinAPI

api = RedfinAPI("YOUR_API_KEY")

data = api.search_by_location(
    location_name="New York",
    search_type="For_Sale",
    sort_order="Newest",
    min_beds="Two",
    baths="OnePlus",
    min_price="500000",
    max_price="2000000",
    home_type="House,Condo",
    page=1,
)
print(data)

Search Rentals

data = api.search_by_location(
    location_name="Los Angeles, CA",
    search_type="For_Rent",
    sort_order="Price_Low_to_High",
    home_type="Apartment",
)
print(data)

Search Recently Sold Homes

data = api.search_by_location(
    location_name="Miami, FL",
    search_type="Sold",
    sold_within="Last_1_Month",
    sort_order="Most_Recently_Sold",
)
print(data)

Search by Coordinates

data = api.search_by_coordinates(
    latitude="40.748817",
    longitude="-73.985428",
    radius="1.5",
    search_type="For_Sale",
    result_count=50,
)
print(data)

Search by Redfin URL

data = api.search_by_url(
    search_url="https://www.redfin.com/zipcode/10002/filter/property-type=house,min-price=150k",
    result_count=50,
)
print(data)

Search by Region ID

data = api.search_by_region_id(
    region_id="4_3244",
    search_type="For_Sale",
)
print(data)

Property Details by Address

data = api.get_details_by_address("166 W 22nd St Unit 1D, New York, NY 10011")
print(data)

Property Details by ID

data = api.get_details_by_id(
    property_id="20739181",
    listing_id="192575318",
)
print(data)

Property Details by URL

data = api.get_details_by_url(
    "https://www.redfin.com/NY/Saint-Albans/10970-203rd-St-11412/home/20739181"
)
print(data)

AVM Estimate (Home Valuation)

data = api.get_avm_estimate("13543215", "207197529")
print(data)

Walk, Transit & Bike Scores

data = api.get_walk_score("13543215", "207197529")
print(data)

Flood Risk Information

data = api.get_flood_info(
    fips_code="36081",
    apn="4109420115",
    lat="40.7059662",
    lng="-73.754585",
)
print(data)

Agent Info

data = api.get_agent_info("20739181", "192575318")
print(data)

Amenities

data = api.get_amenities("13543215", "207197529")
print(data)

Mortgage Calculator

data = api.get_mortgage_calculator("13543215", "207197529")
print(data)

Property Overview

data = api.get_overview("20739181", "192575318")
print(data)

Property Insights

data = api.get_insights("20739181", "192575318")
print(data)

Hot Market Info

data = api.get_hot_market_info("13543215")
print(data)

Price Drop Info

data = api.get_price_drop_info("207197529")
print(data)

Basic Details (Get IDs from URL)

# Useful for getting property_id and listing_id from a Redfin URL
data = api.get_basic_details(
    "https://www.redfin.com/NY/Hollis/9452-199th-St-11423/home/13543215"
)
print(data)

Autocomplete

data = api.autocomplete("Texas")
print(data)

Scraper Modes

Every scraper option supports two modes:

Test Mode (Single Input)

Enter one input manually. The scraper shows a preview (first 1000 characters) of the response, then asks if you want to save the full output as JSON or CSV.

Bulk Mode (from input.json)

Process hundreds of inputs automatically. The scraper reads from input.json, runs each request one by one, shows a progress bar, and saves all results at the end.

  [========================------] 80% (8/10) 166 W 22nd St Unit 1D, New York

Bulk Mode - input.json Format

  1. Copy input_sample.json to input.json
  2. Fill in only the sections you need
  3. Run python scraper.py, pick your operation, then select "Bulk run"

input.json Structure

{
  "property_addresses": [
    "166 W 22nd St Unit 1D, New York, NY 10011"
  ],

  "property_ids": [
    {"property_id": "20739181", "listing_id": "192575318"}
  ],

  "property_urls": [
    "https://www.redfin.com/NY/Saint-Albans/10970-203rd-St-11412/home/20739181"
  ],

  "listing_ids": ["192575318"],

  "property_id_only": ["20739181"],

  "search_locations": [
    {
      "location": "New York",
      "search_type": "For_Sale",
      "sort_order": "Newest",
      "min_beds": "Two",
      "min_price": "500000",
      "max_price": "2000000"
    },
    "Austin, TX"
  ],

  "search_coordinates": [
    {"latitude": "40.748817", "longitude": "-73.985428", "radius": "1.5", "search_type": "For_Sale"}
  ],

  "search_urls": [
    "https://www.redfin.com/zipcode/10002/filter/property-type=house"
  ],

  "search_region_ids": ["4_3244"],

  "autocomplete_queries": ["Texas", "New York"],

  "flood_queries": [
    {"fips_code": "36081", "apn": "4109420115", "lat": "40.7059662", "lng": "-73.754585"}
  ]
}

Output Formats

Option Format Best for
1 JSON (.json) Full nested data, programmatic access
2 CSV (.csv) Spreadsheets, Excel, data analysis
3 Both Keep JSON for detail + CSV for quick review

All output is saved to the output/ directory.

API Configuration

Option 1: Environment Variable

export REALTYAPI_KEY=rt_your_key_here
python scraper.py

Option 2: Config File

The scraper saves your key to config.json on first run. You can also create it manually:

{
  "api_key": "rt_your_key_here"
}

Option 3: Direct in Code

from redfin_api import RedfinAPI
api = RedfinAPI("rt_your_key_here")

Search Filter Reference

Search Type

Value Description
For_Sale Active for-sale listings
For_Rent Active rental listings
Sold Recently sold properties

Sort Order

Value Description
Recommended Redfin's default sort
Newest Most recently listed
Oldest Oldest listings
Most_Recently_Sold For Sold searches
Price_High_to_Low Highest price first
Price_Low_to_High Lowest price first
Square_Feet Largest first
Lot_Size Largest lot first
Price_per_Sqft Price per sqft
Beds Most bedrooms
Baths Most bathrooms

Bedrooms (minBeds / maxBeds)

Any, Studio, One, Two, Three, Four, FivePlus, SixPlus

Bathrooms

Any, OnePlus, OnePointFivePlus, Two, TwoPointFivePlus, ThreePlus, FourPlus, FivePlus, SixPlus

Home Type

House, Condo, Townhouse, Multi family, Land, Other, Mobile, Co-op, Apartment

Listing Status

Active_ComingSoon, Active, ComingSoon, UnderContractOrPending, Active_UnderContractOrPending, Active_ComingSoon_UnderContract

Time on Redfin

Any, New_listings, Less_than_3d, Less_than_7d, Less_than_14d, Less_than_30d, More_than_7d, More_than_14d, More_than_30d, More_than_45d, More_than_60d, More_than_90d, More_than_180d

Sold Within

Last_7_Days, Last_1_Month, Last_3_Months, Last_6_Months, Last_1_Year, Last_2_Years, Last_3_Years, Last_5_Years

Pool Types

None, Private, Community, Private_or_Community, No_private_pool

Garage Spots

No_Min, 1plus, 2plus, 3plus, 4plus, 5plus

Walk/Transit/Bike Score

Any, 10plus, 20plus, 30plus, 40plus, 50plus, 60plus, 70plus, 80plus, 90plus

Great Schools Rating

Any, 1plus, 2plus, 3plus, 4plus, 5plus, 6plus, 7plus, 8plus, 9plus, 10

Accepted Financing

Any, FHA, VA

All Available Endpoints

Category Endpoint Description
Search /search/bylocation Search by city/state/ZIP (50+ filters)
Search /search/bycoordinates Circle search by lat/lng/radius
Search /search/bypolygon Search by polygon coordinates
Search /search/byregionid Search by Redfin region ID
Search /search/byurl Search by Redfin URL
Search /autocomplete Location autocomplete
Details /detailsbyaddress Full details by address
Details /detailsbyid Full details by property + listing ID
Details /detailsbyurl Full details by Redfin URL
Individual /agentInfo Listing agent details
Individual /amenities Property amenities
Individual /avm AVM home valuation
Individual /basicDetails Basic info from URL (get IDs)
Individual /customerConversionInfo Conversion data
Individual /floodInfo Flood risk assessment
Individual /getDatePickerData Tour scheduling dates
Individual /hotMarketInfo Market heat indicators
Individual /insights Property insights
Individual /mainHouseInfoPanelInfo Main house info panel
Individual /mortgageCalculatorInfo Mortgage estimates
Individual /overview Property overview
Individual /popularityInfo Listing popularity
Individual /priceDropInfo Price reduction history
Individual /tourInsights Tour insight data
Individual /walkScore Walk/transit/bike scores

File Structure

redfin-scraper/
├── scraper.py          # Interactive CLI (test one or bulk run)
├── redfin_api.py       # Redfin API client library (25 endpoints)
├── config.py           # API key management
├── examples.py         # Code examples for every endpoint
├── input_sample.json   # Template for bulk input (copy to input.json)
├── input.json          # Your bulk input data (gitignored)
├── requirements.txt    # Python dependencies
├── config.json         # Your API key (auto-created, gitignored)
├── output/             # Saved JSON/CSV outputs (auto-created)
└── README.md           # This file

Requirements

  • Python 3.7+
  • requests library

Get Your API Key

Sign up at realtyapi.io to get your Redfin Scraper API key.

Related APIs

RealtyAPI also offers scraper APIs for:

License

MIT


Keywords: redfin scraper, redfin api, redfin data scraper, redfin property data, redfin scraper python, redfin listing scraper, redfin real estate api, scrape redfin, redfin scraping tool, redfin api python, redfin property scraper, redfin home data api, redfin estimate api, redfin avm api, redfin search api, redfin agent api, redfin walk score api, redfin rental data, redfin sold homes data, redfin market data, redfin flood risk, real estate scraper, real estate api, property data api, housing data api, mls data api, property scraper python, real estate data extraction, redfin automation, redfin data mining, redfin web scraper, redfin crawler, redfin property lookup, redfin comparable homes, redfin mortgage calculator, redfin price history, redfin home valuation, realtyapi, realty api

About

Redfin Scraper API in Python. Use this to get Redfin data saved to Json/Csv/Excel.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages