Product Availability Monitoring API: Tracking Stock Per Variant Without False Alerts

TLDR: A product availability monitoring API tells you, on a schedule, whether each variant of a product can be bought, where, and in what state: in stock, out of stock, backorder or preorder. Read the retailer's own API or store JSON first, then schema.org Offer markup, then page text. Treat a blocked or failed fetch as unknown, never as out of stock, and confirm a change twice before alerting.
What a product availability monitoring API has to tell you
Brands watch retailers for stockouts that cost them sales. Retailers watch competitors to time promotions. Resellers and deal sites watch for restocks. All three want the same answer, a change in a product's state, and the answer is rarely a single yes or no.
- Per variant. A shoe is in stock in size 9 and gone in size 11. A product-level flag hides the stockout that matters.
- Per location. Store pickup, delivery postcodes and regional warehouses each have their own stock.
- Per seller. On a marketplace, the product page can show one featured offer while other sellers still have stock.
- By state. A backordered item can be ordered but will not ship this week. Counting it as in stock overstates supply.
The vendor pages written for this query, such as those from QuickCommerce API and AlterLab, each sell one way to collect the signal. This guide compares the sources, shows what they disagree on in live tests run on 12 November 2026, and gives tested Python that turns them into alerts you can trust.
Where availability data comes from
Pick the source by who publishes the product. The higher the row, the more you can trust the reading.
| Source | Granularity | What to watch for | Use it when |
|---|---|---|---|
| Retailer API, such as the Best Buy Products and Stores APIs | Online and per store | Needs an API key and covers one retailer | The retailer offers one and your use fits its terms |
| Amazon Creators API, OffersV2 | Featured offer per ASIN | Associates only, with an eligibility gate and usage tied to referral revenue | You are an eligible Amazon Associate |
| Storefront JSON, such as the Shopify Ajax Product API | Per variant | A boolean that also counts backorders as available | Direct-to-consumer brands on Shopify |
| schema.org Offer markup in the page | Per offer, sometimes per variant | Missing on some pages, and keyed inconsistently | Any retailer whose pages carry it |
| Visible page text | Usually the default variant | Wording varies by site and language | Nothing better exists |
| Scraping or monitoring vendor | Depends on the vendor | Accuracy claims you have to test yourself | Large marketplaces with bot defenses, at scale |
Best Buy is a good model of what a retailer API should give you. Its Products API exposes onlineAvailability and inStoreAvailability with update timestamps. Its store availability call, /v1/products/{sku}/stores.json?postalCode=, returns only the stores that have the SKU in stock, within 250 miles, with a lowStock flag. Best Buy's own documentation adds a warning: inStoreAvailability says a product is sold in stores, not that a particular store has it.
Amazon's route is narrower than most teams expect. Amazon's deprecation notice says PA-API 5 is being replaced by the Creators API, and applications that still call PA-API 5 get an HTTP 403. The Creators API requires an Associates account with at least 10 qualifying sales in the past 30 days. For the first 30 days, new credentials get one request per second and 8,640 requests per day, according to Amazon's rate page, and a GetItems call takes up to 10 ASINs. OffersV2 returns only the featured listing shown in the buy box, and Amazon's documentation says it shows the item as out of stock when there is no featured offer. A product with sellers but no buy box winner can therefore read as out of stock. If you sell on Amazon, your own inventory comes from Amazon's seller APIs, which this guide does not cover.
Five states, not a boolean
Every source has its own vocabulary. schema.org's ItemAvailability list has 12 values, Amazon's OffersV2 has 8 types, and Shopify has one boolean. Normalize them all before you compare readings. Google Merchant Center's availability spec publishes a mapping from schema.org values to its own four states, and it is a sensible default because retailers already tune their markup for it.
| Normalized state | schema.org values (Google's mapping) | Amazon OffersV2 type | Shopify |
|---|---|---|---|
| IN_STOCK | InStock, LimitedAvailability, OnlineOnly | IN_STOCK, IN_STOCK_SCARCE | available: true, unless the page says otherwise |
| OUT_OF_STOCK | OutOfStock, SoldOut, Discontinued, InStoreOnly | OUT_OF_STOCK, UNAVAILABLE | available: false |
| BACKORDER | BackOrder | LEADTIME | Only from page markup |
| PREORDER | PreOrder, PreSale | PREORDER, AVAILABLE_DATE | Only from page markup |
| UNKNOWN | Reserved, MadeToOrder (Google maps neither) | UNKNOWN | Request failed |
Two choices in this table are judgment calls, so change them if your business disagrees. Google files InStoreOnly under out of stock because Merchant Center availability describes online orders; a store-network monitor may want a separate state. Mapping LEADTIME to backorder treats "ships later" as a supply signal, which is usually what a brand wants to know.
Retailers have a reason to keep markup honest wherever Google Shopping matters. Google's spec says availability must match across the landing page, structured data, checkout page and data source, and that a mismatch in any one of them triggers a product disapproval.
What a live test of 20 product pages showed
On 12 November 2026 we requested /products.json from eight Shopify stores. Bombas returned 429. The other seven (Allbirds, ColourPop, Gymshark, Kith, Death Wish Coffee, Rothy's and Brooklinen) returned the first page of up to 250 products each.
- Variant-level stockouts are common. Across 1,668 products and 13,673 variants, 476 products (29%) had some variants available and others not. A monitor that reads only the product-level flag misses all of those.
- Offer markup is missing on some pages. We fetched 20 of those mixed-stock product pages, the first four from each of five stores. All four Brooklinen pages carried no schema.org Offer at all.
- Offers are hard to tie to variants. The 16 pages with markup held 198 offers. We could match 142 to a Shopify variant by variant URL or SKU. Allbirds keys its 56 offers by a
?size=value such as?size=8, with no SKU, so matching them needs option values. - The sources rarely disagree, but one disagreement hides a stockout. All 142 matched offers agreed with Shopify's
availableflag. The exception sat outside that sample: a Rothy's page where Shopify reported 16 of 17 sizes available and the page markup said BackOrder for every size.
The backorder case comes from how Shopify works, not from a bug. Shopify's variant object has an inventory_policy of continue or deny, and continue keeps selling a variant after it runs out. To the storefront JSON, a variant that can still be ordered is available. To your brand team, a size on backorder is a stockout with a ship date.
The large retailers failed in a different way. On 12 November 2026 we requested one product URL from each of five with a plain HTTP client. Home Depot returned 403, Best Buy timed out after 20 seconds, Target returned 404 for the URL we tried, and Walmart returned its full product page. Amazon answered the same URL eight times, 2.5 seconds apart: six responses were HTTP 200 with a 3,781-byte page that says "Click the button below to continue shopping", and two were 503 with a 316-byte body. The 200 is the dangerous case: a response with no "Add to cart" button looks exactly like an out-of-stock page to a naive parser.
A per-variant checker in Python
The script below uses only the standard library. It reads Shopify variants from the documented .js endpoint and upgrades a variant from in stock to backorder or preorder when the page markup says so. Pages from other retailers go through the You.com Contents API (POST https://ydc-index.io/v1/contents, up to 10 URLs per request), with Offer markup as the first choice and page text as a low-confidence fallback. Failed fetches and bot walls come back as UNKNOWN.
"""Per-variant availability checks with five normalized states. Standard library only.
Signals, best first: a store's own JSON (Shopify), schema.org Offer markup, page text.
A blocked or failed fetch is UNKNOWN, never OUT_OF_STOCK.
"""
import json
import os
import re
import sys
import urllib.error
import urllib.request
UA = {"User-Agent": "stock-watch/1.0 (ops@yourco.example)"}
IN, OUT, BACK, PRE, UNKNOWN = "IN_STOCK", "OUT_OF_STOCK", "BACKORDER", "PREORDER", "UNKNOWN"
# schema.org ItemAvailability mapped the way Google Merchant Center maps it, plus Amazon OffersV2 types
STATE = {
"instock": IN, "limitedavailability": IN, "onlineonly": IN,
"outofstock": OUT, "soldout": OUT, "discontinued": OUT, "instoreonly": OUT,
"preorder": PRE, "presale": PRE, "backorder": BACK,
"in_stock": IN, "in_stock_scarce": IN, "out_of_stock": OUT, "unavailable": OUT,
"leadtime": BACK, "available_date": PRE, "unknown": UNKNOWN,
}
BLOCK_MARKERS = ("captcha", "px-captcha", "access denied", "are you a human", "press & hold")
TEXT_CUES = [(PRE, r"\bpre-?order\b"), (BACK, r"\bback-?order"), (OUT, r"\bsold out\b|\bout of stock\b"),
(IN, r"\badd to (cart|bag|basket)\b")]
def normalize(value):
"""'https://schema.org/InStock', 'InStock' or 'IN_STOCK' -> one of the five states."""
key = str(value or "").rstrip("/").rsplit("/", 1)[-1].replace(" ", "_").lower()
return STATE.get(key, UNKNOWN)
def fetch(url, timeout=20):
"""Return (status, body). Network errors come back as status None."""
try:
with urllib.request.urlopen(urllib.request.Request(url, headers=UA), timeout=timeout) as r:
return r.status, r.read().decode("utf-8", "replace")
except urllib.error.HTTPError as e:
return e.code, ""
except OSError: # DNS, connection reset, timeouts (socket.timeout on Python 3.9)
return None, ""
def blocked(status, body):
"""True when the response is a bot wall or error, not a product page. A 200 can be a captcha."""
if status != 200 or len(body) < 2000:
return True
head = body[:20000].lower()
# A product page can load reCAPTCHA for a form, so a marker alone is not a wall.
# Call it a wall only when the page has no structured product markup.
return any(m in head for m in BLOCK_MARKERS) and "application/ld+json" not in body.lower()
def jsonld_offers(html):
"""Every schema.org Offer with an availability, as {sku, url, state}."""
found = []
def walk(node):
if isinstance(node, list):
for x in node:
walk(x)
elif isinstance(node, dict):
types = node.get("@type")
types = types if isinstance(types, list) else [types]
if "Offer" in types and "availability" in node:
found.append({"sku": node.get("sku"), "url": node.get("url"),
"state": normalize(node["availability"])})
for x in node.values():
walk(x)
for block in re.findall(r'<script[^>]+application/ld\+json[^>]*>(.*?)</script>', html, re.S | re.I):
try:
walk(json.loads(block.strip()))
except ValueError:
continue
return found
def text_state(text):
"""Last resort: visible wording. Low confidence; a 'Sold out' badge on one size can mislead."""
low = (text or "").lower()
for state, pattern in TEXT_CUES:
if re.search(pattern, low):
return state
return UNKNOWN
def shopify_check(store, handle):
"""One reading per variant from /products/{handle}.js, refined by the page's Offer markup.
Shopify's `available` is true when the variant can be ordered, which includes
selling past zero (inventory_policy 'continue'). JSON-LD tells those cases apart.
"""
status, body = fetch(f"https://{store}/products/{handle}.js")
if status != 200:
return [{"variant": None, "state": UNKNOWN, "source": f"http {status}"}]
try:
variants = json.loads(body)["variants"]
except (ValueError, KeyError, TypeError):
return [{"variant": None, "state": UNKNOWN, "source": "not product json"}]
page_status, page = fetch(f"https://{store}/products/{handle}")
offers = [] if blocked(page_status, page) else jsonld_offers(page)
by_variant = {}
for o in offers:
m = re.search(r"variant=(\d+)", str(o["url"] or ""))
if m:
by_variant[m.group(1)] = o["state"]
elif o["sku"]:
by_variant["sku:" + str(o["sku"])] = o["state"]
out = []
for v in variants:
state = IN if v["available"] else OUT
marked = by_variant.get(str(v["id"])) or by_variant.get("sku:" + str(v.get("sku")))
if v["available"] and marked in (BACK, PRE):
state = marked
out.append({"variant": v["id"], "title": v["title"], "state": state,
"source": "shopify+jsonld" if marked else "shopify"})
return out
def contents_check(urls, max_age=3600):
"""Generic product pages through the You.com Contents API (up to 10 URLs per request)."""
urls = urls[:10]
req = urllib.request.Request(
"https://ydc-index.io/v1/contents",
data=json.dumps({"urls": urls, "formats": ["html", "markdown"],
"crawl_timeout": 20, "max_age": max_age}).encode(),
headers={"X-API-Key": os.environ["YDC_API_KEY"], "Content-Type": "application/json"})
try:
with urllib.request.urlopen(req, timeout=90) as r:
pages = json.load(r)
except urllib.error.HTTPError as e:
# 401 and 403 mean fix the key; 429 and 5xx mean retry later. None says anything about stock.
return [{"url": u, "state": UNKNOWN, "source": f"contents api http {e.code}"} for u in urls]
except (OSError, ValueError):
return [{"url": u, "state": UNKNOWN, "source": "contents api unreachable"} for u in urls]
return [page_state(p) for p in pages]
def page_state(page):
"""Reduce one Contents API page object to a reading. Null content means no reading."""
html, md = page.get("html"), page.get("markdown")
if not html and not md:
return {"url": page.get("url"), "state": UNKNOWN, "source": "fetch failed"}
if html and blocked(200, html):
return {"url": page.get("url"), "state": UNKNOWN, "source": "bot wall"}
states = {o["state"] for o in jsonld_offers(html or "")} - {UNKNOWN}
if states:
state = IN if IN in states else (BACK if BACK in states else (PRE if PRE in states else OUT))
return {"url": page.get("url"), "state": state, "source": "jsonld", "mixed": len(states) > 1}
return {"url": page.get("url"), "state": text_state(md or html), "source": "text"}
def transition(state, reading, confirm=2):
"""Alert only when `confirm` identical readings in a row differ from the last confirmed state.
`state` is one dict per variant, for example {}. UNKNOWN never alerts and never resets the count.
"""
if reading == UNKNOWN:
return None
confirmed = state.get("confirmed")
if confirmed is None: # first reading becomes the baseline
state["confirmed"] = reading
return None
if reading == confirmed: # back to normal: forget any pending change
state["candidate"], state["seen"] = None, 0
return None
if reading == state.get("candidate"):
state["seen"] += 1
else:
state["candidate"], state["seen"] = reading, 1
if state["seen"] >= confirm:
state["confirmed"], state["candidate"], state["seen"] = reading, None, 0
return f"{confirmed} -> {reading}"
return None
if __name__ == "__main__":
# python3 stock_watch.py rothys.com womens-cruiser-mary-jane-revelvet-cherry-cat
store, handle = sys.argv[1:3]
for row in shopify_check(store, handle):
print(row)
We ran shopify_check live on 12 November 2026 against Rothy's, Allbirds, Kith, Death Wish Coffee and Brooklinen. It returned BACKORDER for 16 of the 17 sizes on that Rothy's page, where Shopify alone reports 16 as available, and per-size states for the rest. Separately, 34 offline checks ran against fixtures shaped like the documented Contents API response. They cover the block detector, offer parsing, error handling and the alert logic. We did not call the Contents API itself.
A few details matter in production:
- Freshness. The Contents API may return cached content unless you set
max_age, in seconds. Set it below your check interval, or to 0 to always fetch the page live. The Contents API guide documents both behaviors. - Failures. A URL the API cannot fetch comes back with
nullmarkdown and HTML, and a failed call, such as a 429 or a timeout, returns no pages at all. The checker records both as UNKNOWN rather than as a stockout. - Mixed pages. When a page's offers disagree,
page_statereports in stock and setsmixed, which tells you to read that product per variant. - Bot-wall detection. A marker such as "captcha" is not enough on its own. The real Walmart product page we fetched on 12 November mentions
recaptcha.netwithin its first 20,000 characters.blockedtherefore treats a 200 response over 2 KB as a wall only when a marker is present and the page has no JSON-LD. - Markup in the response. The API reference says the
metadataformat carries JSON-LD and OpenGraph data "if available", but its response schema lists onlysite_nameandfavicon_url. The checker therefore parses Offer markup from thehtmlfield. Test that it survives for your target retailers before you depend on it. - Scope. The Contents API fetches pages you already have URLs for. It is not a crawler, and it does not discover new product pages. For discovery, see the product data API guide.
Alerting without false out-of-stock alerts
Most bad availability alerts come from the collector, not the shelf. A captcha, a timeout, a geo-redirect or a layout change can each look like a stockout. Three rules remove most of them.
- Never infer out of stock from a failure. Classify the response first. A non-200 status, a body under 2 KB, or bot-wall markers on a page with no product markup mean "no reading". The
blockedfunction above checks all three. An availability value the checker does not recognize is also no reading, never a stockout. - Confirm before you alert. The
transitionfunction keeps a small state dict per variant and alerts only after two matching readings in a row that differ from the last confirmed state, so a single flicker never pages anyone, even when the next two readings go back to normal. Restock alerts for resellers may need one reading; stockout alerts for a brand rarely do. - Alert on the variant, not the product. Send the size, color or store that changed. "Men's Varsity, size 11, out of stock" can be acted on. "Men's Varsity changed" cannot.
Set the check frequency per product rather than for the whole catalog. Here is the cost at Contents API pricing of $1.00 per 1,000 pages, as of November 2026 on the billing page, for a brand tracking 500 SKUs across six retailers, or 3,000 product pages:
| Schedule | Pages per day | Cost per day | Cost per 30 days |
|---|---|---|---|
| Every page, every hour | 72,000 | $72.00 | $2,160 |
| Every page, every 6 hours | 12,000 | $12.00 | $360 |
| 300 hero pages every 15 minutes, 2,700 pages every 6 hours | 28,800 + 10,800 = 39,600 | $39.60 | $1,188 |
Two refinements cut the bill further. Shopify storefront JSON costs nothing per call, so route Shopify SKUs away from paid page fetches, and do the same for retailers whose API terms fit your use. And watch the products most likely to change: launches, promoted items, and variants already flagged as low stock. Self-serve accounts get 10 Contents API requests per second by default, per the rate limits page, so throughput is not the constraint at this size.
Build, buy, or use the retailer's API
| Situation | Recommended path |
|---|---|
| Your products at retailers that publish an API | The retailer API. Best Buy gives store-level stock with a low-stock flag. |
| Direct-to-consumer brands on Shopify | Storefront JSON plus page markup, as in the script above |
| A few hundred known pages at mid-size retailers | Contents API fetches with your own parser and alert rules |
| Amazon, Walmart and other heavily defended marketplaces | An official program you qualify for, or a vendor that shows a measured success rate on those sites |
| Grocery and quick commerce, where stock depends on the delivery postcode | A vendor that supports location parameters for those platforms |
Before you buy from a vendor, run a week-long test on 50 of your own URLs. Score it on the four things that broke in our test: per-variant states, backorder handling, how it reports blocked fetches, and how stale a reading can be. Read each retailer's terms and robots.txt before you fetch its pages on a schedule. Where a retailer offers an API or a data feed, that is the cleaner route.
The You.com Contents API fits the middle of this table: known pages, clean HTML and markdown, freshness control, and per-page pricing. It does not crawl, and it does not turn a product page into stock data for you. The parser and the alert rules stay in your code. If you also track price, the price monitoring API guide covers feeds versus pipelines and the failures that corrupt price data. The MAP violation monitoring guide covers enforcement once you know who is selling what. The Contents API overview covers parameters and failure modes in more depth.
Frequently Asked Questions
It is an API, or a pipeline built on one, that checks on a schedule whether each variant of a product can be bought and reports changes. Good ones return a state per variant and location: in stock, out of stock, backorder or preorder. The data comes from retailer APIs, storefront JSON such as Shopify's, schema.org Offer markup in product pages, or visible page text, in roughly that order of reliability.
Not always. A variant is available when it can be ordered, and a merchant can set its inventory policy to continue so it keeps selling after stock runs out. On 12 November 2026, one Rothy's page had 16 of 17 sizes marked available in Shopify's JSON while the page's schema.org markup said BackOrder for every size. Check the page markup before you count a variant as in stock.
Usually the collector failed, not the shelf. Bot walls, timeouts and geo-redirects return pages with no buy button, and some return HTTP 200. In our test on 12 November 2026, Amazon answered a plain HTTP client with a 200 and a page with no buy button. Classify each response before parsing it, record failures as unknown, and require two matching readings before you send an alert.
Yes, if you qualify. Amazon's Creators API, which replaces PA-API 5, returns availability types such as IN_STOCK, LEADTIME and OUT_OF_STOCK through OffersV2. Access requires an Associates account with 10 qualifying sales in the past 30 days. OffersV2 covers only the featured buy box listing and shows out of stock when there is no featured offer, so other sellers' stock is not visible.
Set the frequency per product, not for the whole catalog. Check launches, promoted items and low-stock variants every 15 minutes and everything else every few hours. For 3,000 product pages at the Contents API price of $1.00 per 1,000 pages, hourly checks cost about $2,160 per 30 days, while that tiered schedule costs about $1,188. Free sources such as Shopify JSON lower it further.
LI Test
LI Test
Share Article:
Related resources.
.webp)
Search 1B+ professional profiles, 100M+ companies with Knowledge Pro
December 2, 2026
Product Updates

Introducing the You.com Extract API: fetch and parse any URL, with 80% higher accuracy on PDFs
November 17, 2026
Product Updates

FDA Approval Monitoring API: Sources, Lag and a Working Pipeline
November 15, 2026
Blog

Equity Research Automation API: What to Automate and How to Check the Numbers
November 14, 2026
Blog

Retail Assortment Monitoring API: How to Track What Competitors Add, Drop, and Carry
November 13, 2026
Blog
