Back to blog
·4 min readAPI Workflows

Price comparison APIs: compare the same product before the price

Explore API use cases

All Them APIs

Independent API research

The cheapest result is often a different product. It has less storage, comes in a smaller pack, is refurbished or cannot ship to the selected destination. Sorting those prices produces a convincing table that answers the wrong question.

A price comparison API workflow needs two gates: establish that an offer represents the requested item, then establish which costs are known. Discovery, extraction and comparison are separate tasks; you can use different providers for each.

Assemble the pipeline around the output

TaskCatalog optionBoundary
Find candidate product pagesExaSearch results identify candidates, not verified current offers
Read a permitted product pageFirecrawlExtract a document or structured fields, then validate them
Alternative product extractionZyteMap the selected extraction schema into the same offer record

Exa Search provides source discovery; its Search reference documents the request contract. Zyte's reference separates single-product extraction from product-list extraction and describes price, currency and availability fields. Choose the correct page type before writing an adapter.

Firecrawl and Zyte are alternative extraction paths, not mandatory consecutive charges. Compare them on an authorized known-answer set, then select a default. Use an alternate only when the task permits it and your retry budget allows it. The scraping comparison explains their integration boundaries.

Define the product key before searching

Prefer an explicit product identifier such as a GTIN or a verified manufacturer part number. Include variant, pack size and condition in the matching rule. A model can suggest a candidate match; it should not silently turn title similarity into an exact identifier.

Keep match evidence alongside the offer. A product page can describe several variants while displaying the price of only the default selection. A list page's lowest price may belong to a different size. Preserve this uncertainty instead of attaching that number to the requested variant.

Use search to discover pages initially. Once an offer has been verified, refresh its known URL rather than paying for discovery on every collection cycle. Revalidate identity when the page changes materially.

Compare totals only when the components are known

Store product identity, variant, pack size, condition, seller, currency, destination, tax basis, availability, collection time and source URL. Keep item price, shipping and tax as separate fields. Unknown shipping is null, not free delivery.

The local function below assumes an adapter has already converted amounts to integer minor units using the currency's correct exponent. It does not scrape a page or infer a match. The one-hour freshness rule is an example application policy, not a provider guarantee.

function comparableTotal(offer, target, nowMs, maxAgeMs = 3600000) {
  const keys = ["productId", "variant", "pack", "condition",
    "currency", "destination", "taxBasis"];
  if (!keys.every(key => typeof target[key] === "string" &&
    target[key].length > 0 && offer[key] === target[key])) return null;
  if (offer.availability !== "in_stock") return null;
  const observed = Date.parse(offer.observedAt);
  if (!Number.isFinite(nowMs) || !Number.isFinite(observed) ||
    !Number.isFinite(maxAgeMs) || maxAgeMs < 0 ||
    observed > nowMs || nowMs - observed > maxAgeMs) return null;
  const amounts = [offer.itemMinor, offer.shippingMinor, offer.taxMinor];
  if (!amounts.every(value => Number.isSafeInteger(value) && value >= 0)) return null;
  const total = amounts.reduce((sum, value) => sum + value, 0);
  return Number.isSafeInteger(total) ? total : null;
}

Do not apply a blanket multiply-by-100 conversion to every currency. Keep the adapter's currency/rounding rules explicit. Membership discounts, financing prices and personalized coupons need their own eligibility conditions; leave them outside an ordinary public-price comparison unless the buyer qualifies.

Preserve offers that cannot be ranked

An incomplete offer can still be useful. Display its known item price and mark shipping or tax as unknown. Put it in a separate review group, not at the bottom of a total-price sort where readers may assume it lost fairly.

Likewise, an extraction failure does not mean out of stock. Keep collection error, unavailable item, uncertain variant and stale observation as different outcomes. A successful HTTP response can still contain the wrong product or a consent screen.

Test the comparison before making recommendations

Find offers for the approved exact product, variant, pack and condition.
Fetch only permitted product pages within the application request budget.
Return identifiers, match evidence, seller, currency, costs and collection time.
Never substitute unknown shipping/tax with zero or treat a failed fetch as stock.
Rank only comparable, fresh offers for the selected destination and tax basis.
Do not purchase, log into a shopper account or apply personalized discounts.

Use fixtures containing a two-pack versus a single item, two currencies, an out-of-stock page, unknown delivery cost, an old observation and an amount exceeding your integer range. Confirm that none can become the winning total through coercion or a missing-field default.

Count discovery, reads, retries and rejected extractions when measuring cost per accepted offer. Respect the site's and supplier's collection and reuse conditions. For the document-validation stage, follow the web extraction workflow; for provider selection, use the web scraping cluster.