# Amazon Reviews API

{% hint style="info" %}
**Note:** It is advised to scrape Amazon reviews with a single concurrency, as scraping has become more challenging since Amazon introduced the auth wall. We do not guarantee any consistency with this API.
{% endhint %}

You have to send a GET request to **`https://api.scrapingdog.com/amazon/reviews`** with the below-given parameters.

#### Parameters <a href="#parameters" id="parameters"></a>

| Parameter                                                        | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| ---------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| <p>api\_key <br><br><mark style="color:red;">required</mark></p> | <p>Your personal API key. <br><br>Available on your dashboard<br><br>Type: <em><strong>String</strong></em></p>                                                                                                                                                                                                                                                                                                                                                                                                            |
| <p>domain<br><br><mark style="color:red;">required</mark></p>    | This is the TLD extension of the amazon page. Example - in, com, tr, etc Type: **`String`**                                                                                                                                                                                                                                                                                                                                                                                                                                |
| <p>asin<br><br><mark style="color:red;">required</mark></p>      | <p>This is the Amazon product ID. <br><br>Type: <strong><code>String</code></strong></p>                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| sort\_by                                                         | <p>The criteria by which the reviews should be sorted.</p><p></p><p>Possible Values - <strong><code>helpful</code></strong>, or <strong><code>recent</code></strong><br></p><p>Default Value - <strong><code>helpful</code></strong><br><br>Type: <strong><code>String</code></strong></p>                                                                                                                                                                                                                                 |
| filter\_by\_star                                                 | <p>This is used to filter the reviews by the number of stars.<br><br>Possible Values - <strong><code>one\_star</code></strong>,  <strong><code>two\_star</code></strong></p><p>, <strong><code>three\_star</code></strong>, <strong><code>four\_star</code></strong>, <strong><code>five\_star</code></strong></p><p>, <strong><code>positive</code></strong> or <strong><code>critical</code></strong>.<br>Default Value - <strong><code>all\_stars</code></strong><br><br>Type: <strong><code>String</code></strong></p> |
| format\_type                                                     | <p>This is used to filter the reviews based on their format.<br><br>Possible Values - <strong><code>all\_formats</code></strong>, or <strong><code>current\_format</code></strong><br></p><p>Default Value - <strong><code>all\_formats</code></strong><br><br>Type: <strong><code>String</code></strong></p>                                                                                                                                                                                                              |
| reviewer\_type                                                   | <p>This is used to filter reviews based on reviewer type.<br><br>Possible Values - <strong><code>all\_reviews</code></strong>, or <strong><code>avp\_only\_reviews</code></strong><br></p><p>Default Value - <strong><code>all\_reviews</code></strong><br><br>Type: <strong><code>String</code></strong></p>                                                                                                                                                                                                              |
| media\_type                                                      | <p>This is used to filter reviews based on the media type.<br><br>Possible Values - <strong><code>media\_reviews\_only</code></strong>, or <strong><code>all\_contents</code></strong><br></p><p>Default Value - <strong><code>all\_contents</code></strong><br><br>Type: <strong><code>String</code></strong></p>                                                                                                                                                                                                         |
| <p>page<br><br><mark style="color:red;">required</mark></p>      | <p>This is the page number. <br><br>Type: <strong><code>Integer</code></strong></p>                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| url                                                              | <p>This is the Amazon Product Reviews URL which can be used instead of asin, domain and page. <br><br>Type: <strong><code>String</code></strong></p>                                                                                                                                                                                                                                                                                                                                                                       |

### API Example

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

```json
curl "https://api.scrapingdog.com/amazon/reviews?api_key=5eaa61a6e562fc52fe763tr516e4653&domain=com&asin=B00AP877FS&page=1"
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://api.scrapingdog.com/amazon/reviews"
params = {
    "api_key": "5eaa61a6e562fc52fe763tr516e4653",
    "domain": "com",
    "asin": "B00AP877FS",
    "page": 1
}

response = requests.get(url, params=params)

if response.status_code == 200:
    data = response.json()
    print(data)
else:
    print(f"Request failed with status code {response.status_code}")

```

{% endtab %}

{% tab title="Node JS" %}

