Blog / API guides

Walmart Scraper or API: Price, Stock and Seller Data

A Walmart scraper loads Walmart search and product pages and extracts price, rating, seller and stock status from each one, and you maintain that extraction every time the pages change. The alternative is two Walmart endpoints, search and product, that return those values as typed JSON fields at 1 credit per successful call. Which one fits depends on whether you watch a few hundred known items or sweep whole search results. This post maps scraper fields to the recorded "air fryer" response, prices both tracking patterns in credits and gives a verdict per job.

What would a Walmart scraper have to extract?

A Walmart scraper exists to produce one row per product with the values a pricing or assortment team acts on. The table lists those values next to where each one sits in the recorded search response. On the scraper side, every row is a selector or a parsing rule you write, test and fix; on the API side, it's a field name you read.

Value you need Scraper work Field in the search response
Stable product ID Pull it from the product URL or the page us_item_id
Title Read the product name title
Price Parse price text into a number price (a number, 89.99)
Currency Infer from the symbol or the site currency
Rating Read the star rating rating
Review count Parse the count text reviews
Seller Find the seller line seller_name
Stock state Interpret stock wording or button state availability_status, out_of_stock
Paid placement Detect the sponsored marker sponsored
Product link Build or read the URL product_page_url
Image Read the image source thumbnail

The stock row is where scrapers tend to drift. Stock is often shown as wording or as the state of a button rather than a single value, and each new wording needs a rule. The response gives you two values instead: availability_status as a code (IN_STOCK in the recording) and out_of_stock as a boolean.

Where does the upkeep in a retail scraper come from?

Upkeep in a retail scraper comes from three places: page changes, paid placements and blocking. None of them shows up while you build the prototype, and all of them show up once the scraper runs daily. This is general engineering for any large retail site, not a description of Walmart's own systems.

Page changes are the steady cost. Retail pages change as a site tests layouts and features, so a selector that found the price last month can find nothing, or find the wrong number, this month. A scraper rarely fails loudly here; it returns fewer rows or blank fields, so you need a monitor that compares each run's counts and empty values with the last one.

Paid placements change what a "result" means. If your scraper can't tell a sponsored result from an organic one, your rank and price figures mix the two. Both recorded results carry sponsored: true, which shows how much of a page this can be.

Blocking is the third. Any site this size has to tell people from automated traffic, so a scraper running at volume should expect slow responses, challenge pages and refused requests. Getting around those with proxy rotation or challenge solvers isn't a route we'd recommend. Read Walmart's terms before you build a collector.

What does the Walmart search endpoint return?

The search endpoint returns one page of products for a query, each with typed fields, plus search metadata and a pagination block. The Walmart API has two endpoints, both GET and both 1 credit per successful call: search, which takes a query, and product, which takes a us_item_id.

This is the recorded request:

curl "https://api.perceptlayer.com/v1/walmart/search?query=air+fryer" \
  -H "X-API-Key: $API_KEY"

And the recorded response, trimmed:

{
  "success": true,
  "data": {
    "search_metadata": {
      "query": "air fryer",
      "page": 1,
      "sort": "best_match",
      "total_items": 72
    },
    "results": [
      {
        "us_item_id": "17268119743",
        "title": "Instant Pot 4QT VORTEX 6-in-1 Mini Air Fryer, Air fry, Bake, Roast, Broil, Dehydrate or Reheat, Black, 4 Quarts",
        "price": 89.99,
        "currency": "USD",
        "rating": 4.4,
        "reviews": 87,
        "seller_name": "Walmart.com",
        "availability_status": "IN_STOCK",
        …
        "product_page_url": "https://www.walmart.com/ip/17268119743",
        "out_of_stock": false,
        "sponsored": true
      },
      {
        "us_item_id": "14678059894",
        "title": "Chefman Air Fryer 1500W, 6 Quart, 4 Functions with Touch Controls, Stainless Steel",
        "price": 59.98,
        …
        "rating": 4.6,
        "reviews": 13051,
        …
      }
    ],
    "pagination": {
      "current_page": 1,
      "max_page": 13,
      "has_more": true
    }
  },
  "meta": {
    "endpoint_family": "search",
    "duration_ms": 4134,
    "attempts": 2
  }
}

