Blog / API guides

Google Shopping Scraper or API: What You Get

A Google Shopping scraper fetches result pages for a product query and turns each listing into a row: title, seller, price, rating and an ID you can track. You write and maintain the fetching, the parsing and the checks that catch silent breakage. The alternative is GET /v1/google-shopping/search, which returns those rows as JSON for 1 credit per successful call. This post starts from the row you actually need, shows what each route does to produce it, and prices one tracked item.

What row does a Google Shopping scraper have to produce?

Before comparing routes, fix the output. A useful Google Shopping row says what was searched and where, which product came back, who sells it, at what price as a number, and an ID that lets you recognise the same product tomorrow. Everything else, such as images or badges, is optional. The table maps each part of that row to the work a scraper does and to the field the endpoint returns.

Part of the row What a scraper does to get it Endpoint field
Query context Records the query, country, language, device and offset it sent search_parameters (q, gl, hl, start, device)
Product name Finds the title text in each result block title
Seller Finds the merchant label, which may combine a marketplace and a shop source
Price Finds the price text, strips the currency symbol and separators, converts to a number price (text) and extracted_price (number)
Rating and reviews Finds and parses star and count text rating, reviews
Product ID Pulls an identifier out of a link or attribute product_id, plus link to the product page
Order on the page Counts result blocks position, rank_absolute, category

If your scraper already fills every row of that table reliably, at the volume you need, the question is only whether its upkeep costs more than the credits. If it doesn't, the endpoint is the shorter path to the same row.

Where does the work in a scraper go?

Most of a shopping scraper's code isn't the first parse. It's the parts that keep the output correct over months: building requests consistently, fetching at volume, normalising prices, keeping IDs stable and noticing when any of it quietly fails. These are general engineering costs of scraping any large search page, and each one recurs.

  1. Request building. Prices differ by country, language and device, so every request has to pin those the same way each run. Otherwise a change in context looks like a price move.
  2. Fetching at volume. Any large site has to tell people from automated traffic. Expect slow responses, challenge pages and blocked requests at volume. Getting around a site's protections isn't something we'd recommend; if you hit them, stop and reconsider the approach.
  3. Price normalisation. Price text varies by locale: symbols before or after the number, commas or dots as decimal separators, ranges, and labels next to the figure. Each format needs a rule, and each rule needs a test.
  4. Identity. A tracker compares today with yesterday, so it needs an ID that survives layout changes. Positions shift between runs, so they can't be the key.
  5. Silent failure. A scraper rarely crashes when a page changes. It returns fewer rows, or rows with an empty price. You need a monitor that compares each run with the last one.

Then there are the terms. Read Google's terms of service before you build a collector, and keep a record of what you store and why.

What does the recorded iphone 15 search return?

The Google Shopping API on Perceptlayer has one endpoint, GET /v1/google-shopping/search. It needs q and takes eight optional parameters: gl, hl, location, uule, start, device, small_business and shoprs. This is the request behind the recording, a US English search for iphone 15:

curl "https://api.perceptlayer.com/v1/google-shopping/search?q=iphone+15&gl=us&hl=en" \
  -H "X-API-Key: $API_KEY"

An excerpt of the recorded response, trimmed with …:

{
  "search_parameters": {
    "q": "iphone 15",
    "gl": "us",
    "hl": "en",
    "start": 0,
    "device": "desktop"
  },
  "shopping_results": [
    {
      "position": 1,
      "category": "Popular products",
      "title": "Apple iPhone 15",
      "source": "Walmart - Wireless Source",
      "rating": 4.7,
      "reviews": 45000,
      "extensions": [
        " & more"
      ],
      "rank_absolute": 1,
      "product_id": "4263606017411565992",
      "link": "https://www.google.com/shopping/product/4263606017411565992",
      "price": "$393.73",
      "extracted_price": 393.73,
      "thumbnail": "data:image/gif;base64,R0lGODlhAQABAIAAAP///////yH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="
      …
    },
    {
      "position": 2,
      "title": "Apple iPhone 15 128GB",
      "source": "Best Buy",
      "rating": 4.4,
      "reviews": 94,
      "product_id": "4379032623638529631",
      "price": "$441.00",
      "extracted_price": 441,
      …
    }
  ],
  "pagination": {
    "current_page": 1,
    "start": 0,
    "next_start": 10
  }
}

