# Redfin Listing Search API

The `Redfin Listing Search API` endpoint will return the search results from a listing search page and transform it into usable JSON.

{% tabs %}
{% tab title="cURL" %}

```bash
curl --request GET \
--url "https://api.scraperapi.com/structured/redfin/search?api_key=API_KEY&\
url=URL&country_code=COUNTRY_CODE&tld=TLD"
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

payload = {
    'api_key': 'API_KEY',
    'url': 'URL',
    'country_code': 'COUNTRY_CODE',
    'tld': 'TLD'
}

r = requests.get('https://api.scraperapi.com/structured/redfin/search',params=payload)

print(r.text)
```

{% endtab %}

{% tab title="NodeJS" %}

```javascript
import fetch from 'node-fetch';

fetch(
  'https://api.scraperapi.com/structured/redfin/search?api_key=API_KEY&url=URL&country_code=COUNTRY_CODE&tld=TLD'
)
  .then(response => response.json()) 
  .then(data => {
    console.log(data);
  })
  .catch(error => {
    console.error(error);
  });
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
$url = "https://api.scraperapi.com/structured/redfin/search?api_key=API_KEY&url=URL&country_code=COUNTRY_CODE&tld=TLD";

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_HEADER, FALSE);

$response = curl_exec($ch);
curl_close($ch);

print_r($response);
```

{% endtab %}

{% tab title="Ruby" %}

```ruby
require 'net/http'
require 'json'

params = {
  :api_key => "API_KEY",
  :url => "URL",
  :country_code => "COUNTRY_CODE",
  :tld => "TLD"
}

uri = URI('https://api.scraperapi.com/structured/redfin/search')
uri.query = URI.encode_www_form(params)

website_content = Net::HTTP.get(uri)
print(website_content)
```

{% endtab %}

{% tab title="Java" %}

```java
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;

public class Main {
    public static void main(String[] args) {
        try {
            String apiKey = "API_KEY";
            String url = "URL";
            String country_code = "COUNTRY_CODE";
            String tld = "TLD";

            String urlStr = "https://api.scraperapi.com/structured/redfin/search?api_key=" 
                            + apiKey + "&url=" + url + "&country_code=" + country_code + "&tld=" + tld;

            URL url = new URL(urlStr);
            HttpURLConnection conn = (HttpURLConnection) url.openConnection();
            conn.setRequestMethod("GET");

            int responseCode = conn.getResponseCode();
            if (responseCode == HttpURLConnection.HTTP_OK) {
                BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
                StringBuilder response = new StringBuilder();
                String line;
                while ((line = in.readLine()) != null) {
                    response.append(line);
                }
                in.close();
                System.out.println(response.toString());
            } else {
                System.out.println("Error in API Call. Response code: " + responseCode);
            }

        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }
}
```

{% endtab %}
{% endtabs %}

**Supported Parameters**

<table><thead><tr><th width="326">Parameters</th><th>Details</th></tr></thead><tbody><tr><td><code>API_KEY</code> (required)</td><td>Your API Key.</td></tr><tr><td><code>URL</code> (required)</td><td>The URL of the Redfin search page. The URL has to be a Redfin Search page.</td></tr><tr><td><code>country_code</code></td><td>Allows you to geotarget the request. Use this parameter if you want Redfin to be scraped from a specific country.</td></tr><tr><td><code>TLD</code></td><td><p>The top level domain to scrape. </p><p></p><p>Valid options: </p><p>‘<code>com</code>’ (for <a href="http://redfin.com/">redfin.com</a>)</p><p>‘<code>ca</code>’ (for <a href="https://www.redfin.ca/">redfin.ca</a>)</p></td></tr></tbody></table>

## Sample Response

<details>

<summary>Response.json</summary>

