Shopping search (/shopping)

Reference for /shopping: shopping search parameters, response fields, code in 5 languages, GET and POST forms, and a sample response.

Updated View as Markdown

Google Shopping products with price, discount, delivery and rating. Results are in shopping. The product page is Google Shopping API.

Try in PlaygroundOpens the dashboard playground with this request filled in (sign in first).

Request

POST https://api.bestserp.com/shopping with a JSON body, or GET https://api.bestserp.com/shopping with the same parameters in the query string. The key goes in the X-API-KEY header either way (authentication).

POST
curl -X POST 'https://api.bestserp.com/shopping' \
  -H 'X-API-KEY: YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{"q":"mechanical keyboard"}'
GET
curl -G 'https://api.bestserp.com/shopping' \
  -H 'X-API-KEY: YOUR_API_KEY' \
  --data-urlencode 'q=mechanical keyboard'

Parameters

Unknown parameters are refused (unknown_parameter), so a typo never goes unnoticed.

ParameterTypeDefaultDescription
qrequiredstringSearch query (1–256 characters).
glstringusCountry, 2-letter code (us, gb, vn, de…). The search runs from an IP in that country when one is free, else from another one (see ipCountry).
hlstringenInterface language (en, vi, de…).
pagesinteger1Result pages or scroll loads to fetch, 1–5. Each costs 1 credit.
includeThumbnailsbooleanfalseInclude inline base64 thumbnails (~20 KB each).
noCachebooleanfalseSkip the 1-hour result cache (5 minutes for news).
asyncbooleanfalseAnswer 202 immediately with a requestId to poll.
timeoutnumber60Seconds to wait before answering 202 (1–120).
autocorrectbooleanAccepted for compatibility; no effect.

Response fields

Empty fields are left out of each item.

shopping[]

FieldMeaning
positionRank of the product, from 1.
titleProduct name.
sourceMerchant name.
sourceIconMerchant icon (data: URI or Google static URL).
pricePrice as displayed, with its currency.
priceValuePrice as a number, for sorting and comparing.
originalPricePrice before a discount, as displayed.
discountDiscount as displayed.
deliveryDelivery note, e.g. Free delivery.
ratingAverage rating out of 5.
ratingCountNumber of reviews.
imageUrlThumbnail as an inline data: URI, only with includeThumbnails: true (about 20 KB each).

Every response

FieldMeaning
searchParametersYour request after validation, with defaults filled in (q, gl, hl, type, page or pages...).
requestIdID of this request. Poll GET /requests/{requestId} for async requests and for final links.
creditsCredits charged for this request (refunded automatically if it fails).
cachedtrue when the answer came from the recent-result cache (1 hour, 5 minutes for news).
linksPendingtrue while Google redirect links are being replaced by final URLs; poll the request to get them.
unresolvedLinksLinks that are still Google redirects: they work, but are not the final URL.
durationMsTime the search took, in milliseconds.
ipCountryCountry of the IP the search ran from (same code as gl). Another country than gl when no IP there was free: the search runs anyway instead of waiting. Missing when unknown.

Sample response

200 OK
{
  "searchParameters": {
    "q": "mechanical keyboard",
    "gl": "us",
    "hl": "en",
    "type": "shopping",
    "pages": 1,
    "engine": "google"
  },
  "shopping": [
    {
      "position": 1,
      "title": "Keyline K2 Wireless Mechanical Keyboard, Hot-Swappable",
      "source": "Keyline Store",
      "price": "$89.99",
      "priceValue": 89.99,
      "originalPrice": "$109.99",
      "discount": "18% off",
      "delivery": "Free delivery",
      "rating": 4.6,
      "ratingCount": 1820,
      "imageUrl": "data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='320' height='200'><rect width='320' height='200' fill='%232b2d42'/></svg>"
    },
    {
      "position": 2,
      "title": "TypeCraft 75% Mechanical Keyboard, Gasket Mount",
      "source": "Desk Setup Co.",
      "price": "$129.00",
      "priceValue": 129,
      "delivery": "Free delivery by Mon",
      "rating": 4.8,
      "ratingCount": 642,
      "imageUrl": "data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='320' height='200'><rect width='320' height='200' fill='%23e9ecef'/></svg>"
    },
    {
      "position": 3,
      "title": "Budget Mechanical Keyboard with Red Switches",
      "source": "ShopMart",
      "price": "$34.99",
      "priceValue": 34.99,
      "delivery": "$4.99 delivery",
      "rating": 4.2,
      "ratingCount": 5310,
      "imageUrl": "data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='320' height='200'><rect width='320' height='200' fill='%23212529'/></svg>"
    }
  ],
  "requestId": "5b0c8a52-3f0e-4d55-9a2a-0f3a8e2d1c11",
  "credits": 1,
  "cached": false,
  "linksPending": false,
  "unresolvedLinks": 0,
  "durationMs": 2950
}

Limits

  • Returns the Shopping results list. Product detail pages (every seller's offer, specifications, review text) are not available.
  • Price filters and sorting options are not supported; filter on priceValue in your code.
  • Prices are as Google displays them for the country (gl); convert currencies yourself if you compare countries.
  • Targeting is by country (gl) and interface language (hl). City-level location is not supported yet: a request with location is refused with an explicit error.
  • Results are what a desktop browser sees. There is no mobile SERP option yet.
  • 60 searches per minute per account by default; ask on Telegram for more.

Errors and their credit rules are on the errors page.