# Walmart Scraper — Products, Prices, Ratings & Stock (`nexgendata/walmart-scraper`) Actor

- **URL**: https://apify.com/nexgendata/walmart-scraper.md
- **Developed by:** [NexGenData](https://apify.com/nexgendata) (community)
- **Categories:** E-commerce, Business
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, NaN bookmarks
- **User rating**: No ratings yet

## Pricing

from $3.00 / 1,000 product extracteds

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).


# README

## Walmart Scraper — Products, Prices, Ratings & Stock

**The fast, reliable Walmart.com product scraper for Apify.** Feed it search keywords or product URLs and get back clean, structured JSON — one record per product — with title, price, sale (was) price, rating, review count, brand, seller, availability, image and the Walmart item id. Ready to drop straight into a pricing dashboard, repricer, BI warehouse or quant model.

Walmart is the largest retailer in the United States — **~$640B annual revenue, 4,600+ US stores, and walmart.com is the #2 US e-commerce site after Amazon.** It is also one of the richest public price-and-availability surfaces on the web: first-party Walmart inventory *and* a sprawling third-party marketplace, side by side. This actor turns that surface into a programmatic feed.

---

### What you get per product

| Field | Type | Description |
|---|---|---|
| `title` | string | Product name / title |
| `price` | number | Current selling price |
| `was_price` | number | Original / strikethrough price (only present when the item is on sale) |
| `currency` | string | Currency code (e.g. `USD`) |
| `rating` | number | Average star rating (0–5) |
| `reviews_count` | int | Number of customer reviews |
| `walmart_id` | string | Walmart US item id (`usItemId`) — the stable join key |
| `brand` | string | Brand name |
| `seller` | string | Seller — `Walmart.com` for first-party, or the marketplace seller name |
| `availability` | string | Stock status (`IN_STOCK` / `OUT_OF_STOCK` / display string) |
| `url` | string | Canonical Walmart product URL |
| `image_url` | string | Primary product image URL |
| `category` | string | Product category / type (when exposed) |
| `query` | string | The keyword or URL that produced this record |
| `mode` | string | `keyword_search` or `product_url` |
| `data_source` | string | Provenance (`httpx` vs `playwright`) |
| `as_of_timestamp` | string | UTC ISO-8601 capture time |

Alongside the product rows, the actor emits a **per-query summary** record (`record_type: "query_summary"`) for each keyword with the product `count` and `avg_price` — handy for at-a-glance category price benchmarking without re-aggregating downstream.

---

### Two input modes

#### Search keywords
Provide a `keywords` array (e.g. `["coffee maker", "air fryer", "running shoes"]`). Each keyword runs a Walmart search across multiple result pages and returns one record per product, up to `maxItems`. Use this for category sweeps, competitor catalogue discovery, or price benchmarking.

#### Product URLs
Provide a `productUrls` array of exact Walmart product pages (e.g. `https://www.walmart.com/ip/.../121002347`). Each URL returns a single, detailed product record. Use this for watchlists, repricing, and tracking specific SKUs over time.

You can supply both in one run.

---

### How the actor handles Walmart's anti-bot wall

Walmart defends walmart.com with PerimeterX / bot-detection on datacenter IPs. The actor uses a resilient waterfall:

