100 free credits. No credit card required. Get a key

How to scrape Walmart reviews with Go

Walmart reviews, ten a page, with Walmart’s sort, star and aspect filters, star counts and aspects.

The examples use only the standard library (net/http, encoding/json) and decode into a struct that names just the fields they read.

GET /v1/walmart/products/{product_id}/reviews2 credits per callRefunded on failureBeta

Before you start

  1. Get an API keySign up for 100 free credits, no card. Keys start with gs_live_.
  2. Put it in the environmentEvery example reads it from GROUNDSOCIAL_API_KEY: export GROUNDSOCIAL_API_KEY=gs_live_…
  3. Set up Gogo mod init example

Call Walmart reviews API from Go

GET /v1/walmart/products/{product_id}/reviews. Save this as main.go and run go run main.go. It reads the items in reviews and prints reviewText and rating for each.

main.go
package main

import (
	"encoding/json"
	"fmt"
	"log"
	"net/http"
	"net/url"
	"os"
	"time"
)

// The fields this program reads, as the recorded response has them.
type Page struct {
	Reviews []struct {
		ReviewText string  `json:"reviewText"`
		Rating     float64 `json:"rating"`
	} `json:"reviews"`
}

var client = &http.Client{Timeout: 60 * time.Second}

func fetch(q url.Values) (*Page, error) {
	req, err := http.NewRequest("GET", "https://api.groundsocial.dev/v1/walmart/products/5113175776/reviews"+"?"+q.Encode(), nil)
	if err != nil {
		return nil, err
	}
	req.Header.Set("Authorization", "Bearer "+os.Getenv("GROUNDSOCIAL_API_KEY"))
	res, err := client.Do(req)
	if err != nil {
		return nil, err
	}
	defer res.Body.Close()
	if res.StatusCode != http.StatusOK {
		var e struct {
			Error struct {
				Code      string `json:"code"`
				Hint      string `json:"hint"`
				Retryable bool   `json:"retryable"`
			} `json:"error"`
		}
		json.NewDecoder(res.Body).Decode(&e)
		return nil, fmt.Errorf("%s: %s", e.Error.Code, e.Error.Hint)
	}
	var page Page
	if err := json.NewDecoder(res.Body).Decode(&page); err != nil {
		return nil, err
	}
	return &page, nil
}

func main() {
	q := url.Values{}
	q.Set("sort", "recent")
	page, err := fetch(q)
	if err != nil {
		log.Fatal(err)
	}
	for _, item := range page.Reviews {
		fmt.Println(item.ReviewText, item.Rating)
	}
}

The response

A real Walmart response to this call, recorded from the live source and shortened for display: arrays keep their first items and … marks every cut. The recorded page had 10 items in reviews. Live calls return current data in the same shape.

200 OK
{
  "product_id": "5113175776",
  "country": "US",
  "page": 1,
  "total_pages": 430,
  "total_reviews": 20817,
  "average_rating": 4.3,
  "rating_counts": {
    "1": 1907,
    "2": 561,
    "3": 990,
    "4": 2147,
    "5": 15212
  },
  "aspects": [
    {
      "id": "48",
      "name": "Value For Money",
      "score": null,
      "snippetCount": 762
    },
    {
      "id": "658",
      "name": "Screen",
      "score": null,
      "snippetCount": 298
    },
    "… 20 more"
  ],
  "reviews": [
    {
      "reviewId": "450991475",
      "rating": 5,
      "authorId": "8ef2765f815d44d41a6cb5d029a9a864c295d5bd2ce5565a328cb8728965fa8cbff27bf9e6de41a1131d47cf01a241ae",
      "badges": [
        {
          "badgeType": "Custom",
          "contentType": "REVIEW",
          "id": "VerifiedPurchaser",
          "glassBadge": {
            "id": "VerifiedPurchaser",
            "text": "Verified Purchase"
          }
        }
      ],
      "userBadges": [],
      "conditionGroupCode": null,
      "condition": null,
      "userLocation": null,
      "negativeFeedback": 0,
      "positiveFeedback": 0,
      "recommended": null,
      "reviewReferenceId": "16cc1b11-cd28-51c3-9556-7f81c5cd355a",
      "originalLanguage": "English",
      "originalLocale": "en_US",
      "translatedLanguage": "English",
      "translatedLocale": "en",
      "showTranslationCTA": false,
      "reviewSubmissionTime": "11/22/2026",
      "reviewText": "2nd chrome book I have bought",
      "reviewTitle": null,
      "reviewAspects": [],
      "reviewAspectStart": null,
      "reviewAspectEnd": null,
      "reviewSentimentStart": null,
      "…": "18 more fields"
    },
    {
      "reviewId": "450969088",
      "rating": 1,
      "authorId": "098d1ec75fc9b687a38afcd77f24ef2a808a4e2587ea825f0504f31134f73f85bff27bf9e6de41a1131d47cf01a241ae",
      "badges": [
        {
          "badgeType": "Custom",
          "contentType": "REVIEW",
          "id": "VerifiedPurchaser",
          "glassBadge": {
            "id": "VerifiedPurchaser",
            "text": "Verified Purchase"
          }
        }
      ],
      "userBadges": [
        {
          "badgeId": "REVIEW_COUNT",
          "badgeValue": "250"
        }
      ],
      "conditionGroupCode": null,
      "condition": null,
      "userLocation": null,
      "negativeFeedback": 0,
      "positiveFeedback": 0,
      "recommended": null,
      "reviewReferenceId": "8e79810d-2615-5c10-a12f-e42a45864a02",
      "originalLanguage": "English",
      "originalLocale": "en_US",
      "translatedLanguage": "English",
      "translatedLocale": "en",
      "showTranslationCTA": false,
      "reviewSubmissionTime": "11/22/2026",
      "reviewText": "never arrived",
      "reviewTitle": null,
      "reviewAspects": [],
      "reviewAspectStart": null,
      "reviewAspectEnd": null,
      "reviewSentimentStart": null,
      "…": "18 more fields"
    },
    "… 8 more"
  ]
}

