> 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`.

# Walmart Search Scraper

Structured Walmart data: send `queries`. Cursor-paginated, 1 credit per successful call.

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

## Overview

Call `GET /api/v2/walmart-search-scraper/` with `queries`. The results are in `data.products`; send `data.next_cursor` back as `cursor` to get the next page. 2 optional parameters refine the call (see Parameters).

## Request

```bash
curl -G "https://api.scrapier.io/api/v2/walmart-search-scraper/" \
  -H "X-API-Key: YOUR_API_KEY" \
  --data-urlencode "queries=lego star wars" \
  --max-time 210
```

```python
import requests

resp = requests.get(
    "https://api.scrapier.io/api/v2/walmart-search-scraper/",
    headers={"X-API-Key": "YOUR_API_KEY"},
    params={"queries": "lego star wars"},
    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. |
| `queries` | string | yes | e.g. `lego star wars` | Search keyword or Walmart /search?q= URL. Required on the 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. |
| `sort` | string | no | `best_match` | Result sort order. One of: `best_match`, `price_low`, `price_high`, `best_seller`, `new`, `rating_high`. Locked in cursor. |
| `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": "lego star wars",
    "sort_by": "best_match",
    "page": 1,
    "page_size": 50,
    "max_page": 12,
    "products": [
      {
        "statusCode": 200,
        "statusMessage": "FOUND",
        "keyword": "lego star wars",
        "page": 1,
        "sortBy": "best_match",
        "count": 965,
        "maxPage": 12,
        "__typename": "Product",
        "usItemId": "5014870508",
        "name": "LEGO Star Wars Clone Trooper & Battle Droid Battle Pack Set 75372",
        "price": 40.98,
        "availabilityStatusDisplayValue": "In stock",
        "sellerName": "WM-BEUSA",
        "averageRating": 4.7,
        "numberOfReviews": 1273,
        "input_query": "lego star wars",
        "search_url": "https://www.walmart.com/search?q=lego+star+wars&page=1",
        "scraped_at": "2026-09-15T08:37:33.939Z"
      }
    ],
    "next_cursor": "eyJxIjoibGVnbyBzdGFyIHdhcnMiLCJwIjoyLCJsayI6e30sInMiOlsiNTAxNDg3MDUwOCJdfQ"
  }
}
```

## Response fields

| Field | Type | Example | Description |
|---|---|---|---|
| `query` | string | `lego star wars` |  |
| `sort_by` | string | `best_match` |  |
| `page` | integer | `1` |  |
| `page_size` | integer | `50` |  |
| `max_page` | integer | `12` |  |
| `products` | array | `[1 item]` | The results. |
| `next_cursor` | string | `eyJxIjoibGVnbyBzdGFyIHdhcnMiLCJwIjoyLCJsayI6e…` | Pass back as `cursor` for the next page. `null` on the last page. |
| `products[].statusCode` | integer | `200` |  |
| `products[].statusMessage` | string | `FOUND` |  |
| `products[].keyword` | string | `lego star wars` |  |
| `products[].page` | integer | `1` |  |
| `products[].sortBy` | string | `best_match` |  |
| `products[].count` | integer | `965` |  |
| `products[].maxPage` | integer | `12` |  |
| `products[].__typename` | string | `Product` |  |
| `products[].usItemId` | string | `5014870508` |  |
| `products[].name` | string | `LEGO Star Wars Clone Trooper & Battle Droid B…` |  |
| `products[].price` | number | `40.98` |  |
| `products[].availabilityStatusDisplayValue` | string | `In stock` |  |
| `products[].sellerName` | string | `WM-BEUSA` |  |
| `products[].averageRating` | number | `4.7` |  |
| `products[].numberOfReviews` | integer | `1273` |  |
| `products[].input_query` | string | `lego star wars` |  |
| `products[].search_url` | string | `https://www.walmart.com/search?q=lego+star+wa…` |  |
| `products[].scraped_at` | string | `2026-09-15T08:37:33.939Z` |  |

## 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/walmart-search-scraper/"
HEADERS = {"X-API-Key": "YOUR_API_KEY"}
params = {"queries": "lego star wars"}
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

- Locked into the cursor: `sort`. Set them on the first call; later pages reuse them.

## Related

- [Walmart Category](https://docs.scrapier.io/api-reference/walmart/walmart-category.md): Structured Walmart data: send `urls`. Cursor-paginated, 1 credit per successful call.
- [Walmart Data Extractor](https://docs.scrapier.io/api-reference/walmart/walmart-data-extractor.md): Structured Walmart data: send `urls`. Cursor-paginated, 1 credit per successful call.
- [Walmart Reviews](https://docs.scrapier.io/api-reference/walmart/walmart-reviews.md): Structured Walmart data: send `urls`. Cursor-paginated, 1 credit per successful call.