What the recording tells you before you build on it

Read a recorded response for its quirks, not only its fields. Five details in this one change how you'd write a tracker.

  • The two results are different products. "Apple iPhone 15" and "Apple iPhone 15 128GB" have different product_id values and different sellers. Compare prices within one product_id, never across a results page.
  • source is a label, not a clean seller key. "Walmart - Wireless Source" combines a marketplace name and a shop name. Store it as written; splitting it on the hyphen is a guess.
  • rank_absolute is 1 on both results while position is 1 and 2. Use position for order on the page, and don't treat either as a key.
  • thumbnail is a placeholder. The data URI decodes to a 1×1 GIF. If you need product images, this field won't supply them.
  • extensions is display text. " & more" has a leading space and no meaning on its own, so treat it as optional decoration.

The full result also carries a product_token, cut here for length. The Search endpoint page lists each parameter with its type and limits.

How do a scraper and the endpoint compare?

A scraper costs engineering time, hosting and terms risk, and gives you whatever you can parse. The endpoint costs credits per call and gives you named, typed fields. The table compares them for a recurring job: checking a fixed list of products several times a day.

DIY Google Shopping scraper GET /v1/google-shopping/search
Setup Fetcher, parsers, price normaliser, storage, run monitor A key in the X-API-Key header
Price as a number Your locale rules extracted_price, next to the price text
Product identity An ID you extract and hope stays put product_id on every recorded result
Locale and device Pinned in your own request code gl, hl, location, uule, device, echoed in search_parameters
Paging Your own offset logic start in the request; pagination with current_page and next_start in the response
When the page changes Your parser breaks, often silently You read the same named fields
Blocks and challenges Yours to handle 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

On paging, the names match: the request takes start, and the recorded pagination shows next_start: 10. The recording doesn't include a second-page call, so check one in the playground before you rely on it.

Checking a response instead of parsing a page

With the endpoint, the code you keep is validation rather than parsing. This script runs one search, keeps rows that have both a product_id and an extracted_price, flags the rest, and prints what the call cost from X-Credits-Used. It reads only fields present in the recording and treats any of them as possibly missing.

import os
import requests

API = "https://api.perceptlayer.com/v1/google-shopping/search"
HEADERS = {"X-API-Key": os.environ["API_KEY"]}

def check(query, gl="us", hl="en"):
    r = requests.get(API, params={"q": query, "gl": gl, "hl": hl},
                     headers=HEADERS, timeout=30)
    if r.status_code != 200:
        err = r.json().get("error", {})
        print("failed:", r.status_code, err.get("code"), "credits used: 0")
        return []
    data = r.json()
    context = data.get("search_parameters", {})
    good, flagged = [], []
    for item in data.get("shopping_results", []):
        row = {
            "q": context.get("q"),
            "gl": context.get("gl"),
            "device": context.get("device"),
            "position": item.get("position"),
            "product_id": item.get("product_id"),
            "title": item.get("title"),
            "source": item.get("source"),
            "price": item.get("extracted_price"),
        }
        if row["product_id"] and isinstance(row["price"], (int, float)):
            good.append(row)
        else:
            flagged.append(row)
    print(f"{len(good)} rows, {len(flagged)} flagged, "
          f"credits used: {r.headers.get('X-Credits-Used')}, "
          f"remaining: {r.headers.get('X-Credits-Remaining')}")
    return good

for row in check("iphone 15"):
    print(row["product_id"], row["source"], row["price"])

A rate-limited (429) or temporarily unavailable (503) reply carries a Retry-After header with the seconds to wait; add a retry around the request if you run this on a schedule. Requests have no idempotency key, so a call whose reply was lost to a client timeout may have succeeded and been billed. The errors docs list every code.

What does each tracked item cost?