Two details matter when you build on it. First, the counts: total_items is 72 and max_page is 13, and the response doesn't state a page size, so drive your loop with pagination.has_more and page. Second, us_item_id also appears at the end of product_page_url, and the product endpoint's required parameter has the same name, us_item_id. The product call isn't in our recordings, so run one of these IDs on the product endpoint page to see its fields before you plan around them.

Which search parameters can you set?

Only query is required. sort takes best_match, price_low, price_high, rating_high or new; min_price and max_price are integers; cat_id (up to 64 characters) and facet_filter (up to 2,000 characters) are strings; page is an integer; and country takes us or ca. The product endpoint takes us_item_id (up to 32 characters) and optionally country and slug. The search endpoint page has the full reference and a playground.

How do a Walmart scraper and the endpoints compare?

A scraper trades credits for your engineering time and puts blocking and terms risk on you; the endpoints charge 1 credit per successful call and remove the parsing and the fixes. The table compares them for a recurring job, such as checking price and stock for a product list every day.

DIY Walmart scraper Walmart endpoints
Setup Fetcher, page parsers, stock rules, storage, monitoring API key in the X-API-Key header
Price Parsed from text price as a number, with currency
Stock Rules for each wording you've seen availability_status and out_of_stock
Seller Found on the page seller_name
Sponsored results Yours to detect sponsored on each result
Canada A second set of pages to handle country=ca on either endpoint
When the page changes Parsers break, often silently Named JSON fields; there's no parser of yours to fix
Blocks and challenges Yours to handle at volume Not yours; a failed call returns an error code and costs 0
Speed As fast as you can fetch without being blocked 1 request a second free, at least 5 a second paid
Cost Hosting and your time 1 credit per successful call

A stock and seller check in JavaScript

This Node.js script (save it as check.mjs and run node check.mjs) searches one query, skips sponsored results and flags items that aren't in stock or aren't sold by Walmart.com. It reads only fields from the recorded response and sets a 30-second timeout, well above the recorded 4.1 seconds.

const url = new URL("https://api.perceptlayer.com/v1/walmart/search");
url.searchParams.set("query", "air fryer");
url.searchParams.set("sort", "price_low");

const res = await fetch(url, {
  headers: { "X-API-Key": process.env.API_KEY },
  signal: AbortSignal.timeout(30_000),
});
if (!res.ok) {
  const body = await res.json().catch(() => ({}));
  throw new Error(`${res.status} ${body.error?.code ?? "unknown_error"}`);
}
const { data } = await res.json();

for (const item of data.results ?? []) {
  if (item.sponsored) continue;
  const flags = [];
  if (item.out_of_stock || item.availability_status !== "IN_STOCK") {
    flags.push(item.availability_status ?? "stock unknown");
  }
  if (item.seller_name && item.seller_name !== "Walmart.com") {
    flags.push(`seller: ${item.seller_name}`);
  }
  console.log(item.us_item_id, item.price, item.currency, item.rating, item.reviews, flags.join("; "));
}
console.log("more pages:", data.pagination?.has_more);
console.log("credits used:", res.headers.get("X-Credits-Used"));

If the call times out on your side, don't retry blindly in a tight loop: requests have no idempotency key, so the timed-out call may have succeeded and been billed. Retry once after a pause, and on 429 or 503 wait the seconds in Retry-After.

What does tracking a Walmart item cost?

Tracking cost depends on which pattern you use: product lookups cost 1 credit per item per check, while search sweeps cost 1 credit per page, spread across however many items that page holds. Pick the pattern from what you already know. If you have a list of item IDs, look them up; if you want to see what a query returns, sweep it.

Pattern 1: a fixed list of items

Checking 200 items once a day with /v1/walmart/product is 200 calls × 1 credit = 200 credits a day, or 6,000 credits over a 30-day month. That's more than the 100 free credits you get once on signup, which cover half of one day's check, and inside the Starter pack's 10,000. Twice a day doubles it to 12,000 a month, which fits the Build pack's 50,000.

