Redfin 'For Sale' Listings API

Scrape Redfin For Sale pages in structured JSON/CSV with ScraperAPI in Java. Supports URL, country code, TLD, and raw data extraction for flexible scraping.

This endpoint will retrieve listing information from a single 'For Sale' property listing page and transform it into usable JSON.

try {
String apiKey = "API_KEY";
String urlString = "URL";
String country_code = "COUNTRY_CODE";
String tld = "TLD";
String raw = "RAW";
String url = "https://api.scraperapi.com/structured/redfin/forsale?api_key=" + apiKey + "&url=" + urlString + "&country_code=" + country_code + "&tld=" + tld + "&raw=" + raw;
URL urlForGetRequest = new URL(url);
String readLine = null;
HttpURLConnection conection = (HttpURLConnection) urlForGetRequest.openConnection();
conection.setRequestMethod("GET");
int responseCode = conection.getResponseCode();
if (responseCode == HttpURLConnection.HTTP_OK) {
BufferedReader in = new BufferedReader(new InputStreamReader(conection.getInputStream()));
StringBuffer response = new StringBuffer();
while ((readLine = in.readLine()) != null) {
response.append(readLine);
}
in.close();
System.out.println(response.toString());
} else {
throw new Exception("Error in API Call");
}
} catch (Exception ex) {
ex.printStackTrace();
}

Parameters
Details

API_KEY (required)

User's API Key.

URL (required)

The URL of the Redfin page. The URL has to be the URL of a property for sale.

country_code

Allows you to geotarget the request. Use this parameter if you want Redfin to be scraped from a specific country.

TLD

The top level domain to scrape.

Valid options:

com’ (for redfin.com)

ca’ (for redfin.ca)

raw

This is a boolean param - true or false

If the raw parameter is set to true, the raw data will be extracted from the page without further parsing.

Important: The structure of the data in raw mode cannot be guaranteed, it’s a tradeoff: You get a lot more information back, but the structure of the response may change if Redfin modifies their page layout.

Sample Response

Last updated

Was this helpful?