# Redfin 'For Sale' Listings API

The `Redfin 'For Sale' Listings API` endpoint will retrieve listing information from a single 'For Sale' property listing page and transform it into usable JSON.

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

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

{% endtab %}

{% tab title="Python" %}

```python
import requests

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

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

print(r.text)
```

{% endtab %}

{% tab title="NodeJS" %}

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

fetch(
  'https://api.scraperapi.com/structured/redfin/forsale?api_key=API_KEY&url=URL&country_code=COUNTRY_CODE&tld=TLD&raw=RAW'
)
  .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/forsale?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",
  :raw => "RAW"
}

uri = URI('https://api.scraperapi.com/structured/redfin/forsale')
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 raw = "RAW";

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

            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 page. The URL has to be the URL of a property for sale.</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><tr><td><code>raw</code></td><td><p>This is a boolean param - <code>true</code> or <code>false</code></p><p></p><p>If the <code>raw</code> parameter is set to <code>true</code>, the raw data will be extracted from the page without further parsing. </p><p></p><p><strong><code>Important:</code></strong> 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 <strong><code>Redfin</code></strong> modifies their page layout.</p></td></tr></tbody></table>

## Sample Response

```json
{
  "url": "https://redfin.com/NH/Salem/1-Chestnut-Dr-03079/home/96531263",
  "type": "for_sale",
  "image_urls": [
    "https://ssl.cdn-redfin.com/photo/154/bigphoto/196/5023196_0.jpg",
    "https://ssl.cdn-redfin.com/photo/154/bigphoto/196/5023196_1_0.jpg",
    ...
  ],
  "price": 899900,
  "currency": "$",
  "sq_ft": 2928,
  "price_per_sq_ft": 307,
  "latitude": 42.755854,
  "longitude": -71.2134495,
  "beds": 4,
  "baths": 2.5,
  "url_map": "https://maps.google.com/maps/api/staticmap?sensor=false&style=feature%3Aadministrative.land_parcel%7Cvisibility%3Aoff&style=feature%3Alandscape.man_made%7Cvisibility%3Aoff&style=feature%3Atransit.station%7Chue%3A0xffa200&center=42.755854%2C-71.2134495&channel=desktop_xdp_above_fold_static_preview&size=200x200&scale=1&format=jpg&zoom=11&client=gme-redfin&signature=UOuXHmn2QMUheU2YnGaziirBk9w=",
  "description": "Welcome to this pristine four-bedroom Colonial situated in a desirable cul-de-sac neighborhood. Thoughtfully cared for and updated this home offers a functional and welcoming layout featuring spacious rooms, hardwood floors throughout and plenty of natural light. The chef&rsquo;s kitchen is the heart of the home with high-end stainless steel appliances, a 5 burner gas cooktop, custom cabinetry and a large quartz-topped island perfect for meal prep or casual dining. The main level also includes a comfortable living room a formal dining room for hosting and a cozy family room with a gas fireplace that&rsquo;s perfect for gathering. Upstairs the primary suite offers a peaceful retreat with a private en-suite bath and walk-in closet. Three additional bedrooms provide flexibility for family, guests or a home office. Outside the backyard is ideal for relaxing or entertaining with a well-maintained lawn and a deck that&rsquo;s r
  "address": "1 Chestnut Dr, Salem, NH 03079",
  "active": true,
  "agents": [
    {
      "name": "Caroleann M. Ohannessian",
      "broker_name": "RE/MAX Innovative Properties"
    }
  ],
  "amenities": {
    "stories": "2",
    "community": "Salem",
    "county": "Rockingham",
    "mls": "5023196",
    "built": "Built in 2002",
    "lot_size": "0.58 acres",
    "property_type": "Single-family",
    "heating_cooling": "Has A/C",
    "parking": "2 garage spaces"
  },
  "year_built": 2002,
  "property_type": "Single Family Residential",
  "schools": [
    {
      "name": "Dr. L. F. Soule School",
      "address": "173 S Policy St, Salem, NH 03079",
      "url": "http://redfin.com/school/135289/NH/Salem/Dr-L-F-Soule-School",
      "review_count": 3,
      "great_schools_rating": 4,
      "great_school_url": "https://www.greatschools.org/new-hampshire/salem/434-Dr.-L.-F.-Soule-School/",
      "parent_rating": 4,
      "distance_in_miles": "0.8",
      "grade_ranges": "K-5",
      "institution_type": "Public",
      "number_of_students": 249,
      "student_to_teacher_ratio": 11
    },
    {
      "name": "Woodbury School",
      "address": "206 Main St, Salem, NH 03079",
      "url": "http://redfin.com/school/136522/NH/Salem/Woodbury-School",
      "review_count": 3,
      "great_schools_rating": 5,
      "great_school_url": "https://www.greatschools.org/new-hampshire/salem/439-Woodbury-School/",
      "parent_rating": 2,
      "distance_in_miles": "1.9",
      "grade_ranges": "6-8",
      "institution_type": "Public",
      "number_of_students": 799,
      "student_to_teacher_ratio": 14
    },
    {
      "name": "Salem High School",
      "address": "44 Geremonty Dr, Salem, NH 03079",
      "url": "http://redfin.com/school/135508/NH/Salem/Salem-High-School",
      "review_count": 2,
      "great_schools_rating": 5,
      "great_school_url": "https://www.greatschools.org/new-hampshire/salem/438-Salem-High-School/",
      "parent_rating": 5,
      "distance_in_miles": "1.7",
      "grade_ranges": "9-12",
      "institution_type": "Public",
      "number_of_students": 1131,
      "student_to_teacher_ratio": 11
    }
  ],
  "similar_homes": [
    {
      "remarks": "Discover unparalleled luxury in this exquisite 4-bedroom, 3.5-bath estate overlooking Campbell's Scottish Highlands Golf Course. This masterpiece blends contemporary sophistication with timeless elegance. Enter the stately foyer into a world of refinement. To your right, an elegant dining room with wainscoting and tray ceiling awaits. Across, find a well-appointed office with tiled floor and an expansive window. The great room impresses with the first of two fireplaces, rich hardwood floors, and soaring vaulted ceilings, perfect for entertaining. From there, you head to the four seasons room which boasts the second stone gas fireplace and scenic views. Indulge your culinary passions in the c",
      "url": "http://redfin.com/NH/Salem/43-Ticklefancy-Ln-03079/home/60349931",
      "price": 1275000,
      "sq_ft": 5188,
      "beds": 4,
      "baths": 3.5,
      "stories": 1
    }
  ],
  "walk_score": 62,
  "bike_score": 37,
  "nearby_places": [
    {
      "name": "99 Restaurants",
      "address": "149 S Broadway, Salem, NH, 03079, us",
      "latitude": 42.76888656616211,
      "longitude": -71.21973419189453,
      "popularity": 0.5199999809265137,
      "phone_number": "(603) 893-5596",
      "website": "http://www.99restaurants.com/",
      "categories": [
        "Bar"
      ],
      "distance": 0.9563021208779819
    },
    {
      "name": "Peppers Pub",
      "address": "326 S Broadway, Salem, NH, 03079, us",
      "latitude": 42.75418472290039,
      "longitude": -71.20906066894531,
      "popularity": 0.10000000149011612,
      "categories": [
        "Bar",
        "Sports Bar",
        "Burger Joint",
        "Sandwich Restaurant"
      ],
      "distance": 0.25103686646367174
    },
    ...
  ],
  "transit": [
    {
      "stop_name": "Village Plaza -  Jo-Anns Fabrics",
      "latitude": 42.736726540051,
      "longitude": -71.196858494474,
      "routes": [
        {
          "short_name": "10",
          "long_name": "VILLAGE MALL VIA BROADWAY"
        },
        {
          "short_name": "10",
          "long_name": "Methuen Square"
        },
        {
          "short_name": "40",
          "long_name": "Methuen Square"
        }
      ]
    },
    {
      "stop_name": "Pelham Street Park & Ride",
      "latitude": 42.727395,
      "longitude": -71.200232,
      "routes": [
        {
          "short_name": "99",
          "long_name": "Methuen-Lawrence-Andover to Boston"
        }
      ]
    },
    ...
  ],
  "redfin_agent": "Sherre Dubis",
  "redfin_agent_average_rating": 10,
  "redfin_agent_url": "http://redfin.com/real-estate-agents/sherre-dubis",
  "redfin_agent_phone_number": "603-968-5261",
  "redfin_agent_deal_count": 232,
  "redfin_agent_volume": 92046099,
  "redfin_agent_highest_deal": 1300000,
  "url_map_2_x": "https://maps.google.com/maps/api/staticmap?sensor=false&style=feature%3Aadministrative.land_parcel%7Cvisibility%3Aoff&style=feature%3Alandscape.man_made%7Cvisibility%3Aoff&style=feature%3Atransit.station%7Chue%3A0xffa200&center=42.755854%2C-71.2134495&channel=ldp-minimap&path=color%3A0x2E7E36AA%7Cweight%3A1%7Cfillcolor%3A0x2E7E3633%7C42.7556517661979%2C-71.2136135592431%7C42.755652853304%2C-71.2136293929133%7C42.7556559108632%2C-71.2136447455755%7C42.7556608497788%2C-71.2136591683348%7C42.7556675261445%2C-71.2136722383488%7C42.7556757440131%2C-71.2136835759095%7C42.7556852653219%2C-71.2136928504789%7C42.755701061368%2C-71.2137021953775%7C42.7557599003748%2C-71.213722775569%7C42.7558199448114%2C-71.213735406652%7C42.7558806135693%2C-71.2137399682356%7C42.7559413186263%2C-71.2137364132741%7C42.7560014722875%2C-71.2137247777876%7C42.7561640281287%2C-71.2136878321098%7C42.7561751049447%2C-71.2136832168033%7C42.7561854509485%2
}

```


---

# 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-for-sale-listings-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.