Pattern 2: sweeping search results

Sweeping 25 queries three pages deep once a day is 25 × 3 = 75 calls × 1 credit = 75 credits a day, or 2,250 credits a month. The cost per item is 1 credit divided by the number of results on each page, so count results on one of your own queries in the playground before you budget. Stop early when has_more is false; a page you don't fetch costs nothing.

The two combine well: sweep search for discovery and price, and spend product calls only on the items whose price or availability_status changed since the last run. See pricing for what credits cost and the credits docs for how they're debited.

Which route fits your job?

The right route depends on how often the job runs and how many products it touches, because that decides whether upkeep or per-call cost is the larger bill. These verdicts assume a scheduled job; for a one-off look at ten products, a browser is faster than either.

  • Price monitoring for a known product list: use the product endpoint with your us_item_id list and store price, currency and the run date. Budget 1 credit per item per check.
  • Seeing how a query ranks products: sweep search with a fixed sort, store the order of results[] per run and keep sponsored so you can report organic and paid positions separately.
  • Stock alerts: read availability_status and out_of_stock per item and alert on a change, not on every run.
  • Third-party seller tracking: group results by seller_name to see which items aren't sold by Walmart.com.
  • Rating and review trends: store rating and reviews per item per week; a weekly check of 500 items is 500 credits a week.
  • Canadian prices: pass country=ca instead of maintaining a second scraper.
  • An agent answering product questions: connect it through the MCP server, as the AI agents docs describe, so it calls search rather than reading pages.

To compare prices across many shops rather than one retailer, Idealo API covers that case, and the marketplaces APIs list other retail sources. To check the fields for your own products, run search in the playground on the Walmart API page, then get a free API key.

APIs in this post

Frequently asked questions

Is scraping Walmart allowed?

That depends on Walmart's terms, how you collect and use the data, and the law where you operate, so read the terms and get legal advice for commercial use. Don't get around blocks, challenges or other protections. Product facts such as price, rating and stock status carry less risk than personal data; leave reviewers' names and details out of what you store.

Can I get Walmart Canada prices?

Yes. Both /v1/walmart/search and /v1/walmart/product take an optional country parameter that accepts us or ca. Each successful call costs 1 credit whichever country you choose. Store currency with every price, since prices from the two countries shouldn't be mixed in one column without converting them.

How do I page through Walmart search results?

Pass page and read the pagination block. The recorded "air fryer" search returned current_page: 1, max_page: 13 and has_more: true, with total_items: 72 in search_metadata. The response doesn't state a page size, so loop while has_more is true and stop at the depth you've budgeted. Each page costs 1 credit.

Does a failed Walmart call cost credits?

No. Only a successful response debits credits. A failed call returns an HTTP status and a JSON error with a code, a message and a request_id, plus X-Credits-Used: 0. A rate-limited call returns 429 with a Retry-After header giving the seconds to wait. The errors docs list every code.

How fast can I check a Walmart product list?

Limits are per account, shared by all its keys, and counted per minute. A free account gets 1 request a second (60 a minute), so 200 product lookups take a little over three minutes. Paying accounts run at least 5 requests a second (300 a minute), which brings that to about 40 seconds. The rate limits docs list each pack's rate.

  1. Shopify Scraper or API: What You Get

    A Shopify scraper vs a 1-credit products call: a recorded store page of 30 products with variant SKUs, prices and stock flags, and the cost per product tracked.

  2. AliExpress Scraper or API: What You Get

    An AliExpress scraper vs 1-credit endpoints: a recorded search with 60 products a page, price.amount, sold_count and is_sponsored, and cost per product.

  3. Google Shopping Scraper or API: What You Get

    A Google Shopping scraper vs one GET at 1 credit: the recorded iphone 15 search with source, extracted_price and product_id, and the cost per item tracked.

Start with 100 free credits

No password to set. We email you a sign-in link, and your key works on every API.

No credit card. 100 free credits on signup.