```javascript
const axios = require('axios');

const url = 'https://api.scrapingdog.com/amazon/reviews';
const params = {
  api_key: '5eaa61a6e562fc52fe763tr516e4653',
  domain: 'com',
  asin: 'B00AP877FS',
  page: 1
};

axios
  .get(url, { params })
  .then((response) => {
    if (response.status === 200) {
      const data = response.data;
      console.log(data);
    } else {
      console.log(`Request failed with status code ${response.status}`);
    }
  })
  .catch((error) => {
    console.error('Request failed with an error:', error);
  });

```

{% endtab %}

{% tab title="PHP" %}

```php
<?php

$apiUrl = 'https://api.scrapingdog.com/amazon/reviews';
$apiKey = '5eaa61a6e562fc52fe763tr516e4653';
$domain = 'com';
$asin = 'B00AP877FS';
$page= 1

$queryString = http_build_query([
    'api_key' => $apiKey,
    'domain' => $domain,
    'asin' => $asin,
    'page' => $page
]);

$fullUrl = $apiUrl . '?' . $queryString;

$ch = curl_init($fullUrl);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);

if ($httpCode == 200) {
    $data = json_decode($response, true);
    print_r($data);
} else {
    echo "Request failed with status code $httpCode\n";
}

curl_close($ch);
?>

```

{% endtab %}

{% tab title="Ruby" %}

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

api_url = 'https://api.scrapingdog.com/amazon/reviews'
api_key = '5eaa61a6e562fc52fe763tr516e4653'
domain = 'com'
asin = 'B00AP877FS'
page = 1

params = {
  'api_key' => api_key,
  'domain' => domain,
  'asin' => asin,
  'page' => page
}

uri = URI(api_url)
uri.query = URI.encode_www_form(params)

response = Net::HTTP.get_response(uri)

if response.is_a?(Net::HTTPSuccess)
  data = JSON.parse(response.body)
  puts data
else
  puts "Request failed with status code #{response.code}"
end

```

{% endtab %}

{% tab title="Java" %}

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

public class Main {
    public static void main(String[] args) {
        String apiURL = "https://api.scrapingdog.com/amazon/reviews";
        String apiKey = "5eaa61a6e562fc52fe763tr516e4653";
        String domain = "com";
        String asin = "B00AP877FS";
        int page = 1;

        try {
            // Create the URL with query parameters
            URL url = new URL(apiURL + "?api_key=" + apiKey + "&domain=" + domain + "&asin=" + asin + "&page=" + page);
            HttpURLConnection connection = (HttpURLConnection) url.openConnection();

            // Set the request method to GET
            connection.setRequestMethod("GET");

            // Get the response code
            int responseCode = connection.getResponseCode();

            if (responseCode == 200) {
                // Read the response data
                BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
                String line;
                StringBuilder response = new StringBuilder();

                while ((line = reader.readLine()) != null) {
                    response.append(line);
                }
                reader.close();

                // Print the response data
                System.out.println(response.toString());
            } else {
                System.out.println("Request failed with response code: " + responseCode);
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}

```

{% endtab %}
{% endtabs %}

### Response

```json
{
    "reviews": 4,
    "rating": 5,
    "actual_reviews": 3,
    "customer_reviews": [
        {
            "user": "pagan chavez",
            "title": "so cute!!",
            "date": "Reviewed in the United States on June 3, 2014",
            "rating": 5,
            "review": "i love this its so cute and i really wanted something to match my vanity area and i dont think i will use these much just because they are so cute... i did try them and i love the coverage that it gives.... who would have known that a cheap priced brush set would be so good.... i would definitely recommend this to everyone!!! i might just order another set just so i can still use one set and keeep the other one as decoration! my only downside is that the color i received is a little different then the one on the picture... but thats ok because i love both colors"
        },
        {
            "user": "Shi",
            "title": "Gift",
            "date": "Reviewed in the United States on May 2, 2022",
            "rating": 5,
            "review": "Yeah I know she was happy with it and the color design"
        },
        {
            "user": "Ginger",
            "title": "Good price, good quality, five stars!",
            "date": "Reviewed in the United States on November 30, 2013",
            "rating": 5,
            "review": "Very cute, great for price, and good quality. I ordered it standard delivery and it got here six days earlier than expected! Very happy and so is the recipient of my gift (who by the way is 20, not a little one as you may assume)!"
        }
    ]
}
```


---

# 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.scrapingdog.com/amazon-scraper-api/amazon-reviews-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.
