Price monitoring across Amazon ASINs is essential for e-commerce sellers, deal hunters, and market intelligence teams. Direct scraping of Amazon product pages triggers bot detection quickly and requires constant maintenance. The Scavio API provides a stable product endpoint that returns current price, rating, review count, and availability for any ASIN. This tutorial builds a polling script that checks a list of ASINs, compares prices against stored baselines, and prints an alert when a price drops below a configured threshold.
Prerequisites
- Python 3.8 or higher
- requests library installed
- A Scavio API key
- A list of Amazon ASINs to monitor
Walkthrough
Step 1: Define your ASIN watchlist
Create a dictionary mapping ASINs to target price thresholds. The script will alert when the live price falls at or below the threshold.
WATCHLIST = {
"B09G9FPHY6": {"name": "Echo Dot 5th Gen", "threshold": 35.0},
"B07FZ8S74R": {"name": "Fire TV Stick 4K", "threshold": 25.0},
}Step 2: Fetch the current price for an ASIN
POST to the Scavio endpoint with platform amazon and the ASIN as the query. The response includes a price field under the product object.
def get_amazon_price(asin: str) -> dict:
response = requests.post(
"https://api.scavio.dev/api/v1/search",
headers={"x-api-key": API_KEY},
json={"platform": "amazon", "query": asin, "marketplace": "US"}
)
response.raise_for_status()
return response.json()Step 3: Compare price against the threshold
Extract the current price from the response and compare it to the stored threshold. Handle missing or None prices gracefully.
def check_price(asin: str, meta: dict, data: dict) -> None:
product = data.get("product", {})
price_str = product.get("price", "")
if not price_str:
return
price = float(price_str.replace("$", "").replace(",", ""))
if price <= meta["threshold"]:
print(f"ALERT: {meta['name']} is ${price} (threshold ${meta['threshold']})")Step 4: Run the monitoring loop
Iterate over all ASINs, fetch prices, and check thresholds. Sleep between polls to stay within rate limits.
import time
while True:
for asin, meta in WATCHLIST.items():
data = get_amazon_price(asin)
check_price(asin, meta, data)
print("Cycle complete. Sleeping 3600s...")
time.sleep(3600)Python Example
import os
import time
import requests
API_KEY = os.environ.get("SCAVIO_API_KEY", "your_scavio_api_key")
ENDPOINT = "https://api.scavio.dev/api/v1/search"
WATCHLIST = {
"B09G9FPHY6": {"name": "Echo Dot 5th Gen", "threshold": 35.0},
"B07FZ8S74R": {"name": "Fire TV Stick 4K", "threshold": 25.0},
}
def get_price(asin: str) -> float | None:
r = requests.post(
ENDPOINT,
headers={"x-api-key": API_KEY},
json={"platform": "amazon", "query": asin, "marketplace": "US"}
)
r.raise_for_status()
price_str = r.json().get("product", {}).get("price", "")
if price_str:
return float(price_str.replace("$", "").replace(",", ""))
return None
def monitor():
for asin, meta in WATCHLIST.items():
price = get_price(asin)
if price and price <= meta["threshold"]:
print(f"[ALERT] {meta['name']}: ${price}")
else:
print(f"[OK] {meta['name']}: ${price}")
if __name__ == "__main__":
while True:
monitor()
time.sleep(3600)JavaScript Example
const API_KEY = process.env.SCAVIO_API_KEY || "your_scavio_api_key";
const ENDPOINT = "https://api.scavio.dev/api/v1/search";
const WATCHLIST = {
"B09G9FPHY6": { name: "Echo Dot 5th Gen", threshold: 35.0 },
"B07FZ8S74R": { name: "Fire TV Stick 4K", threshold: 25.0 },
};
async function getPrice(asin) {
const res = await fetch(ENDPOINT, {
method: "POST",
headers: { "x-api-key": API_KEY, "Content-Type": "application/json" },
body: JSON.stringify({ platform: "amazon", query: asin, marketplace: "US" })
});
const data = await res.json();
const priceStr = data?.product?.price || "";
return priceStr ? parseFloat(priceStr.replace(/[$,]/g, "")) : null;
}
async function monitor() {
for (const [asin, meta] of Object.entries(WATCHLIST)) {
const price = await getPrice(asin);
if (price !== null && price <= meta.threshold) {
console.log(`[ALERT] ${meta.name}: $${price}`);
} else {
console.log(`[OK] ${meta.name}: $${price}`);
}
}
}
monitor().catch(console.error);Expected Output
{
"product": {
"asin": "B09G9FPHY6",
"title": "Echo Dot (5th Gen)",
"price": "$29.99",
"original_price": "$49.99",
"rating": "4.7",
"reviews_count": 284521,
"availability": "In Stock",
"marketplace": "US"
}
}