> ## Documentation Index
> Fetch the complete documentation index at: https://docs.hasdata.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Walmart Reviews Scraper API

The Walmart Reviews Scraper API returns the customer reviews of a single Walmart item, ten a page, with the sorting and filtering the product page itself offers.

<Info>
  HasData is an independent service and is not affiliated with, endorsed by, or sponsored by Walmart. Walmart is a trademark of its respective owner. This API works with publicly available data only.
</Info>

## Get Your API Key

Sign in at [hasdata.com](https://app.hasdata.com/sign-in), go to your account settings, and copy your API key.
All requests must include your key in the `x-api-key` header.

## Request Cost and API Credits

Each request to the Walmart Reviews Scraper API consumes **API Credits** from your account balance.

* **Cost per request:** 10 API Credits
* Credits are deducted only for successful requests.
* Your total available credits depend on your active plan.

<Tip>You can use your credits across all HasData APIs. The same credit balance is shared platform-wide.</Tip>
<Warning>**Unused credits do not roll over.** Any remaining credits expire at the end of the current billing period.</Warning>

To monitor your credit usage and remaining balance, sign in to your account dashboard at [app.hasdata.com](https://app.hasdata.com/sign-in).

## Make Your First Request

<CodeGroup>
  ```bash cURL theme={null}
  curl --request GET -G \
    --url 'https://api.hasdata.com/scrape/walmart/reviews' \
    --data-urlencode 'itemId=1028936148' \
    --data-urlencode 'url=https://www.walmart.com/ip/Restored-Apple-iPhone-14-Carrier-Unlocked-128-GB-Starlight-MPUN3LL-A-Refurbished/1028936148' \
    --data-urlencode 'language=en' \
    --data-urlencode 'page=1' \
    --data-urlencode 'sort=mostRelevant' \
    --header 'Content-Type: application/json' \
    --header 'x-api-key: <your-api-key>'
  ```

  ```javascript Node.js theme={null}
  const axios = require('axios').default;

  const options = {
    method: 'GET',
    url: 'https://api.hasdata.com/scrape/walmart/reviews',
    params: {
      itemId: '1028936148',
      url: 'https://www.walmart.com/ip/Restored-Apple-iPhone-14-Carrier-Unlocked-128-GB-Starlight-MPUN3LL-A-Refurbished/1028936148',
      language: 'en',
      page: '1',
      sort: 'mostRelevant'
    },
    headers: {'Content-Type': 'application/json', 'x-api-key': '<your-api-key>'}
  };

  try {
    const { data } = await axios.request(options);
    console.log(data);
  } catch (error) {
    console.error(error);
  }
  ```

  ```python Python theme={null}
  import requests

  url = "https://api.hasdata.com/scrape/walmart/reviews"

  querystring = {"itemId":"1028936148","url":"https://www.walmart.com/ip/Restored-Apple-iPhone-14-Carrier-Unlocked-128-GB-Starlight-MPUN3LL-A-Refurbished/1028936148","language":"en","page":"1","sort":"mostRelevant"}

  headers = {
      "Content-Type": "application/json",
      "x-api-key": "<your-api-key>"
  }

  response = requests.get(url, headers=headers, params=querystring)

  print(response.json())
  ```

  ```php PHP theme={null}
  <?php

  $params = [
      "itemId" => "1028936148",
      "url" => "https://www.walmart.com/ip/Restored-Apple-iPhone-14-Carrier-Unlocked-128-GB-Starlight-MPUN3LL-A-Refurbished/1028936148",
      "language" => "en",
      "page" => "1",
      "sort" => "mostRelevant",
  ];

  $curl = curl_init();

  curl_setopt_array($curl, [
    CURLOPT_URL => "https://api.hasdata.com/scrape/walmart/reviews?" . http_build_query($params),
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_CUSTOMREQUEST => "GET",
    CURLOPT_HTTPHEADER => [
      "Content-Type: application/json",
      "x-api-key: <your-api-key>",
    ],
  ]);

  $response = curl_exec($curl);
  curl_close($curl);

  echo $response;
  ```

  ```java Java theme={null}
  OkHttpClient client = new OkHttpClient();

  HttpUrl url = HttpUrl.parse("https://api.hasdata.com/scrape/walmart/reviews")
    .newBuilder()
    .addQueryParameter("itemId", "1028936148")
    .addQueryParameter("url", "https://www.walmart.com/ip/Restored-Apple-iPhone-14-Carrier-Unlocked-128-GB-Starlight-MPUN3LL-A-Refurbished/1028936148")
    .addQueryParameter("language", "en")
    .addQueryParameter("page", "1")
    .addQueryParameter("sort", "mostRelevant")
    .build();

  Request request = new Request.Builder()
    .url(url)
    .get()
    .addHeader("Content-Type", "application/json")
    .addHeader("x-api-key", "<your-api-key>")
    .build();

  Response response = client.newCall(request).execute();
  ```

  ```csharp C# theme={null}
  using System.Net.Http;
  using System.Web;

  var client = new HttpClient();

  var query = HttpUtility.ParseQueryString(string.Empty);
  query["itemId"] = "1028936148";
  query["url"] = "https://www.walmart.com/ip/Restored-Apple-iPhone-14-Carrier-Unlocked-128-GB-Starlight-MPUN3LL-A-Refurbished/1028936148";
  query["language"] = "en";
  query["page"] = "1";
  query["sort"] = "mostRelevant";

  var url = $"https://api.hasdata.com/scrape/walmart/reviews?{query}";

  var request = new HttpRequestMessage(new HttpMethod("GET"), url);
  request.Headers.Add("x-api-key", "<your-api-key>");

  using var response = await client.SendAsync(request);
  response.EnsureSuccessStatusCode();
  var content = await response.Content.ReadAsStringAsync();
  Console.WriteLine(content);
  ```

  ```ruby Ruby theme={null}
  require 'net/http'
  require 'uri'

  uri = URI("https://api.hasdata.com/scrape/walmart/reviews")
  params = {
    "itemId" => "1028936148",
    "url" => "https://www.walmart.com/ip/Restored-Apple-iPhone-14-Carrier-Unlocked-128-GB-Starlight-MPUN3LL-A-Refurbished/1028936148",
    "language" => "en",
    "page" => "1",
    "sort" => "mostRelevant",
  }
  uri.query = URI.encode_www_form(params)

  http = Net::HTTP.new(uri.host, uri.port)
  http.use_ssl = true

  request = Net::HTTP::Get.new(uri)
  request["Content-Type"] = 'application/json'
  request["x-api-key"] = '<your-api-key>'

  response = http.request(request)
  puts response.read_body
  ```

  ```rust Rust theme={null}
  use reqwest::blocking::Client;

  fn main() -> Result<(), Box<dyn std::error::Error>> {
      let client = Client::new();
      let res = client
          .get("https://api.hasdata.com/scrape/walmart/reviews")
          .query(&[("itemId", "1028936148")])
          .query(&[("url", "https://www.walmart.com/ip/Restored-Apple-iPhone-14-Carrier-Unlocked-128-GB-Starlight-MPUN3LL-A-Refurbished/1028936148")])
          .query(&[("language", "en")])
          .query(&[("page", "1")])
          .query(&[("sort", "mostRelevant")])
          .header("Content-Type", "application/json")
          .header("x-api-key", "<your-api-key>")
          .send()?
          .text()?;
      println!("{}", res);
      Ok(())
  }
  ```

  ```go Go theme={null}
  package main

  import (
  	"fmt"
  	"io"
  	"net/http"
  	"net/url"
  )

  func main() {
  	params := url.Values{}
  	params.Set("itemId", "1028936148")
  	params.Set("url", "https://www.walmart.com/ip/Restored-Apple-iPhone-14-Carrier-Unlocked-128-GB-Starlight-MPUN3LL-A-Refurbished/1028936148")
  	params.Set("language", "en")
  	params.Set("page", "1")
  	params.Set("sort", "mostRelevant")

  	u := "https://api.hasdata.com/scrape/walmart/reviews?" + params.Encode()

  	req, _ := http.NewRequest("GET", u, nil)
  	req.Header.Add("Content-Type", "application/json")
  	req.Header.Add("x-api-key", "<your-api-key>")

  	res, _ := http.DefaultClient.Do(req)
  	defer res.Body.Close()

  	body, _ := io.ReadAll(res.Body)
  	fmt.Println(string(body))
  }
  ```
</CodeGroup>

## API Parameters

| Parameter | Default Value | Required | Description |
| - | - | - | - |
| `itemId` | 1028936148 | No | Walmart item id, taken from a product URL or from the id field of the Walmart Search API response. On `walmart.com` it is numeric (for example `14977205582`), on `walmart.ca` an alphanumeric code (for example `6NZMJ5CW6MH2`). Required unless `url` is provided. |
| `url` | [https://www.walmart.com/ip/Restored-Apple-iPhone-14-Carrier-Unlocked-128-GB-Starlight-MPUN3LL-A-Refurbished/1028936148](https://www.walmart.com/ip/Restored-Apple-iPhone-14-Carrier-Unlocked-128-GB-Starlight-MPUN3LL-A-Refurbished/1028936148) | No | A full Walmart product URL whose reviews to scrape. When provided, it overrides `itemId` and the storefront is taken from the URL itself. Required unless `itemId` is provided. |
| `domain` | - | No | Walmart storefront the item belongs to. Each storefront has its own catalog, item ids and review pool, so an id from one storefront does not resolve on another. Ignored when `url` is provided. Default is `walmart.com`. |
| `language` | en | No | Language of the review page. Availability depends on the storefront - `walmart.com` serves `en` and `es`, `walmart.ca` serves `en` and `fr`. A language the storefront does not support falls back to its default. Reviews themselves are returned in the language their author wrote them in. |
| `page` | 1 | No | Page of reviews to return, ten reviews a page. The response reports the last available page in `pagination.totalPages`, the next one in `pagination.nextPage`, and how many reviews the current filters select in `pagination.totalResults`. Note that only reviews carrying written text are paginated, so the ceiling follows `reviewsInformation.totalReviews` rather than the larger `reviewsInformation.totalRatings`. Default is `1`. |
| `sort` | mostRelevant | No | Order of the returned reviews, named as the Walmart review page names it. Default is `mostRelevant`. |
| `rating` | - | No | Return only reviews carrying this star rating, from `1` to `5`. The Star rating group of the `filters` block lists the ratings this item actually has, each with the `value` to send here and a `count` of how many reviews to expect. |
| `aspectId` | - | No | Return only reviews mentioning one topic. Send the `value` of the topic you want, taken from the Frequent mentions group of the `filters` block in the response - given `{"name": "Battery Life", "value": "6049", "count": 8}` you send `6049`, and `count` is how many reviews to expect. **Only one topic per request**, Walmart rejects a list of them. Topics belong to the product rather than to Walmart: a phone offers Battery Life or Display, a coffee offers Flavor or Aroma, and some items offer none at all - so make an unfiltered request first and read the block, instead of reusing a topic id across products. |
| `condition` | - | No | Return only reviews written about one condition of the item. Send the `value` from the Condition group of the `filters` block - given `{"name": "Restored: Like New", "value": "5"}` you send `5`. **Only one condition per request.** This group appears for items Walmart sells in several conditions, and only when the request already names one: reach the variant through the `url` parameter with its `conditionGroupCode`, as in `https://www.walmart.com/ip/1028936148?conditionGroupCode=2`, and the block then lists the condition that variant carries. An item sold in a single condition has no such group, and no reviews to separate by it. |
| `verifiedPurchasesOnly` | - | No | Return only reviews left by customers whose purchase Walmart confirmed. Narrows the pool considerably, since most reviews are unverified or syndicated from the manufacturer. |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.