Redfin Listing Search API (Async)
This endpoint will return the search results from a listing search page and transform it into usable JSON.
Single Query Request:
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import javax.net.ssl.HttpsURLConnection;
import java.net.URL;
import java.nio.charset.StandardCharsets;
public class Main {
public static void main(String[] args) {
try {
String apiKey = "API_KEY";
String jsonInputString = "{"
+ "\"apiKey\": \"" + apiKey + "\", "
+ "\"url\": \"URL\", "
+ "\"country_code\": \"COUNTRY_CODE\", "
+ "\"tld\": \"TLD\", "
+ "\"callback\": {"
+ " \"type\": \"webhook\", "
+ " \"url\": \"YYYYY\""
+ "}}";
URL url = new URL("https://async.scraperapi.com/structured/redfin/search");
HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
connection.setRequestMethod("POST");
connection.setRequestProperty("Content-Type", "application/json");
connection.setRequestProperty("Accept", "*/*");
connection.setDoOutput(true);
try (OutputStream os = connection.getOutputStream()) {
byte[] input = jsonInputString.getBytes(StandardCharsets.UTF_8);
os.write(input, 0, input.length);
}
int responseCode = connection.getResponseCode();
StringBuilder response = new StringBuilder();
BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
String readLine;
while ((readLine = in.readLine()) != null) {
response.append(readLine);
}
in.close();
if (responseCode == HttpURLConnection.HTTP_OK) {
System.out.println("Response: " + response.toString());
} else {
throw new Exception("Error in API Call: Response code " + responseCode + "\nbody: " + response.toString());
}
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
Multiple Query Request:
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import javax.net.ssl.HttpsURLConnection;
import java.net.URL;
import java.nio.charset.StandardCharsets;
public class Main {
public static void main(String[] args) {
try {
String apiKey = "API_KEY";
String jsonInputString = "{"
+ "\"apiKey\": \"" + apiKey + "\", "
+ "\"urls\": [\"URL1\", \"URL2\"], "
+ "\"country_code\": \"COUNTRY_CODE\", "
+ "\"tld\": \"TLD\", "
+ "\"callback\": {"
+ " \"type\": \"webhook\", "
+ " \"url\": \"CALLBACK\""
+ "}}";
URL url = new URL("https://async.scraperapi.com/structured/redfin/search");
HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
connection.setRequestMethod("POST");
connection.setRequestProperty("Content-Type", "application/json");
connection.setRequestProperty("Accept", "*/*");
connection.setDoOutput(true);
try (OutputStream os = connection.getOutputStream()) {
byte[] input = jsonInputString.getBytes(StandardCharsets.UTF_8);
os.write(input, 0, input.length);
}
int responseCode = connection.getResponseCode();
StringBuilder response = new StringBuilder();
BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
String readLine;
while ((readLine = in.readLine()) != null) {
response.append(readLine);
}
in.close();
if (responseCode == HttpURLConnection.HTTP_OK) {
System.out.println("Response: " + response.toString());
} else {
throw new Exception("Error in API Call: Response code " + responseCode + "\nbody: " + response.toString());
}
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
Parameters
Details
API_KEY
(required)
User's API Key.
URL
(required)
The URL of the Redfin search page. The URL has to be a Redfin Search page.
country_code
Allows you to geotarget the request. Use this parameter if you want Redfin to be scraped from a specific country.
TLD
Sample Response
For single query requests:
{
"id": "c9ef64da-ed35-4848-a542-d893815a5d02",
"attempts": 0,
"status": "running",
"statusUrl": "https://async.scraperapi.com/jobs/c9ef64da-ed35-4848-a542-d893815a5d02",
"url": "https://www.redfin.com/city/1826/MA/Boston/filter/min-beds=3,min-baths=2",
"supposedToRunAt": "2025-02-17T15:19:56.772Z"
}
For multiple query requests:
[
{
"id": "d5242953-7d1f-4cba-abf7-4d74a9afe9a3",
"attempts": 0,
"status": "running",
"statusUrl": "https://async.scraperapi.com/jobs/d5242953-7d1f-4cba-abf7-4d74a9afe9a3",
"url": "https://www.redfin.com/city/1826/MA/Boston/filter/min-beds=3,min-baths=2"
},
{
"id": "4f23b759-2939-47c1-9821-4e3218bc9d37",
"attempts": 0,
"status": "running",
"statusUrl": "https://async.scraperapi.com/jobs/4f23b759-2939-47c1-9821-4e3218bc9d37",
"url": "https://www.redfin.com/city/10201/NV/Las-Vegas/filter/min-beds=2,min-baths=1"
}
]
Last updated
Was this helpful?