```json
{
  "url": "https://www.redfin.com/city/1826/MA/Boston/filter/min-beds=3,min-baths=2",
  "type": "search_for_sale",
  "listing": [
    {
      "address": "370 Beacon St #3, Boston, MA 02116",
      "phone": "",
      "number_beds": "3 beds",
      "number_baths": "4 baths",
      "sq_ft": "3,300 sq ft",
      "thumbnail_img_url": "https://ssl.cdn-redfin.com/system_files/media/1045768_JPG/genDesktopMapHomeCardUrl/item_29.jpg",
      "price": [
        {
          "cost": 5899000,
          "currency": "USD",
          "charge-rate": "one-time",
          "deal": ""
        }
      ],
      "badge": [
        "LISTED BY REDFIN",
        "3D WALKTHROUGH"
      ],
      "key_facts": [
        "$6,557 HOA",
        "Community pool",
        "Walker's paradise"
      ],
      "badge_sold": ""
    },
    {
      "address": "74 Green St, Boston, MA 02130",
      "phone": "",
      "number_beds": "4 beds",
      "number_baths": "3.5 baths",
      "sq_ft": "6,200 sq ft",
      "thumbnail_img_url": "https://ssl.cdn-redfin.com/photo/52/islphoto/722/genIslnoResize.73335722_0.jpg",
      "price": [
        {
          "cost": 1850000,
          "currency": "USD",
          "charge-rate": "one-time",
          "deal": ""
        }
      ],
      "badge": [
        "NEW 59 MINS AGO"
      ],
      "key_facts": [
        "4,160 sq ft lot",
        "3 garage spots",
        "Walker's paradise"
      ],
      "badge_sold": ""
    },
    {
      "address": "",
      "phone": "",
      "number_beds": "",
      "number_baths": "",
      "sq_ft": "",
      "price": [],
      "badge": [],
      "key_facts": [],
      "badge_sold": ""
    },
    {
      "address": "16 Lawrence St #2, Boston, MA 02129",
      "phone": "",
      "number_beds": "4 beds",
      "number_baths": "3.5 baths",
      "sq_ft": "2,298 sq ft",
      "thumbnail_img_url": "https://ssl.cdn-redfin.com/photo/52/islphoto/654/genIslnoResize.73335654_0.jpg",
      "price": [
        {
          "cost": 1895000,
          "currency": "USD",
          "charge-rate": "one-time",
          "deal": ""
        }
      ],
      "badge": [
        "OPEN SUN, 12PM TO 1:30PM"
      ],
      "key_facts": [
        "$250 HOA",
        "Walker's paradise"
      ],
      "badge_sold": ""
    },
    {
      "address": "5 Oakhurst St #2, Boston, MA 02124",
      "phone": "",
      "number_beds": "4 beds",
      "number_baths": "2 baths",
      "sq_ft": "1,597 sq ft",
      "thumbnail_img_url": "https://ssl.cdn-redfin.com/photo/52/islphoto/599/genIslnoResize.73335599_0.jpg",
      "price": [
        {
          "cost": 549900,
          "currency": "USD",
          "charge-rate": "one-time",
          "deal": ""
        }
      ],
      "badge": [],
      "key_facts": [
        "$275 HOA",
        "2 garage spots",
        "Somewhat walkable"
      ],
      "badge_sold": ""
    },
    {
      "address": "38 Montgomery St, Boston, MA 02116",
      "phone": "",
      "number_beds": "4 beds",
      "number_baths": "3 baths",
      "sq_ft": "3,061 sq ft",
      "thumbnail_img_url": "https://ssl.cdn-redfin.com/photo/52/islphoto/575/genIslnoResize.73335575_0.jpg",
      "price": [
        {
          "cost": 3295000,
          "currency": "USD",
          "charge-rate": "one-time",
          "deal": ""
        }
      ],
      "badge": [],
      "key_facts": [
        "Walker's paradise"
      ],
      "badge_sold": ""
    },
    {
      "address": "352 Marlborough St, Boston, MA 02115",
      "phone": "",
      "number_beds": "4 beds",
      "number_baths": "5.5 baths",
      "sq_ft": "4,754 sq ft",
      "thumbnail_img_url": "https://ssl.cdn-redfin.com/photo/52/islphoto/458/genIslnoResize.73335458_1.jpg",
      "price": [
        {
          "cost": 9450000,
          "currency": "USD",
          "charge-rate": "one-time",
          "deal": ""
        }
      ],
      "badge": [
        "OPEN SAT, 10:30AM TO 12:30PM",
        "VIDEO TOUR"
      ],
      "key_facts": [
        "2,576 sq ft lot",
        "Walker's paradise"
      ],
      "badge_sold": ""
    },
    {
      "address": "21 Goldfinch Ct #21, Boston, MA 02126",
      "phone": "",
      "number_beds": "3 beds",
      "number_baths": "2 baths",
      "sq_ft": "1,270 sq ft",
      "thumbnail_img_url": "https://ssl.cdn-redfin.com/photo/52/islphoto/448/genIslnoResize.73335448_0.jpg",
      "price": [
        {
          "cost": 599000,
          "currency": "USD",
          "charge-rate": "one-time",
          "deal": ""
        }
      ],
      "badge": [],
      "key_facts": [
        "$455 HOA",
        "Car-dependent"
      ],
      "badge_sold": ""
    },
    {
      "address": "252 Aspinwall Ave, Brookline, MA 02445",
      "phone": "",
      "number_beds": "9 beds",
      "number_baths": "2 baths",
      "sq_ft": "4,566 sq ft",
      "thumbnail_img_url": "https://ssl.cdn-redfin.com/photo/52/islphoto/417/genIslnoResize.73335417_0.jpg",
      "price": [
        {
          "cost": 2300000,
          "currency": "USD",
          "charge-rate": "one-time",
          "deal": ""
        }
      ],
      "badge": [],
      "key_facts": [
        "4,435 sq ft lot",
        "Very walkable"
      ],
      "badge_sold": ""
    },
    {
      "address": "29 E Cottage, Boston, MA 02125",
      "phone": "",
      "number_beds": "7 beds",
      "number_baths": "3 baths",
      "sq_ft": "2,832 sq ft",
      "thumbnail_img_url": "https://ssl.cdn-redfin.com/photo/52/islphoto/379/genIslnoResize.73335379_0.jpg",
      "price": [
        {
          "cost": 1050000,
          "currency": "USD",
          "charge-rate": "one-time",
          "deal": ""
        }
      ],
      "badge": [],
      "key_facts": [
        "3,717 sq ft lot",
        "Very walkable"
      ],
      "badge_sold": ""
    },
    {
      "address": "79 Parkton Rd #1, Boston, MA 02130",
      "phone": "",
      "number_beds": "3 beds",
      "number_baths": "2 baths",
      "sq_ft": "1,033 sq ft",
      "thumbnail_img_url": "https://ssl.cdn-redfin.com/photo/52/islphoto/309/genIslnoResize.73335309_0.jpg",
      "price": [
        {
          "cost": 749900,
          "currency": "USD",
          "charge-rate": "one-time",
          "deal": ""
        }
      ],
      "badge": [],
      "key_facts": [
        "$215 HOA",
        "Very walkable"
      ],
      "badge_sold": ""
    },
    {
      "address": "39 Juliette St #3, Boston, MA 02122",
      "phone": "",
      "number_beds": "3 beds",
      "number_baths": "3 baths",
      "sq_ft": "1,386 sq ft",
      "thumbnail_img_url": "https://ssl.cdn-redfin.com/photo/52/islphoto/296/genIslnoResize.73335296_0.jpg",
      "price": [
        {
          "cost": 730000,
          "currency": "USD",
          "charge-rate": "one-time",
          "deal": ""
        }
      ],
      "badge": [],
      "key_facts": [
        "1,386 sq ft lot",
        "$250 HOA",
        "Garage"
      ],
      "badge_sold": ""
    },
    {
      "address": "38 Kappius Path, Newton, MA 02459",
      "phone": "",
      "number_beds": "6 beds",
      "number_baths": "6.5 baths",
      "sq_ft": "5,500 sq ft",
      "thumbnail_img_url": "https://ssl.cdn-redfin.com/photo/52/islphoto/226/genIslnoResize.73335226_0.jpg",
      "price": [
        {
          "cost": 2795000,
          "currency": "USD",
          "charge-rate": "one-time",
          "deal": ""
        }
      ],
      "badge": [],
      "key_facts": [
        "7,000 sq ft lot",
        "2 garage spots",
        "Car-dependent"
      ],
      "badge_sold": ""
    },
    {
      "address": "10 Briarcliff Ter, Boston, MA 02126",
      "phone": "",
      "number_beds": "4 beds",
      "number_baths": "3 baths",
      "sq_ft": "1,756 sq ft",
      "thumbnail_img_url": "https://ssl.cdn-redfin.com/photo/52/islphoto/057/genIslnoResize.73335057_0.jpg",
      "price": [
        {
          "cost": 580000,
          "currency": "USD",
          "charge-rate": "one-time",
          "deal": ""
        }
      ],
      "badge": [],
      "key_facts": [
        "0.32 acre lot",
        "Car-dependent"
      ],
      "badge_sold": ""
    },
    {
      "address": "17 Thompson St, Boston, MA 02136",
      "phone": "",
      "number_beds": "4 beds",
      "number_baths": "2.5 baths",
      "sq_ft": "1,860 sq ft",
      "thumbnail_img_url": "https://ssl.cdn-redfin.com/photo/52/islphoto/015/genIslnoResize.73335015_1.jpg",
      "price": [
        {
          "cost": 899000,
          "currency": "USD",
          "charge-rate": "one-time",
          "deal": ""
        }
      ],
      "badge": [],
      "key_facts": [
        "6,250 sq ft lot",
        "Community pool",
        "Somewhat walkable"
      ],
      "badge_sold": ""
    },
  ]
}
.......................................................
```

</details>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.scraperapi.com/structured-data-endpoints/real-estate/redfin/redfin-listing-search-api.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
