To scrape Amazon product prices and stock, load each product's public page by ASIN and read the price, availability, rating and specs table, while telling a temporary block apart from a removed product. This guide shows how to do that with one API call, for a list of ASINs, product links or search keywords, and get one clean row per product.

This is part 5 of "How my fun projects turned into APIs". Each post takes one side project, explains how it works, and ends with something you can call from your own code. Part 1 covered finding TikTok creator emails, part 2 video transcripts, part 3 recipes from cooking videos, and part 4 Reddit.

Table of contents

  1. Why tracking Amazon prices is harder than it looks
  2. How the Amazon product scraper works
  3. How to scrape Amazon products in 4 steps
  4. How to scrape Amazon prices with Python
  5. How to scrape Amazon prices with JavaScript
  6. What data you get for each Amazon product
  7. How much it costs
  8. FAQ

Why tracking Amazon prices is harder than it looks

Reading one Amazon page is easy. Keeping a list of products up to date is not:

  • Prices and stock change daily.
  • Products disappear, and your links quietly start pointing at dead pages.
  • Amazon sometimes serves a block page or another country's page. A naive scraper reads that as "product gone" and deletes a perfectly good listing.
  • The official Product Advertising API is only open to Amazon Associates with recent qualifying sales, and it doesn't return the full specs table.

The project that started it

Remember the pet gear review site from part 1? Once TikTok creators started sending it some traffic, a new problem showed up. My chicken coop and dog crate roundups showed prices and "in stock" notes that were weeks old. A reader would click a coop listed at one price and land on a page with a different price, or no stock at all.

I couldn't use the official API, because a new affiliate site has no qualifying sales yet. So I wrote a small script that took my list of ASINs, loaded each product page, and saved the price, stock and rating every morning.

The first version had one nasty bug. When Amazon served a block page, the script decided the product was gone and hid it from the site. So I added a status field that separates a live product, an unavailable one, a page that is really gone (two 404s on different IPs), and a page that simply couldn't be read. A temporary block is never mistaken for a dead link anymore.

Then I added keyword search for finding new products to review, and the full specs table for comparison tables. At that point it was a general Amazon price tracker, so I made it a public API.

How the Amazon product scraper works

The tool is an Apify Actor called Amazon Product Scraper. It reads public product and search pages on amazon.com (US), with no Amazon account and no API key.

You can give it three kinds of input:

  • ASINs, the 10-character product IDs
  • Product links (the ASIN is read from the link)
  • Search keywords, where every organic result is scraped

Every product row has a status:

Status Meaning
ok Live product
unavailable Live page, but it can't be bought
not_found The page is really gone (two 404s on different IPs)
blocked The page couldn't be read; this is not the same as dead

How to scrape Amazon products in 4 steps

  1. Create a free Apify account.
  2. Open Amazon Product Scraper and click Try for free.
  3. Paste this input (switch the input editor to JSON):
{ "asins": ["B0BTZ8LF7J", "B07M6WXKHR"], "searchQueries": ["chicken coop for 6 chickens"], "maxResultsPerQuery": 20 } 
  1. Click Start. Export the results as JSON, CSV or Excel, or read them through the API. Press Save as task to repeat or schedule the same run in one click.

How to scrape Amazon prices with Python

Install the client with pip install apify-client, then:

from apify_client import ApifyClient client = ApifyClient("YOUR_APIFY_TOKEN") run = client.actor("scrape-lads/amazon-product-scraper").call(run_input={ "asins": ["B0BTZ8LF7J", "B07M6WXKHR", "B00BFO5KNW"], }) for p in client.dataset(run["defaultDatasetId"]).iterate_items(): if p["status"] == "ok": print(p["asin"], p["price"], p["currency"], "in stock" if p["inStock"] else "out of stock") else: print(p["asin"], p["status"]) 

Your API token is in Apify Console under Settings → API & Integrations.

How to scrape Amazon prices with JavaScript

Install the client with npm install apify-client, then:

import { ApifyClient } from 'apify-client'; const client = new ApifyClient({ token: 'YOUR_APIFY_TOKEN' }); const run = await client.actor('scrape-lads/amazon-product-scraper').call({ searchQueries: ['dog crate large'], maxResultsPerQuery: 10, }); const { items } = await client.dataset(run.defaultDatasetId).listItems(); items .filter((p) => p.type === 'product' && p.status === 'ok') .forEach((p) => console.log(p.price, p.rating, p.reviewCount, p.title)); 

What data you get for each Amazon product

One row per product. A shortened real result:

{ "type": "product", "asin": "B00BFO5KNW", "url": "https://www.amazon.com/dp/B00BFO5KNW", "status": "ok", "title": "Hatching Time Formex Snap Lock 4-6 Large Chicken Coop, Backyard Hen House", "brand": "Hatching Time", "price": 879.99, "listPrice": null, "currency": "USD", "rating": 4.6, "reviewCount": 273, "inStock": true, "availability": "In stock", "specs": { "Product Dimensions": "64\"L x 39\"W x 42\"H", "Material": "Polyethylene (PE)" }, "categories": ["Pet Supplies", "Small Animals"], "bestSellerRank": "#142,077 in Pet Supplies, #452 in Small Animal Cages" } 
Field What it is
price, listPrice, currency Current US price, and the struck-through list price when shown
inStock, availability Stock flag and the text Amazon shows
rating, reviewCount Star rating and number of ratings
title, brand, seller Listing basics
image, images Main image and up to 8 full-size images
bullets, specs Feature bullets and the full product details table
categories, bestSellerRank Breadcrumbs and rank
status ok, unavailable, not_found or blocked

Search queries also add search_result rows with the position, price, rating and a sponsored flag.

What people use it for

  • Price tracking: re-check a list of ASINs daily and catch price drops and stock changes.
  • Competitor monitoring: follow competitors' prices, ratings, review counts and rank.
  • Affiliate sites: keep product pages current and hide products that went out of stock or were removed.
  • Product research: compare price, rating and reviews across the top results for a keyword.
  • Dead link checks: find affiliate links that point to removed products.

How much it costs

  • $2.50 per 1,000 product pages ($0.0025 each)
  • $0.003 per run
  • Blocked pages and dead links are free

To cap spending, set "Maximum cost per run" in the run options; the scraper stops before it goes over.

FAQ

How do I track an Amazon product's price over time?

Put the ASINs in the input, save it as a task, and schedule it daily in Apify Console. Each run creates a new dataset, so you can compare prices across runs, or send each run to Google Sheets with an integration.

Does Amazon have an official API for product prices?

The Product Advertising API is only open to Amazon Associates with recent qualifying sales, its quota depends on those sales, and it doesn't return the full specs table. The Selling Partner API only covers your own listings. This scraper reads the public product page with no approval or sales requirement.

How do I check if an Amazon product link is dead?

Run the ASINs through the scraper and look at status. not_found means the page is really gone (two 404s on different IPs). blocked means the page couldn't be read this time, so don't delete that listing.

Can I scrape Amazon in other countries?

Not yet. It reads amazon.com with US delivery prices. A page served for another country is reported as blocked, never as dead.

Do I need an Amazon account?

No. It reads only public product and search pages.

Is it legal to scrape Amazon?

The scraper reads public product pages only. You are responsible for using the data in line with Amazon's terms and the law where you live.

Try it

That's part 5 of the series. Which side project should become an API next? Tell me in the comments.