# Amazon Search API

This endpoint will retrieve products for a specified search term from Amazon search page and transform it into usable JSON.

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

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

{% endtab %}

{% tab title="Python" %}

```python
import requests

payload = {
    'api_key': 'API_KEY',
    'query': 'QUERY',
    'country_code': 'COUNTRY_CODE',
    'tld': 'TLD'
}

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

print(r.text)
```

{% endtab %}

{% tab title="NodeJS" %}

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

fetch(
  'https://api.scraperapi.com/structured/amazon/search?api_key=API_KEY&query=QUERY&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/amazon/search?api_key=API_KEY&query=QUERY&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",
  :query => "QUERY",
  :country_code => "COUNTRY_CODE",
  :tld => "TLD"
}

uri = URI('https://api.scraperapi.com/structured/amazon/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 query = "QUERY";
            String country_code = "COUNTRY_CODE";
            String tld = "TLD";

            String urlStr = "https://api.scraperapi.com/structured/amazon/search?api_key=" 
                            + apiKey + "&query=" + query + "&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="230">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>QUERY</code> (required)</td><td>Amazon Search query string</td></tr><tr><td><code>TLD</code></td><td><p>Amazon market to be scraped. </p><p>Valid values include:</p><p><strong>com</strong> (amazon.com)</p><p><strong>co.uk</strong> (amazon.co.uk)</p><p><strong>ca</strong> (amazon.ca)</p><p><strong>de</strong> (amazon.de)</p><p><strong>es</strong> (amazon.es)</p><p><strong>fr</strong> (amazon.fr)<br><strong>ie</strong> (amazon.ie)</p><p><strong>it</strong> (amazon.it)</p><p><strong>co.jp</strong> (amazon.co.jp)<br><strong>co.za</strong> (amazon.co.za)</p><p><strong>in</strong> (amazon.in)</p><p><strong>cn</strong> (amazon.cn)</p><p><strong>com.sg</strong> (amazon.com.sg)</p><p><strong>com.mx</strong> (amazon.com.mx)</p><p><strong>ae</strong> (amazon.ae)</p><p><strong>com.br</strong> (amazon.com.br)</p><p><strong>nl</strong> (amazon.nl)</p><p><strong>com.au</strong> (amazon.com.au)</p><p><strong>com.tr</strong> (amazon.com.tr)</p><p><strong>sa</strong> (amazon.sa)</p><p><strong>se</strong> (amazon.se)</p><p><strong>pl</strong> (amazon.pl)</p></td></tr><tr><td><code>COUNTRY_CODE</code></td><td><p>Valid values are two letter country codes for which we offer Geo Targeting (e.g. “<strong>au</strong>”, “<strong>es</strong>”, “<strong>it</strong>”, etc.).</p><p>Where an Amazon domain needs to be scraped from another country (e.g. scraping amazon.com from Canada to get Canadian shipping information), <strong>both TLD and COUNTRY parameters must be specified.</strong></p></td></tr><tr><td><code>OUTPUT_FORMAT</code></td><td><p>For structured data methods we offer CSV and JSON output. JSON is default if parameter is not added. Options:</p><ul><li>csv</li><li>json (default)</li></ul></td></tr><tr><td><code>PAGE</code></td><td>Paginating the result. For example: <code>1</code></td></tr><tr><td><code>REF</code></td><td>A reference string used by amazon. For example: <code>olp_f_usedAcceptable</code></td></tr><tr><td><code>S</code></td><td>Change sorting. For example: <code>price-desc-rank</code></td></tr><tr><td><code>I</code></td><td>Refine the search to a specific category. For example: <code>electronics</code></td></tr><tr><td>ZIP Code Targeting</td><td>To find out mote about ZIP Code targeting, please follow this link</td></tr></tbody></table>

### Sample Response

```json
{
	"ads": [
		{
			"type": "editorial_recommendation",
			"position": 24,
			"name": "OtterBox COMMUTER SERIES Case for iPhone SE (3rd and 2nd gen) and iPhone 8/7 - Frustration Free Packaging - BLACK  Shamo's Crystal Clear Shock Absorption TPU Rubber Gel Case (Clear) Compatible with iPhone SE 2022 (3rd Generation), iPhone SE 2020 (2nd Generation) iPhone 8 and iPhone 7 (Clear)  Caseology Skyfall for iPhone SE Case 2022 for iPhone SE Case (2020) for iPhone 8 Case (2017) for iPhone 7 Case (2016) - Red  OtterBox DEFENDER SERIES Case for iPhone SE (3rd and 2nd gen) and iPhone 8/7 - Frustration Free Packaging - BLACK",
			"image": "https://m.media-amazon.com/images/I/41UhTjBRSXL.jpg",
			"has_prime": true,
			"is_best_seller": false,
			"is_amazon_choice": false,
			"is_limited_deal": true,
			"stars": 4.6,
			"total_reviews": 30455,
			"url": "https://www.amazon.com/OTTERBOX-COMMUTER-Case-iPhone-2nd/dp/B01K6PAZ1M/ref=sxin_25?asc_contentid=amzn1.osa.072eaf6a-2b65-4c5d-8fc8-e2c1fd79d775.ATVPDKIKX0DER.en_US&asc_contenttype=article&ascsubtag=amzn1.osa.072eaf6a-2b65-4c5d-8fc8-e2c1fd79d775.ATVPDKIKX0DER.en_US&content-id=amzn1.sym.2501e731-e00e-46aa-97f8-28a8de3ef511%3Aamzn1.sym.2501e731-e00e-46aa-97f8-28a8de3ef511&creativeASIN=B01K6PAZ1M&cv_ct_cx=iphone+8+case&cv_ct_id=amzn1.osa.072eaf6a-2b65-4c5d-8fc8-e2c1fd79d775.ATVPDKIKX0DER.en_US&cv_ct_pg=search&cv_ct_we=asin&cv_ct_wn=osp-single-source-pecos-desktop&keywords=iphone+8+case&linkCode=oas&pd_rd_i=B01K6PAZ1M&pd_rd_r=bae9220f-d157-437f-b19d-7a5fd9383519&pd_rd_w=I3qNE&pd_rd_wg=5mkHn&pf_rd_p=2501e731-e00e-46aa-97f8-28a8de3ef511&pf_rd_r=CMC486Z1AX373WD7YH90&qid=1675411169&sr=1-1-c26ac7f6-b43f-4741-a772-17cad7536576&tag=bestcont06-20",
			"availability_quantity": null,
			"spec": {},
			"price_string": "$13.00$10.99$15.99$28.43",
			"price_symbol": "$",
			"price": 13
		}
	],
	"amazons_choice": [],
	"results": [
		{
			"type": "search_product",
			"position": 1,
			"name": "JETech Silicone Case for iPhone SE 3/2 (2022/2020 Edition), iPhone 8 and iPhone 7, 4.7-Inch, Silky-Soft Touch Full-Body Protective Case, Shockproof Cover with Microfiber Lining (Black)",
			"image": "https://m.media-amazon.com/images/I/61gnLelc9NL.jpg",
			"has_prime": true,
			"is_best_seller": false,
			"is_amazon_choice": true,
			"is_limited_deal": false,
			"stars": 4.4,
			"total_reviews": 27251,
			"url": "https://www.amazon.com/JETech-Silky-Soft-Protective-Shockproof-Microfiber/dp/B07QNR8LGW/ref=sr_1_1?keywords=iphone+8+case&qid=1675411169&sr=8-1",
			"availability_quantity": null,
			"spec": {},
			"price_string": "$9.99",
			"price_symbol": "$",
			"price": 9.99
		},
		{
			"type": "search_product",
			"position": 7,
			"name": "Speck Products CandyShell Grip iPhone SE (2022) Case| iPhone SE (2020)| iPhone 8| iPhone 7 - Charcoal Grey/Dark Poppy Red",
			"image": "https://m.media-amazon.com/images/I/71ihPDYKoXL.jpg",
			"section_name": null,
			"has_prime": true,
			"is_best_seller": false,
			"is_amazon_choice": false,
			"is_limited_deal": false,
			"stars": 4.7,
			"total_reviews": 13375,
			"url": "https://www.amazon.com/Speck-Products-CandyShell-Phone-iPhone/dp/B0756XVXK1/ref=sxin_15_ac_d_mf_brs?ac_md=7-3-U3BlY2s%3D-ac_d_mf_brs_brs&content-id=amzn1.sym.1ad31f34-ba12-4dca-be4b-f62f7f5bb10d%3Aamzn1.sym.1ad31f34-ba12-4dca-be4b-f62f7f5bb10d&cv_ct_cx=iphone+8+case&keywords=iphone+8+case&pd_rd_i=B0756XVXK1&pd_rd_r=bae9220f-d157-437f-b19d-7a5fd9383519&pd_rd_w=hCD41&pd_rd_wg=5mkHn&pf_rd_p=1ad31f34-ba12-4dca-be4b-f62f7f5bb10d&pf_rd_r=CMC486Z1AX373WD7YH90&qid=1675411169&sr=1-4-8b2f235a-dddf-4202-bbb9-592393927392",
			"availability_quantity": null,
			"spec": {},
			"price_string": "$16.88",
			"price_symbol": "$",
			"price": 16.88
		},
		{
			"type": "search_product",
			"position": 8,
			"name": "xiwxi iPhone SE Case 2022/3rd/2020,iPhone 8/7 Case,with [2xTempered Glass Screen Protector] [360 Full Body Shockproof] [Heavy Dropproof],Hard PC+Soft Silicone TPU+Glass Screen Phone Case-Black",
			"image": "https://m.media-amazon.com/images/I/81VS1nNTEGL.jpg",
			"section_name": null,
			"has_prime": true,
			"is_best_seller": false,
			"is_amazon_choice": false,
			"is_limited_deal": false,
			"stars": 4.6,
			"total_reviews": 1759,
			"url": "https://www.amazon.com/xiwxi-2xTempered-Protector-Shockproof-Case-Black/dp/B09VBHHZ78/ref=sxin_15_ac_d_mf_brs?ac_md=4-4-eGl3eGk%3D-ac_d_mf_brs_brs&content-id=amzn1.sym.1ad31f34-ba12-4dca-be4b-f62f7f5bb10d%3Aamzn1.sym.1ad31f34-ba12-4dca-be4b-f62f7f5bb10d&cv_ct_cx=iphone+8+case&keywords=iphone+8+case&pd_rd_i=B09VBHHZ78&pd_rd_r=bae9220f-d157-437f-b19d-7a5fd9383519&pd_rd_w=hCD41&pd_rd_wg=5mkHn&pf_rd_p=1ad31f34-ba12-4dca-be4b-f62f7f5bb10d&pf_rd_r=CMC486Z1AX373WD7YH90&qid=1675411169&sr=1-5-8b2f235a-dddf-4202-bbb9-592393927392",
			"availability_quantity": null,
			"spec": {},
			"price_string": "$14.99",
			"price_symbol": "$",
			"price": 14.99
		},
		{
			"type": "search_product",
			"position": 9,
			"name": "LeYi for iPhone 8 Case, iPhone 6s Case, iPhone 7 Case, iPhone 6 Case with 2 PCS Glass Screen Protector for Women Girls Boys, Liquid Silicone Shockproof Phone Case Cover with Stand for iPhone 8, Green",
			"image": "https://m.media-amazon.com/images/I/61N3UK4wR1L.jpg",
			"has_prime": true,
			"is_best_seller": false,
			"is_amazon_choice": false,
			"is_limited_deal": false,
			"stars": 4.4,
			"total_reviews": 1104,
			"url": "https://www.amazon.com/LeYi-iPhone-Protector-Silicone-Shockproof/dp/B09TR8DT8L/ref=sr_1_4?keywords=iphone+8+case&qid=1675411169&sr=8-4",
			"availability_quantity": null,
			"spec": {},
			"price_string": "$6.99",
			"price_symbol": "$",
			"price": 6.99
		},
		{
			"type": "search_product",
			"position": 15,
			"name": "JETech Case for iPhone SE 3/2 (2022/2020 Edition), iPhone 8 and iPhone 7, 4.7-Inch, Non-Yellowing Shockproof Phone Bumper Cover, Anti-Scratch Clear Back (Clear)",
			"image": "https://m.media-amazon.com/images/I/617WNit9-8L.jpg",
			"has_prime": true,
			"is_best_seller": false,
			"is_amazon_choice": false,
			"is_limited_deal": false,
			"stars": 4.6,
			"total_reviews": 121111,
			"url": "https://www.amazon.com/JETech-iPhone-4-7-Inch-Shock-Absorption-Anti-Scratch/dp/B01KF0FJX2/ref=sr_1_10?keywords=iphone+8+case&qid=1675411169&sr=8-10",
			"availability_quantity": null,
			"spec": {},
			"price_string": "$9.99",
			"price_symbol": "$",
			"price": 9.99
		},
		{
			"type": "search_product",
			"position": 16,
			"name": "Spigen Ultra Hybrid (Anti-Yellowing PC Back) Designed for iPhone SE 2022 Case/iPhone SE 3 Case 2022 / iPhone SE 2020 Case/iPhone 8 Case/iPhone 7 Case - Black",
			"image": "https://m.media-amazon.com/images/I/51HnUHLG7eL.jpg",
			"section_name": "Climate Pledge Friendly",
			"has_prime": true,
			"is_best_seller": false,
			"is_amazon_choice": false,
			"is_limited_deal": false,
			"stars": 4.6,
			"total_reviews": 72783,
			"url": "https://www.amazon.com/gp/slredirect/picassoRedirect.html/ref=pa_sp_search_thematic_aps_sr_pg1_1?ie=UTF8&bwType=search&bwAsin=B01M1SCIOV&qualifier=1675411169&id=3243969273986750&widgetName=sp_search_thematic&url=%2FSpigen-Hybrid-Generation-Cushion-Technology%2Fdp%2FB01M1SCIOV%2Fref%3Dsxin_24_pa_sp_search_thematic-asin_sspa%3Fcontent-id%3Damzn1.sym.139755fc-e653-4f77-9e36-97d145a75e7c%253Aamzn1.sym.139755fc-e653-4f77-9e36-97d145a75e7c%26cv_ct_cx%3Diphone%2B8%2Bcase%26keywords%3Diphone%2B8%2Bcase%26pd_rd_i%3DB01M1SCIOV%26pd_rd_r%3Dbae9220f-d157-437f-b19d-7a5fd9383519%26pd_rd_w%3DNz97e%26pd_rd_wg%3D5mkHn%26pf_rd_p%3D139755fc-e653-4f77-9e36-97d145a75e7c%26pf_rd_r%3DCMC486Z1AX373WD7YH90%26qid%3D1675411169%26sr%3D1-1-4a643ae4-6005-4b15-bc31-2c5125e2b25b-spons%26psc%3D1",
			"availability_quantity": null,
			"spec": {},
			"price_string": "$13.99",
			"price_symbol": "$",
			"price": 13.99
		},
		{
			"type": "search_product",
			"position": 17,
			"name": "Spigen Tough Armor [2nd Generation] Designed for iPhone 8 Case (2017) / Designed for iPhone 7 Case (2016) - Black",
			"image": "https://m.media-amazon.com/images/I/61B0XM+bXQL.jpg",
			"section_name": "Climate Pledge Friendly",
			"has_prime": true,
			"is_best_seller": false,
			"is_amazon_choice": false,
			"is_limited_deal": false,
			"stars": 4.6,
			"total_reviews": 37074,
			"url": "https://www.amazon.com/gp/slredirect/picassoRedirect.html/ref=pa_sp_search_thematic_aps_sr_pg1_2?ie=UTF8&bwType=search&bwAsin=B07481XLQN&qualifier=1675411169&id=3243969273986750&widgetName=sp_search_thematic&url=%2FSpigen-Generation-Kickstand-Protection-Technology%2Fdp%2FB07481XLQN%2Fref%3Dsxin_24_pa_sp_search_thematic-asin_sspa%3Fcontent-id%3Damzn1.sym.139755fc-e653-4f77-9e36-97d145a75e7c%253Aamzn1.sym.139755fc-e653-4f77-9e36-97d145a75e7c%26cv_ct_cx%3Diphone%2B8%2Bcase%26keywords%3Diphone%2B8%2Bcase%26pd_rd_i%3DB07481XLQN%26pd_rd_r%3Dbae9220f-d157-437f-b19d-7a5fd9383519%26pd_rd_w%3DNz97e%26pd_rd_wg%3D5mkHn%26pf_rd_p%3D139755fc-e653-4f77-9e36-97d145a75e7c%26pf_rd_r%3DCMC486Z1AX373WD7YH90%26qid%3D1675411169%26sr%3D1-2-4a643ae4-6005-4b15-bc31-2c5125e2b25b-spons%26psc%3D1",
			"availability_quantity": null,
			"spec": {},
			"price_string": "$15.99",
			"price_symbol": "$",
			"price": 15.99
		},
		{
			"type": "search_product",
			"position": 18,
			"name": "Spigen Ultra Hybrid [2nd Generation] Designed for iPhone 8 Plus Case (2017) / Designed for iPhone 7 Plus Case (2016) - Black",
			"image": "https://m.media-amazon.com/images/I/61rPT5Jsh8L.jpg",
			"section_name": "Climate Pledge Friendly",
			"has_prime": true,
			"is_best_seller": false,
			"is_amazon_choice": false,
			"is_limited_deal": false,
			"stars": 4.6,
			"total_reviews": 30062,
			"url": "https://www.amazon.com/gp/slredirect/picassoRedirect.html/ref=pa_sp_search_thematic_aps_sr_pg1_3?ie=UTF8&bwType=search&bwAsin=B01N9D7DP2&qualifier=1675411169&id=3243969273986750&widgetName=sp_search_thematic&url=%2FSpigen-Generation-Backing-Cushion-Technology%2Fdp%2FB01N9D7DP2%2Fref%3Dsxin_24_pa_sp_search_thematic-asin_sspa%3Fcontent-id%3Damzn1.sym.139755fc-e653-4f77-9e36-97d145a75e7c%253Aamzn1.sym.139755fc-e653-4f77-9e36-97d145a75e7c%26cv_ct_cx%3Diphone%2B8%2Bcase%26keywords%3Diphone%2B8%2Bcase%26pd_rd_i%3DB01N9D7DP2%26pd_rd_r%3Dbae9220f-d157-437f-b19d-7a5fd9383519%26pd_rd_w%3DNz97e%26pd_rd_wg%3D5mkHn%26pf_rd_p%3D139755fc-e653-4f77-9e36-97d145a75e7c%26pf_rd_r%3DCMC486Z1AX373WD7YH90%26qid%3D1675411169%26sr%3D1-3-4a643ae4-6005-4b15-bc31-2c5125e2b25b-spons%26psc%3D1",
			"availability_quantity": null,
			"spec": {},
			"price_string": "$11.99",
			"price_symbol": "$",
			"price": 11.99
		}
	],
	"explore_more_items": [],
	"pagination": [
		"https://www.amazon.com/s?k=iphone+8+case&page=2&qid=1675411169&ref=sr_pg_2",
		"https://www.amazon.com/s?k=iphone+8+case&page=3&qid=1675411169&ref=sr_pg_3",
		"https://www.amazon.com/s?k=iphone+8+case&page=4&qid=1675411169&ref=sr_pg_4",
		"https://www.amazon.com/s?k=iphone+8+case&page=5&qid=1675411169&ref=sr_pg_5",
		"https://www.amazon.com/s?k=iphone+8+case&page=6&qid=1675411169&ref=sr_pg_6",
		"https://www.amazon.com/s?k=iphone+8+case&page=7&qid=1675411169&ref=sr_pg_7",
		"https://www.amazon.com/s?k=iphone+8+case&page=8&qid=1675411169&ref=sr_pg_8",
		"https://www.amazon.com/s?k=iphone+8+case&page=9&qid=1675411169&ref=sr_pg_9",
		"https://www.amazon.com/s?k=iphone+8+case&page=10&qid=1675411169&ref=sr_pg_10",
		"https://www.amazon.com/s?k=iphone+8+case&page=11&qid=1675411169&ref=sr_pg_11",
		"https://www.amazon.com/s?k=iphone+8+case&page=12&qid=1675411169&ref=sr_pg_12",
		"https://www.amazon.com/s?k=iphone+8+case&page=13&qid=1675411169&ref=sr_pg_13",
		"https://www.amazon.com/s?k=iphone+8+case&page=14&qid=1675411169&ref=sr_pg_14",
		"https://www.amazon.com/s?k=iphone+8+case&page=15&qid=1675411169&ref=sr_pg_15",
		"https://www.amazon.com/s?k=iphone+8+case&page=16&qid=1675411169&ref=sr_pg_16",
		"https://www.amazon.com/s?k=iphone+8+case&page=17&qid=1675411169&ref=sr_pg_17",
		"https://www.amazon.com/s?k=iphone+8+case&page=18&qid=1675411169&ref=sr_pg_18",
		"https://www.amazon.com/s?k=iphone+8+case&page=19&qid=1675411169&ref=sr_pg_19",
		"https://www.amazon.com/s?k=iphone+8+case&page=20&qid=1675411169&ref=sr_pg_20"
	]
}
```


---

# 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/e-commerce/amazon/amazon-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.