Top-level fields

FieldTypeDescription
product_idstring–
countrystring–
pagenumber–
total_pagesnumber | null–
total_reviewsnumber | null–
average_ratingnumber | null–
rating_countsobject–
aspectsobject[]–
reviewsobject[]–

Parameters

NameInTypeDescription
product_id (required)pathstringWalmart item id (the number in /ip/…/<id>), or a product URL. Example: 5113175776.
pagequeryinteger–
limitqueryintegerAt most this many of the page’s 10.
sortquery"relevancy" | "recent" | "rating_high_low" | "rating_low_high" | "oldest" | "most_helpful"relevancy (default), recent, rating_high_low, rating_low_high, oldest, most_helpful. One of relevancy, recent, rating_high_low, rating_low_high, oldest, most_helpful.
ratingqueryinteger–
aspectquerystring–
verified_onlyquery"true" | "false"One of true, false.
countryquery"US" | "CA"US (default) or CA. One of US, CA.
sincequerystringOnly items published on or after this date: YYYY-MM-DD (midnight UTC) or an ISO 8601 timestamp.
untilquerystringOnly items published on or before this date: YYYY-MM-DD (that whole UTC day included) or an ISO 8601 timestamp.

Errors and retries

Every error is JSON with error.code (stable: branch on it), message, hint (what to do next), docs_url and retryable. A failed call is never charged. Retry only when retryable is true, after the Retry-After header.

Errors
// fetch returns the API error as "code: hint". To retry the retryable ones
// (rate_limited, upstream_timeout), wait for Retry-After and call again:
for attempt := 0; attempt < 3; attempt++ {
	page, err = fetch(q)
	if err == nil {
		break
	}
	time.Sleep(2 * time.Second)
}
StatusMeaning
200A page of reviews.
400Invalid input. Nothing was charged.
401Missing or invalid API key.
402Not enough credits, a spend cap was reached, or payment is required.
403The target is private, or the account is suspended.
404The product or category does not exist.
429Too many requests. Wait for Retry-After seconds.
503Walmart is temporarily unavailable. Retryable; nothing was charged.

Every error code and what to do about it.

Pricing

Cost
Per call2 credits per call
1,000 calls$2.00 on the starter pack, $0.80 at volume
No key (MPP or x402)$0.02 per call
Failed callRefunded, never charged

Every response has x-credits-charged and x-credits-remaining headers. Credits never expire. Packs and calculator.

From an AI agent (MCP)

The same call is the walmart_reviews_get tool on the hosted MCP server, so Claude, Cursor or any MCP client can make it without code. Add the server once:

bash
claude mcp add --transport http groundsocial https://api.groundsocial.dev/mcp

Then ask for it in words (“Walmart reviews of a product, paged, with sort and star filters”), or call the tool directly:

json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "walmart_reviews_get",
    "arguments": {
      "product_id": "5113175776",
      "sort": "recent"
    }
  }
}

MCP setup for Claude Desktop, Cursor, VS Code and ChatGPT.

Catch quality problems

Read rating=1 sort=recent daily.

Keep going

Run it on your own data

One key for Walmart and 76 more platforms, over REST or MCP. Free credits on signup, no card.

Walmart is a trademark of Walmart Apollo, LLC. We are not affiliated with or endorsed by Walmart.