On the endpoint, cost follows calls. If each tracked item gets its own query, one check of one item is 1 credit, so the cost of an item is the number of checks you run. Credits per month = items × checks a day × days. The table works that formula for three common schedules.

Schedule Calls Credits Fits in
100 items, one check, once 100 100 The 100 free credits on signup
300 items, once a week, 4 weeks 1,200 1,200 The Starter pack's 10,000
40 items, four times a day, 30 days 4,800 4,800 The Starter pack's 10,000
250 items, twice a day, 30 days 15,000 15,000 The Build pack's 50,000

A broad query can cover several items at once. If one search returns rows for products you track, those items share the call, and the cost per item falls below 1 credit. Count the matched product_id values per call in your own runs before you plan on it, since the number of results per page isn't documented.

The 100 free credits come once, after verifying your email, and aren't topped up. Purchased credits last 12 months, with no subscription. Free accounts run at 1 request a second, so 100 sequential checks take about 100 seconds; paying accounts get at least 5 a second, as the rate limits docs describe. See pricing for what credits cost and the credits docs for how debits work.

Which route should you choose?

Choose by how often you check, how many items, and whether the data feeds code or a person. Upkeep dominates for recurring jobs, and per-call cost dominates only at very high volume with a team that already runs scrapers. These verdicts assume the row described above.

  • Daily or hourly price checks on a product list: use the endpoint. Key on product_id, store source and extracted_price with search_parameters, and budget items × checks credits. The price monitoring tool tutorial builds the full tracker with history and drop alerts.
  • One-off research on a handful of products: open Google Shopping in a browser. Neither a scraper nor an API is worth it for ten lookups.
  • Product images or rich listing detail: neither route as tested here. The recorded thumbnail is a placeholder, so look at the retailer's own data for images.
  • Comparing one retailer's prices in depth: query that retailer's source as well. The Walmart scraper or API and eBay scraper or API posts cover those endpoints.
  • An agent answering "where is this cheapest?": give it the endpoint through the MCP server, as the AI agents docs describe, so it calls search instead of reading pages.
  • Learning how scraping works: write a scraper against a practice site, not a large search engine.

To see the fields for your own products, run a query in the playground on the Google Shopping API page, then get a free API key when they fit.

APIs in this post

Frequently asked questions

Is scraping Google Shopping allowed?

That depends on Google's terms of service, 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. Through the endpoint, data is collected from publicly available sources and returned as found at the time of the call.

How much does one Google Shopping call cost?

A successful call to GET /v1/google-shopping/search costs 1 credit, shown in the X-Credits-Used header, with the balance after the call in X-Credits-Remaining. Failed calls cost nothing. When the balance runs out, calls return insufficient_credits (402) and nothing more is debited; there is no automatic top-up.

Can I get prices for a specific country?

Yes. Pass a two-character country code in gl and a language code in hl; the recording used gl=us and hl=en, and both are echoed in search_parameters. For a place more specific than a country, the endpoint takes location (up to 63 characters) or uule (up to 500). Keep these fixed across runs so prices stay comparable.

Why is extracted_price better than parsing the price text?

price is display text such as "$393.73", with a currency symbol a scraper would have to strip. extracted_price holds the same value as a number, 393.73, ready for comparison and arithmetic. Store the number for analysis and keep the text only if you need to show the original string.

How fast can I run a batch of Google Shopping checks?

Limits are per account, shared by all its keys, and counted per minute. A free account gets 1 request a second (60 a minute); paying accounts run at least 5 a second (300 a minute), and each pack includes a rate. A 429 response carries a Retry-After header with the seconds to wait before retrying.

  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. Google Shopping API: Product Prices and Offers as JSON

    One GET to /v1/google-shopping/search returns product titles, sellers, prices and ratings as JSON. Parameters, a response and the cost of 500 products a day.

  3. Amazon Scraper or API: Search, Offers and Reviews

    An Amazon scraper vs 18 endpoints at 1 credit a call: a recorded laptop stand search with asin, price.amount and rating, and the domains each call takes.

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.