> Documentation index: https://docs.scrapier.io/llms.txt
> Auth: header `X-API-Key: <key>` · Base: https://api.scrapier.io/api/v2 · Synchronous; paginate with `cursor` ← `data.next_cursor`.

# Amazon Search

Search Amazon by keyword and get product results with price, rating and position, with marketplace and sort order options.

`GET|POST https://api.scrapier.io/api/v2/amazon-search/` · 1 credit per successful call · Cursor-paginated

## Overview

Send a keyword in `query` and get a page of Amazon search results with ASIN, product description, URL (`dp_url`), price, retail price, star rating (`product_rating`), review count (`count_review`), prime and sponsored flags and search position.

Pick the marketplace with `domain_code` (com, co.uk, de, and so on) and the order with `sort_by`. Both are locked into the cursor, so later pages keep the same marketplace and sort.

## Use cases

- Monitor where products rank for a keyword.
- Collect prices across Amazon marketplaces for the same search.
- Build a product list for further lookups with amazon-review or amazon-seller-scraper.

## Request

```bash
curl -G "https://api.scrapier.io/api/v2/amazon-search/" \
  -H "X-API-Key: YOUR_API_KEY" \
  --data-urlencode "query=Playstation" \
  --max-time 210
```

```python
import requests

resp = requests.get(
    "https://api.scrapier.io/api/v2/amazon-search/",
    headers={"X-API-Key": "YOUR_API_KEY"},
    params={"query": "Playstation"},
    timeout=210,
)
body = resp.json()
if not resp.ok:
    raise RuntimeError(body.get("error") or body.get("detail"))

print(body["data"]["products"])
```

POST with a JSON body works too (same parameters; the body is merged over the query string).

## Parameters

| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| `X-API-Key` (header) | string | yes | — | Your API key. |
| `query` | string | yes | e.g. `Playstation` | Search keyword (required first call). |
| `cursor` | string | no | — | Pagination cursor returned in the previous response's `next_cursor`. Pass it back unchanged to fetch the next page. When `next_cursor` is null, you have reached the last page. |
| `domain_code` | string | no | `com` | Amazon marketplace: com, co.uk, de, in, ca, it, es, fr (fr is AWS-WAF gated and may return 502). One of: `com`, `co.uk`, `de`, `in`, `ca`, `it`, `es`, `fr`. Locked in cursor. |
| `sort_by` | string | no | `relevanceblender` | Amazon sort key. One of: `relevanceblender`, `price-asc-rank`, `price-desc-rank`, `review-rank`, `date-desc-rank`, `exact-aware-popularity-rank`. Locked in cursor. |
| `category` | string | no | — | Search category (optional) |
| `browse_node` | integer | no | — | Browse node ID (optional) |
| `node_hierarchy` | string | no | — | Node hierarchy (optional) |
| `max_pages` | integer | no | `1` | First call only: front-load this many Amazon result pages (capped at 10). Cursor calls return one page (plus a refill page when it comes back thin). |
| `use_proxy` | boolean | no | `true` | Route the request through Scrapier's residential proxy pool. Default: `true`. Leave as is unless support tells you otherwise. |
| `raw_data` | boolean | no | `false` | When true, the response carries the full raw upstream payload(s) the scraper received (GraphQL / JSON API bodies, HTML, embedded JSON-LD -- exactly as the platform returned them) under `raw_responses`, in place of the formatted items. When false (default) you get the formatted output. Pagination (`cursor` / `next_cursor`) works the same in both modes. |

## Response

HTTP 200. Results are in `data.products`. Sample from the live catalog, arrays trimmed to 3 items.

```json
{
  "success": true,
  "data": {
    "query": "laptop",
    "domain_code": "com",
    "sort_by": "relevanceblender",
    "page": 1,
    "page_size": 16,
    "pages_fetched": 1,
    "products": [
      {
        "asin": "B0EXAMPLE10",
        "product_description": "Lenovo ThinkPad X1 Carbon Gen 11 14\" Laptop",
        "img_url": "https://m.media-amazon.com/images/I/example._AC_UY218_.jpg",
        "price": 1599,
        "retail_price": 1899,
        "product_rating": "4.6 out of 5 stars",
        "count_review": 1248,
        "dp_url": "https://www.amazon.com/Lenovo-ThinkPad-Carbon/dp/B0EXAMPLE10/ref=sr_1_1",
        "prime": true,
        "sponsored": false,
        "is_sponsored": false,
        "sales_volume": "500+ bought in past month",
        "delivery_message": "FREE delivery Tue, Oct 7",
        "manufacturer": null,
        "series": null,
        "variations": [],
        "product_details": [],
        "secondary_offer": 0,
        "status_code": 200,
        "status_message": "FOUND",
        "keyword": "laptop",
        "domain_code": "com",
        "page": 1,
        "selected_category": "aps",
        "browse_node": null,
        "node_hierarchy": null,
        "result_count": 100000,
        "categories": [
          "Traditional Laptop Computers"
        ],
        "similar_keywords": [],
        "current_page": 1,
        "sort_strategy": "relevanceblender",
        "search_result_position": 0,
        "position": 1
      }
    ],
    "next_cursor": "zc1.eNqFU01P..."
  }
}
```