1. **`httpx` + realistic browser headers (warmed session)** — pulls the homepage first to pick up cookies, then requests the search / product page and parses the embedded **`__NEXT_DATA__`** JSON blob (the same hydration state Walmart's own front-end uses). This is the reliable, structured path — not brittle DOM scraping.
2. **Playwright headless Chromium fallback** — with stealth countermeasures (`navigator.webdriver` patch, realistic locale / timezone / viewport, plugin spoofing) for when the static HTML is blocked or JS-gated.
3. **Graceful no-result handling** — if every strategy is blocked, the actor pushes a single `status` row explaining the situation **(no charge applied)** rather than crashing your pipeline.

All paths run behind Apify's **RESIDENTIAL proxy** pool by default, which is strongly recommended for Walmart.

---

### How buyers actually use this actor

- **Repricing / price intelligence** — daily `productUrls` pull of a SKU watchlist to feed a dynamic-pricing engine; `was_price` exposes live markdown depth.
- **Brand & MAP monitoring** — `keyword_search` across a brand portfolio to catch unauthorized marketplace sellers and minimum-advertised-price violations.
- **Category research** — weekly keyword sweeps with the `query_summary` rows to track average price and assortment depth per category over time.
- **Quant / consumer-discretionary desks** — Walmart price & availability as an alt-data signal joinable by `walmart_id`.
- **Affiliate & comparison sites** — keep a Walmart price/stock column fresh next to other retailers.

---

### Related NexGenData e-commerce actors

Pair the Walmart Scraper with the rest of the NexGenData retail-intelligence fleet:

- 🔗 **[Amazon Product Scraper](https://apify.com/nexgendata/amazon-product-scraper?fpr=2ayu9b)** — the #1 US e-commerce surface; price, BSR, ratings & buy-box.
- 🔗 **[Google Shopping Scraper](https://apify.com/nexgendata/google-shopping-scraper?fpr=2ayu9b)** — cross-retailer price comparison from a single query.
- 🔗 **[eBay Sold Comps](https://apify.com/nexgendata/ebay-sold-comps?fpr=2ayu9b)** — real sold-listing comps for resale & valuation.
- 🏢 **[About NexGenData](https://apify.com/nexgendata?fpr=2ayu9b)** — the full fleet of production e-commerce, finance and social-data scrapers.

Run **Walmart + Amazon + Google Shopping** on the same SKU list to build a complete cross-retailer price-and-stock matrix.

---

### Get 20% off your first 3 months on Apify

New to Apify? Use [this referral link](https://www.apify.com/?fpr=2ayu9b) to sign up and get **20% off for 3 months, then 30% ongoing.** Pairs cleanly with any of the e-commerce actors above.

---

### Input parameters

- `keywords` — array of Walmart search terms (`keyword_search` mode).
- `productUrls` — array of exact Walmart product page URLs (`product_url` mode).
- `maxItems` — max product records per run (1–1000; default 50).
- `proxyConfiguration` — Apify proxy (defaults to RESIDENTIAL — strongly recommended).

---

### Disclaimer

This actor collects only publicly visible Walmart.com product data using the same page endpoints any logged-out walmart.com visitor reaches. It does not bypass logins, paywalls or private data. Buyers are responsible for compliance with Walmart's Terms of Service and applicable data regulations in their jurisdiction.

# Actor input Schema

## `keywords` (type: `array`):

List of search terms to scrape from Walmart.com (e.g. ['coffee maker', 'air fryer', 'running shoes']). Each keyword runs a Walmart search and returns one record per product. Leave empty if you are scraping specific product URLs instead.
## `productUrls` (type: `array`):

List of specific Walmart product page URLs to scrape (e.g. ['https://www.walmart.com/ip/Keurig-K-Classic/121002347']). Each URL returns a single detailed product record. Use this instead of (or in addition to) keywords when you already know exact products.
## `maxItems` (type: `integer`):

Maximum number of product records to return per run (across all keywords / URLs). 20-50 is appropriate for monitoring; 100+ for research sweeps.
## `proxyConfiguration` (type: `object`):

Apify proxy configuration. RESIDENTIAL is strongly recommended — Walmart applies aggressive anti-bot detection on datacenter IPs. The actor warms a session and falls back from httpx to a Playwright headless browser when the static HTML is blocked.

## Actor input object example

```json
{
  "keywords": [
    "coffee maker"
  ],
  "productUrls": [],
  "maxItems": 50,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}
````

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "keywords": [
        "coffee maker"
    ],
    "productUrls": [],
    "maxItems": 50,
    "proxyConfiguration": {
        "useApifyProxy": true,
        "apifyProxyGroups": [
            "RESIDENTIAL"
        ]
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("nexgendata/walmart-scraper").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "keywords": ["coffee maker"],
    "productUrls": [],
    "maxItems": 50,
    "proxyConfiguration": {
        "useApifyProxy": True,
        "apifyProxyGroups": ["RESIDENTIAL"],
    },
}

# Run the Actor and wait for it to finish
run = client.actor("nexgendata/walmart-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "keywords": [
    "coffee maker"
  ],
  "productUrls": [],
  "maxItems": 50,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}' |
apify call nexgendata/walmart-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=nexgendata/walmart-scraper",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Walmart Scraper — Products, Prices, Ratings & Stock",
        "version": "0.0",
        "x-build-id": "tUVIYbSraJlEcSiO0"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/nexgendata~walmart-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-nexgendata-walmart-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/nexgendata~walmart-scraper/runs": {
            "post": {
                "operationId": "runs-sync-nexgendata-walmart-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/nexgendata~walmart-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-nexgendata-walmart-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "properties": {
                    "keywords": {
                        "title": "Search keywords",
                        "type": "array",
                        "description": "List of search terms to scrape from Walmart.com (e.g. ['coffee maker', 'air fryer', 'running shoes']). Each keyword runs a Walmart search and returns one record per product. Leave empty if you are scraping specific product URLs instead.",
                        "default": [
                            "coffee maker"
                        ],
                        "items": {
                            "type": "string"
                        }
                    },
                    "productUrls": {
                        "title": "Product URLs",
                        "type": "array",
                        "description": "List of specific Walmart product page URLs to scrape (e.g. ['https://www.walmart.com/ip/Keurig-K-Classic/121002347']). Each URL returns a single detailed product record. Use this instead of (or in addition to) keywords when you already know exact products.",
                        "default": [],
                        "items": {
                            "type": "string"
                        }
                    },
                    "maxItems": {
                        "title": "Max products",
                        "minimum": 1,
                        "maximum": 1000,
                        "type": "integer",
                        "description": "Maximum number of product records to return per run (across all keywords / URLs). 20-50 is appropriate for monitoring; 100+ for research sweeps.",
                        "default": 50
                    },
                    "proxyConfiguration": {
                        "title": "Proxy configuration",
                        "type": "object",
                        "description": "Apify proxy configuration. RESIDENTIAL is strongly recommended — Walmart applies aggressive anti-bot detection on datacenter IPs. The actor warms a session and falls back from httpx to a Playwright headless browser when the static HTML is blocked.",
                        "default": {
                            "useApifyProxy": true,
                            "apifyProxyGroups": [
                                "RESIDENTIAL"
                            ]
                        }
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
