Get Google Shopping Product Data in Python and Node
To get Google Shopping product data in Python or Node, send one GET request to the Google Shopping endpoint with your search text in q, then read the results.shopping list from the JSON. Each product carries its title, store, price as text and as a number, currency, link and picture, plus rating, reviews, shipping and delivery when the listing shows them.
Short answer: GET /api/google/shopping with q, and country, num, language and format if you want them, and your key in the X-API-Key header. One call is one charge: $0.35 per 1K API calls at the default rate, pay as you go, no subscription. At 20 products per call that is about $0.0175 per 1,000 products, if every call returns the full page. New accounts get 10 free API calls shared across services. See pricing and the Google Shopping API page.
Google Shopping is the product listing Google shows for a shopping search: a title, a store, a price and a picture for each product. As data it is a list of products for any search text, which price trackers, catalogue checks and comparison pages lean on. Serpent is not affiliated with Google.
The call is small. The work is around it: reading prices as numbers, coping with fields that are null, counting what came back, and saving the rows. The code below does each, in Python and Node.
One thing first. The answers shown are live answers: three calls made in production on 2 December 2026 at about 14:00 UTC. The snippets ran against a stand-in that hands those three answers back, so the output below is what the code printed for them.
What does the request look like?
It is a GET request to https://apiserpent.com/api/google/shopping with your key in an X-API-Key header. Only q is required.
| Parameter | Required | Default | What it takes |
|---|---|---|---|
q | Yes | none | The search text, for example iphone 16 case |
country | No | us | A country code, for example us, gb, de |
num | No | — | How many products you want, a number from 1 to 100. The examples send 20 |
language | No | — | A two-letter language code, for example en, de |
format | No | — | full or simple. The snippets below leave it out |
From a terminal it is one command (example code, not run):
curl -G "https://apiserpent.com/api/google/shopping" \
--data-urlencode "q=iphone 16 case" -d country=us -d num=20 \
-H "X-API-Key: sk_live_your_api_key"
The answer is JSON. These are its top-level fields: success, query, type, country, a results object that holds the shopping list and totalResults, and a meta object that includes totalShopping and timestamp, and a delivery object with requested, returned and note. The answers carry success set to true, which none of the code below reads. This is the live answer for iphone 16 case cut to its first product, with the rest of the list left out:
{
"success": true,
"query": "iphone 16 case",
"type": "shopping",
"country": "us",
"results": {
"shopping": [
{
"position": 1,
"title": "iPhone FineWoven Wallet with MagSafe – Magenta",
"link": "https://www.apple.com/shop/product/mk9g4zm/a/iphone-finewoven-wallet-with-magsafe-magenta",
"source": "Apple",
"price": "$59.00",
"currency": "USD",
"thumbnail": "https://store.storeimages.cdn-apple.com/1/as-images.apple.com/is/MK9G4?wid=890&hei=890&fmt=jpeg&qlt=90&.v=1786052582421",
"product_rating": null,
"product_reviews": null,
"product_reviews_text": null,
"sponsored": false,
"snippet": null,
"shipping": null,
"delivery": null,
"availability": null,
"condition": null,
"price_details": [],
"badges": [],
"variants": [],
"product_details": [],
"extracted_price": 59,
"product_id": null,
"offer_id": null,
"product_link": null
}
],
"totalResults": 16
},
"meta": {
"totalShopping": 16,
"timestamp": "2026-12-02T14:00:20.692Z"
},
"delivery": {
"requested": 20,
"returned": 16,
"note": "Delivered most of the requested results for this search."
}
}
How do you read the answer in Python?
Install requests, put your key in place of the placeholder and use this. shopping() makes the call and returns the JSON. products_of() returns the product list, or an empty list when it is missing. show() tests that list, not the HTTP status, because a search with nothing to show is a different thing from a failed call.
import requests
API_KEY = "sk_live_your_api_key"
BASE = "https://apiserpent.com/api/google/shopping"
def shopping(q, country="us", num=20, language=None):
params = {"q": q, "country": country, "num": num}
if language:
params["language"] = language
r = requests.get(BASE, params=params, headers={"X-API-Key": API_KEY}, timeout=60)
r.raise_for_status()
return r.json()
def products_of(answer):
"""The list of products, or an empty list. Never assume it is there or that it is full."""
return (answer.get("results") or {}).get("shopping") or []
def show(q, num=20):
answer = shopping(q, num=num)
products = products_of(answer)
if not products:
print(f'No products came back for "{q}"')
return
print(f'{answer["query"]} | {answer["country"]} | returned {len(products)} products')
for p in products:
price = p.get("price") or "-"
print(f'{p.get("position", "-"):>2} {price:>9} {p.get("source") or "-":<17} {(p.get("title") or "")[:44]}')
for q in ("iphone 16 case", "kitchen knife set", "xqzvbn plorf wuggle 9981"):
show(q)
print()
The output below is from the live answers, for three searches. I ran the code above with only the HTTP request swapped for the answer files, so these are the lines the snippet printed. The third search is a nonsense text, and its answer has no products:
iphone 16 case | us | returned 16 products
1 $59.00 Apple iPhone FineWoven Wallet with MagSafe – Magen
2 $54.95 Apple Hikawa Grip & Stand for iPhone (MagSafe Comp
3 $39.95 Apple PopSockets Low-Pro Grip & Stand (MagSafe com
4 $49.95 Apple MOFT Find My MagSafe Wallet Stand
5 $49.95 Apple MOFT Snap Field MagSafe Wallet Stand
6 $59.95 Apple Herschel Cloud Sling for iPhone
7 $49.00 Apple iPhone 16 Silicone Case with MagSafe – Ultra
8 $39.95 Apple Native Union Active Wallet Magnetic Stand (M
9 $49.00 Apple Beats iPhone 16 Case with MagSafe — Special
10 $49.00 Apple iPhone 16 Clear Case with MagSafe
11 $19.95 Apple Tech21 Wrist Lanyard (2 Pack)
12 $39.95 Apple Aer Split Kit Storage Pouch
13 $59.95 Apple Bellroy Travel Organizer
14 $59.95 Apple Aer Cable Kit 3 Organizer
15 $29.95 Apple Native Union Active Organizer
16 $49.00 Apple iPhone 16 Silicone Case with MagSafe – Black
kitchen knife set | us | returned 6 products
1 $665.00 Food Network Best Overall: Wusthof Classic 9-Piece Knife
2 $149.99 Food Network Best Value Set: Ginsu Gourmet Chikara Series
3 $295.95 Food Network Best Asian Knife Set: Shun Classic 5-Piece S
4 $279.00 Food Network Best Basic Set: Misen Essentials Knife Set
5 $299.95 Food Network Best Self-Sharpening Set: Henckels Classic P
6 $355.00 Food Network Best Design Statement: Material The Knives +
No products came back for "xqzvbn plorf wuggle 9981"
And in Node?
Node 18 and later includes fetch, so there is nothing to install. Save the client as client.mjs, so any other file can import it:
const API_KEY = "sk_live_your_api_key";
const BASE = "https://apiserpent.com/api/google/shopping";
export async function shopping(q, { country = "us", num = 20, language } = {}) {
const params = new URLSearchParams({ q, country, num: String(num) });
if (language) params.set("language", language);
const res = await fetch(`${BASE}?${params}`, { headers: { "X-API-Key": API_KEY } });
if (res.ok === false) throw new Error(`HTTP ${res.status}`);
return res.json();
}
// The list of products, or an empty list. Never assume it is there or that it is full.
export const productsOf = (answer) => answer?.results?.shopping || [];
Then call.mjs does what show() does in Python, for the same three searches:
import { shopping, productsOf } from "./client.mjs";
async function show(q, num = 20) {
const answer = await shopping(q, { num });
const products = productsOf(answer);
if (products.length === 0) {
console.log(`No products came back for "${q}"`);
return;
}
console.log(`${answer.query} | ${answer.country} | returned ${products.length} products`);
for (const p of products) {
const price = p.price || "-";
const title = (p.title || "").slice(0, 44);
console.log(`${String(p.position ?? "-").padStart(2)} ${price.padStart(9)} ${(p.source || "-").padEnd(17)} ${title}`);
}
}
for (const q of ["iphone 16 case", "kitchen knife set", "xqzvbn plorf wuggle 9981"]) {
await show(q);
console.log();
}
Its output is the same as the Python output, row for row (I compared the two files). These are its first four lines:
iphone 16 case | us | returned 16 products
1 $59.00 Apple iPhone FineWoven Wallet with MagSafe – Magen
2 $54.95 Apple Hikawa Grip & Stand for iPhone (MagSafe Comp
3 $39.95 Apple PopSockets Low-Pro Grip & Stand (MagSafe com
What is in one product?
A product has 24 fields. The table groups them and says what the two live answers, 22 products in all, held in each. A field is null when the listing does not show it.
| Fields | What they hold | In the 22 products |
|---|---|---|
position, title, link, source, thumbnail | Place in the list from 1, the product title, the listing address, the store, the picture address | Filled on all 22 |
price, extracted_price, currency | The price as text, the same price as a number, the currency code | Filled on all 22 |
sponsored | True or false | False on all 22 |
product_rating, product_reviews, product_reviews_text | The rating and the reviews | Null on all 22 |
shipping, delivery, availability, condition | Shipping, delivery, availability and condition of the listing | Null on all 22 |
product_id, offer_id, product_link, snippet | The product id, the offer id, a product link and a short text line | Null on all 22 |
price_details, badges, variants, product_details | Lists | Empty list on all 22 |
The listings in these two answers did not show a rating, a review count, shipping or an id, so I can show you no value for those fields.
Your own answers can fill more of them. The code reads every field with a default so that a value that is there flows through and one that is not does no harm. When you build on a field, test for null first.
What is the difference between price and extracted_price?
price is the price as text, the way the listing shows it, with the currency sign. extracted_price is the same amount as a number, and currency is the code that goes with it. Show price to people. Sort, add and compare on extracted_price, and do not try to strip the sign off the text yourself.
This continues the Python file. price_summary() works on extracted_price alone, skips a product whose price is null, and refuses to compare prices that are in more than one currency:
def price_summary(products):
"""Lowest, highest and median of extracted_price, only when every price is in one currency."""
priced = [p for p in products if p.get("extracted_price") is not None]
if not priced:
return None
currencies = {p.get("currency") for p in priced}
if len(currencies) > 1:
print(f"prices are in {sorted(str(c) for c in currencies)}: not comparing them")
return None
values = sorted(p["extracted_price"] for p in priced)
mid = len(values) // 2
median = values[mid] if len(values) % 2 else (values[mid - 1] + values[mid]) / 2
low = min(priced, key=lambda p: p["extracted_price"])
high = max(priced, key=lambda p: p["extracted_price"])
return {"n": len(priced), "currency": currencies.pop(), "median": median, "low": low, "high": high}
for q in ("iphone 16 case", "kitchen knife set"):
s = price_summary(products_of(shopping(q)))
if s is None:
print(f"{q}: nothing to compare")
continue
print(f'{q}: {s["n"]} priced products, {s["currency"]}, median {s["median"]:.2f}')
for label in ("low", "high"):
p = s[label]
print(f' {label:<4} {p["extracted_price"]:>8.2f} was "{p["price"]}" {p["source"]}: {p["title"][:40]}')
The Node version, saved as prices.mjs next to client.mjs:
import { shopping, productsOf } from "./client.mjs";
// Lowest, highest and median of extracted_price, only when every price is in one currency.
function priceSummary(products) {
const priced = products.filter((p) => p.extracted_price != null);
if (priced.length === 0) return null;
const currencies = [...new Set(priced.map((p) => p.currency))];
if (currencies.length > 1) {
console.log(`prices are in ${currencies.sort()}: not comparing them`);
return null;
}
const values = priced.map((p) => p.extracted_price).sort((a, b) => a - b);
const mid = Math.floor(values.length / 2);
const median = values.length % 2 ? values[mid] : (values[mid - 1] + values[mid]) / 2;
const low = priced.reduce((a, b) => (b.extracted_price < a.extracted_price ? b : a));
const high = priced.reduce((a, b) => (b.extracted_price > a.extracted_price ? b : a));
return { n: priced.length, currency: currencies[0], median, low, high };
}
for (const q of ["iphone 16 case", "kitchen knife set"]) {
const s = priceSummary(productsOf(await shopping(q)));
if (s === null) {
console.log(`${q}: nothing to compare`);
continue;
}
console.log(`${q}: ${s.n} priced products, ${s.currency}, median ${s.median.toFixed(2)}`);
for (const [label, p] of [["low", s.low], ["high", s.high]]) {
console.log(` ${label.padEnd(4)} ${p.extracted_price.toFixed(2).padStart(8)} was "${p.price}" ${p.source}: ${p.title.slice(0, 40)}`);
}
}
Both printed this from the two live answers:
iphone 16 case: 16 priced products, USD, median 49.00
low 19.95 was "$19.95" Apple: Tech21 Wrist Lanyard (2 Pack)
high 59.95 was "$59.95" Apple: Herschel Cloud Sling for iPhone
kitchen knife set: 6 priced products, USD, median 297.95
low 149.99 was "$149.99" Food Network: Best Value Set: Ginsu Gourmet Chikara Se
high 665.00 was "$665.00" Food Network: Best Overall: Wusthof Classic 9-Piece Kn
The highest price in the second answer is the $665.00 row, and the number printed for it is 665.00. Do the sorting on the number, not the text, because text sorts character by character. Within each of these two answers the two orders happen to agree. Put the 22 products of both answers into one list and they part: sorted as text, $149.99 comes first, ahead of $19.95, although it is the larger price. Sorting the number puts $19.95 first and $665.00 last.
The chart is the first live answer, product by product: each bar is an extracted_price, and the dashed line is the median that price_summary() printed.
Can you trust num to match the list?
No. num is the most you want, a number from 1 to 100. Take the count from the list you got, and loop over that list. The code above does this: show() prints len(products). In the two answers here num was 20, and the lists held 16 and 6 products; the delivery object in the excerpt above says the same for the first one (requested 20, returned 16). The version that breaks is the one that trusts num:
for i in range(num): # wrong: the list may hold fewer than num
print(products[i]["title"]) # IndexError when it does
If a report needs a fixed number of rows, fill the gap on your side.
What does an empty answer look like?
The list is empty and the count is zero. This is the results part of the live answer for the nonsense text xqzvbn plorf wuggle 9981:
{
"results": {
"shopping": [],
"totalResults": 0
}
}
That is a normal answer, not an error, and the code treats it so. In products_of(), the or [] turns a missing or empty list into an empty one, and the if not products branch in show() prints a message and returns, as the third block of the output above shows. In a loop, do the same: note the search text in your own log and carry on with the next one. Try a shorter or plainer text before you decide there is nothing to find.
An answer with no products is charged like any other call. Errors and timeouts on our side are free.
How do you get other countries and languages?
country and language are separate parameters. Send a pair per call to see the same search in another market. This continues the Python file and prints how many products each market returned, skipping a market whose call fails:
MARKETS = [("us", "en"), ("gb", "en"), ("de", "de")]
for country, language in MARKETS:
try:
answer = shopping("kitchen knife set", country=country, language=language)
except requests.RequestException as err:
print(f"skipped {country}/{language}: {err}")
continue
print(country, language, len(products_of(answer)), "products")
The Node version, saved as markets.mjs:
import { shopping, productsOf } from "./client.mjs";
const MARKETS = [["us", "en"], ["gb", "en"], ["de", "de"]];
for (const [country, language] of MARKETS) {
try {
const answer = await shopping("kitchen knife set", { country, language });
console.log(country, language, productsOf(answer).length, "products");
} catch (err) {
console.log(`skipped ${country}/${language}: ${err.message}`);
}
}
I show no output for these two. The three live answers are all for us, so the stand-in could only check that each of the three requests was built correctly, with the right address, key header and parameters. Run it with your key and compare. Each market is its own call, so one search in three markets is three calls.
How do you save the products to a CSV?
The code below turns each product into one row, with the search text, the country and the timestamp of the answer in front, and writes a file. It takes a list of answers, so several searches land in one file. A null becomes an empty cell. It continues the Python file:
import csv
FIELDS = ["query", "country", "fetched_at", "position", "title", "store", "price", "extracted_price",
"currency", "rating", "reviews", "shipping", "delivery", "availability", "condition",
"product_id", "link"]
def rows_for(answer):
meta = answer.get("meta") or {}
for p in products_of(answer):
yield {
"query": answer.get("query"), "country": answer.get("country"), "fetched_at": meta.get("timestamp"),
"position": p.get("position"), "title": p.get("title"), "store": p.get("source"),
"price": p.get("price"), "extracted_price": p.get("extracted_price"), "currency": p.get("currency"),
"rating": p.get("product_rating"), "reviews": p.get("product_reviews"),
"shipping": p.get("shipping"), "delivery": p.get("delivery"),
"availability": p.get("availability"), "condition": p.get("condition"),
"product_id": p.get("product_id"), "link": p.get("link"),
}
def save_csv(answers, path):
count = 0
with open(path, "w", newline="", encoding="utf-8") as f:
writer = csv.DictWriter(f, fieldnames=FIELDS, lineterminator="\n")
writer.writeheader()
for answer in answers:
for row in rows_for(answer):
writer.writerow({k: "" if v is None else v for k, v in row.items()}) # null -> empty cell
count += 1
return count
answers = [shopping(q) for q in ("iphone 16 case", "kitchen knife set")]
print(f"{save_csv(answers, 'shopping.csv')} rows written to shopping.csv")
The Node version, save.mjs, has the same shape: one row per product from productsOf(), and the same columns. It writes the file by hand, and these are the key lines:
const cell = (v) => {
const s = v == null ? "" : String(v);
return /[",\n]/.test(s) ? `"${s.replaceAll('"', '""')}"` : s;
};
const lines = [FIELDS.join(","), ...rows.map((r) => FIELDS.map((f) => cell(r[f])).join(","))];
writeFileSync(path, lines.join("\n") + "\n");
Both versions printed the same line, and both wrote the same file (I compared them byte for byte). One row per product, so the two answers' 16 and 6 products make 22 rows:
22 rows written to shopping.csv
These are the header and the first two rows. The empty cells in the middle are the fields the listing did not show:
query,country,fetched_at,position,title,store,price,extracted_price,currency,rating,reviews,shipping,delivery,availability,condition,product_id,link
iphone 16 case,us,2026-12-02T14:00:20.692Z,1,iPhone FineWoven Wallet with MagSafe – Magenta,Apple,$59.00,59,USD,,,,,,,,https://www.apple.com/shop/product/mk9g4zm/a/iphone-finewoven-wallet-with-magsafe-magenta
iphone 16 case,us,2026-12-02T14:00:20.692Z,2,Hikawa Grip & Stand for iPhone (MagSafe Compatible) - Orange Swirl,Apple,$54.95,54.95,USD,,,,,,,,https://www.apple.com/shop/product/hsjf2zm/a/hikawa-grip-stand-for-iphone-magsafe-compatible-orange-swirl
No value in these answers needed quotes, so to check that case I put one hand-made row (not an API answer) through the code: a title with a comma and quotes in it, and a price text with a thousands comma. Both versions wrap such a value in quotes and double any quote inside it. This is the row the Python code wrote for it, and the Node rule gave the same two cells:
q,us,,,"a ""quoted"", title",,"$1,099.95",,,,,,,,,,
Keep query, country and fetched_at in every row. They let you group, filter and tell runs apart when you merge files, and they matter once you run the same search on another day. Keep position as a record of where the product sat in that answer, not as a key.
What does a run cost?
One call is one charge at the Shopping rate: $0.35 per 1K API calls at the default rate, pay as you go, no subscription. The price is per call, not per product, and an answer with no products is charged too. Errors and timeouts on our side are free.
The per-product columns are the price divided by 20 or by 100, if every call returns the full page.
| Tier | Deposit | Per 1K API calls | Per 1,000 products at 20 per call | Per 1,000 products at 100 per call |
|---|---|---|---|---|
| Default | $10 deposit | $0.35 | $0.0175 | $0.0035 |
| Growth | $100 deposit | $0.32 | $0.0160 | $0.0032 |
| Scale | $500 deposit | $0.25 | $0.0125 | $0.0025 |
| Enterprise | $1,000 deposit | $0.21 | $0.0105 | $0.0021 |
| Enterprise Plus | $1,250 deposit | $0.18 | $0.0090 | $0.0018 |
A worked run: checking 50 searches a day for 30 days is 1,500 calls, which is $0.525 at the default rate and $0.270 at Enterprise Plus. The CSV code above makes 2 calls for its 2 searches. New accounts get 10 free API calls shared across services, and the pricing page explains how deposit size sets the rate. How $0.35 compares with other providers is in the price comparison.
To turn these snippets into a daily price log, read Google Shopping data for price monitoring. For a longer Python walk-through of pulling shopping prices into a lowest-price table, see Scrape Google Shopping Prices in 2026, which also compares ways of getting the data. The Google Shopping API page has the overview, and the pricing page the rates.
How we checked this
Code. I ran every snippet on Python 3.15.2 and Node 26.5.0 against three live answers called in production on 2 December 2026 at about 14:00 UTC, one for iphone 16 case, one for kitchen knife set and one empty answer for xqzvbn plorf wuggle 9981, with only the network call replaced by a stand-in. It returns the live answer for those three texts with country us and an empty list for anything else, and it checks the address, the X-API-Key header and the parameters of every request. I also checked each file with python3 -m py_compile and node --check. The output in this post is what the snippets printed. The Python and Node outputs matched, and the two CSV files were identical. I also fed the Python price and CSV code hand-made rows with null prices, missing keys and two currencies to check it copes, and those rows are not API answers.
Prices. Our figures are per 1K API calls, from the Shopping row of the pricing page, which also gives the deposit sizes, read on 2 December 2026. The per-product figures are that price divided by 20 or 100, and the run totals are a small calculation I ran.
What I could not verify:
- The snippets ran against a stand-in that replays three answers, not against the endpoint, so a fresh call can return other products.
- The three answers are for
uswithnumset to 20. For another country or language, anothernumorformat=simple, the code was only checked to build the request correctly. - No product in the two answers had a rating, review count, shipping, delivery, availability, condition or product id, so I show no values for them.
- The curl line was not run.
Try one call before you build the loop
Serpent’s Google Shopping API costs $0.35 per 1K API calls at the default rate — pay as you go, no subscription. New accounts get 10 free API calls shared across services.
Get Your Free API KeyExplore: Google Shopping API · Pricing
FAQ
How do I get Google Shopping product data in Python?
Send a GET request to https://apiserpent.com/api/google/shopping with your search text as q and your key in the X-API-Key header, then read the JSON. The products are in results.shopping, each with a position, title, link, store (source), price as text, extracted_price as a number, currency and a picture. Check that the list is not empty before you save anything, and read optional fields such as rating and shipping with a default, because a field is null when the listing does not show it.
How many products does one call return?
The num parameter takes a number from 1 to 100. It is the most you want, not a promise of how many the list will hold, so use the length of the list rather than assuming num, and loop over what came back. The price is per call, not per product.
How do I read prices and handle an empty answer?
price is the price as text, exactly as the listing shows it, for example $59.00 with the currency sign. extracted_price is the same amount as a number, for example 59, and currency is the code that goes with it. Show price to people and use extracted_price for sorting and sums, after checking that the currency is the same. An empty answer has an empty shopping list and a totalResults of 0. Treat it as a normal result, skip it and carry on. It is charged like any other call, while errors and timeouts on our side are free.
How do I get products for another country or language?
Send country, for example country=gb, and language as a two-letter code, for example language=de. Without them you get country us. The two are separate parameters, so you can ask for one language in several countries. Each pair is its own call, so one search in three markets is three calls. Check the currency field before you compare prices across countries.
What does the Google Shopping API cost?
$0.35 per 1K API calls at the default rate, pay as you go with no subscription, and the rate falls with larger deposits, as the pricing page shows. At 20 products per call, $0.35 per 1K API calls is about $0.0175 per 1,000 products if every call returns the full page. New accounts get 10 free API calls shared across services.
Sources
Serpent data in this post: two live answers and one live empty answer called on 2 December 2026, the checks listed under “How we checked this”, and the pricing page (read 2 December 2026).