## Response fields

| Field | Type | Example | Description |
|---|---|---|---|
| `query` | string | `laptop` |  |
| `domain_code` | string | `com` |  |
| `sort_by` | string | `relevanceblender` |  |
| `page` | integer | `1` |  |
| `page_size` | integer | `16` |  |
| `pages_fetched` | integer | `1` | How many result pages this call fetched. |
| `products` | array | `[1 item]` | The results. |
| `next_cursor` | string | `zc1.eNqFU01P...` | Pass back as `cursor` for the next page. `null` on the last page. |
| `products[].asin` | string | `B0EXAMPLE10` |  |
| `products[].product_description` | string | `Lenovo ThinkPad X1 Carbon Gen 11 14" Laptop` |  |
| `products[].img_url` | string | `https://m.media-amazon.com/images/I/example._…` |  |
| `products[].price` | integer | `1599` |  |
| `products[].retail_price` | integer | `1899` |  |
| `products[].product_rating` | string | `4.6 out of 5 stars` | Average star rating, as text. |
| `products[].count_review` | integer | `1248` | Number of reviews. |
| `products[].dp_url` | string | `https://www.amazon.com/Lenovo-ThinkPad-Carbon…` | Link to the product page. |
| `products[].prime` | boolean | `true` |  |
| `products[].sponsored` | boolean | `false` |  |
| `products[].is_sponsored` | boolean | `false` |  |
| `products[].sales_volume` | string | `500+ bought in past month` |  |
| `products[].delivery_message` | string | `FREE delivery Tue, Oct 7` |  |
| `products[].manufacturer` | null | `null` |  |
| `products[].series` | null | `null` |  |
| `products[].variations` | array | `[]` |  |
| `products[].product_details` | array | `[]` |  |
| `products[].secondary_offer` | integer | `0` |  |
| `products[].status_code` | integer | `200` |  |
| `products[].status_message` | string | `FOUND` |  |
| `products[].keyword` | string | `laptop` | The search keyword that returned the product. |
| `products[].domain_code` | string | `com` |  |
| `products[].page` | integer | `1` |  |
| `products[].selected_category` | string | `aps` |  |
| `products[].browse_node` | null | `null` |  |
| `products[].node_hierarchy` | null | `null` |  |
| `products[].result_count` | integer | `100000` |  |
| `products[].categories` | array | `[1 item]` |  |
| `products[].similar_keywords` | array | `[]` |  |
| `products[].current_page` | integer | `1` | The results page the product was found on. |
| `products[].sort_strategy` | string | `relevanceblender` |  |
| `products[].search_result_position` | integer | `0` | Position of the product in the search results. |
| `products[].position` | integer | `1` |  |

## Pagination

Pass `data.next_cursor` back as `cursor` until it is `null`. Required inputs are ignored once a cursor is sent. Each page is one billed call.

```python
import requests

URL = "https://api.scrapier.io/api/v2/amazon-search/"
HEADERS = {"X-API-Key": "YOUR_API_KEY"}
params = {"query": "Playstation"}
items = []

for _ in range(10):  # each page is one billed call
    resp = requests.get(URL, headers=HEADERS, params=params, timeout=210)
    resp.raise_for_status()
    data = resp.json()["data"]
    items.extend(data.get("products") or [])
    if not data.get("next_cursor"):  # None = last page
        break
    params = {"cursor": data["next_cursor"]}
```

## Errors

Failed calls are free. Branch on HTTP status; the message is in `error` (or `detail`). See https://docs.scrapier.io/errors.md

- **400** Bad input. The exact message varies by endpoint. `{"success":false,"error":"…"}`
- **402** Balance below the endpoint's price. `{"error":"Insufficient credits. Buy more to scrape more.","balance":1,"required":2}`
- **403** Invalid or unknown API key. `{"detail":"Authentication service unavailable or invalid API key."}`
- **429** Throttled — wait for Retry-After. `{"detail":"Request was throttled. Expected available in N seconds."}`
- **404** unknown slug · **503** busy (retry after `Retry-After`) · **5xx** upstream failure or timeout (retry with backoff).

## Notes

- `domain_code` and `sort_by` are set on the first call and reused for every page.
- `max_pages` applies to the first call only: it front-loads that many result pages (capped at 10). Cursor calls return one page, plus a refill page when it comes back thin.
- `domain_code` `fr` is gated by Amazon's AWS WAF and may return 502.
- `category`, `browse_node` and `node_hierarchy` are optional filters.
- Locked into the cursor: `domain_code`, `sort_by`. Set them on the first call; later pages reuse them.

## Related

- [Amazon Products](https://docs.scrapier.io/api-reference/amazon/amazon-product.md): Search Amazon by keyword or URL and get product listings, or send a product URL to get that single product.
- [Amazon Best Sellers](https://docs.scrapier.io/api-reference/amazon/amazon-bestsellers.md): Get ranked products from an Amazon Best Sellers category URL, with price, rating, review count and list position.
- [Amazon Keyword Suggestions](https://docs.scrapier.io/api-reference/amazon/amazon-keyword-suggestion.md): Get Amazon search-box autocomplete suggestions for a keyword in one call.
