ScavioScavio
FeaturesPricingDocs
Sign InGet Started
  1. Home
  2. Tutorials
  3. How to Track Amazon Bestseller Ranking Changes via API
Tutorial

How to Track Amazon Bestseller Ranking Changes via API

Monitor Amazon bestseller ranking changes over time using the Scavio API. Track BSR for multiple products and detect trends in category performance.

Get Free API KeyAPI Docs

Amazon Best Sellers Rank (BSR) is a critical metric for sellers and market researchers. A product's BSR indicates its sales velocity relative to other products in the same category. Tracking BSR changes over time reveals seasonal trends, the impact of promotions, and competitive dynamics. This tutorial builds a BSR tracking pipeline that queries Amazon product data via the Scavio API, stores daily BSR snapshots, and detects significant ranking changes.

Prerequisites

  • Python 3.8 or higher
  • requests library installed
  • A Scavio API key
  • A list of ASINs to track

Walkthrough

Step 1: Define ASINs to track

Create a list of Amazon ASINs with their names for easy identification in reports.

Python
PRODUCTS = {
    "B09G9FPHY6": "Echo Dot 5th Gen",
    "B07FZ8S74R": "Fire TV Stick 4K",
    "B09XS7JWHH": "Sony WH-1000XM5",
}

Step 2: Fetch product data including BSR

Query the Scavio Amazon endpoint for each ASIN and extract the bestseller rank from the product response.

Python
def get_product_data(asin: str) -> dict:
    r = requests.post(
        "https://api.scavio.dev/api/v1/search",
        headers={"x-api-key": API_KEY},
        json={"platform": "amazon", "query": asin, "marketplace": "US"}
    )
    r.raise_for_status()
    product = r.json().get("product", {})
    return {
        "asin": asin,
        "title": product.get("title", ""),
        "bsr": product.get("bestseller_rank"),
        "price": product.get("price"),
        "rating": product.get("rating"),
    }

Step 3: Store daily snapshots

Append each day's BSR data to a CSV file for historical analysis. Include a timestamp for each reading.

Python
import csv
from datetime import date

def save_bsr(data: dict) -> None:
    with open("bsr_history.csv", "a", newline="") as f:
        writer = csv.writer(f)
        writer.writerow([
            date.today().isoformat(),
            data["asin"],
            data["title"],
            data["bsr"],
            data["price"],
        ])

Step 4: Detect significant changes

Compare current BSR against the previous reading and flag products with large rank movements.

Python
def detect_changes(current: dict, previous: dict, threshold: float = 0.2) -> str | None:
    if not current.get("bsr") or not previous.get("bsr"):
        return None
    curr_bsr = int(current["bsr"])
    prev_bsr = int(previous["bsr"])
    change_pct = (prev_bsr - curr_bsr) / prev_bsr
    if abs(change_pct) >= threshold:
        direction = "improved" if change_pct > 0 else "dropped"
        return f"{current['title']}: BSR {direction} from #{prev_bsr} to #{curr_bsr} ({change_pct*100:+.0f}%)"
    return None

Python Example

Python
import os
import csv
import requests
from datetime import date

API_KEY = os.environ.get("SCAVIO_API_KEY", "your_scavio_api_key")
ENDPOINT = "https://api.scavio.dev/api/v1/search"
PRODUCTS = {"B09G9FPHY6": "Echo Dot 5th Gen", "B07FZ8S74R": "Fire TV Stick 4K"}

def get_bsr(asin: str) -> dict:
    r = requests.post(ENDPOINT, headers={"x-api-key": API_KEY},
                      json={"platform": "amazon", "query": asin, "marketplace": "US"})
    r.raise_for_status()
    p = r.json().get("product", {})
    return {"asin": asin, "bsr": p.get("bestseller_rank"), "price": p.get("price")}

if __name__ == "__main__":
    today = date.today().isoformat()
    with open("bsr_history.csv", "a", newline="") as f:
        w = csv.writer(f)
        for asin, name in PRODUCTS.items():
            data = get_bsr(asin)
            w.writerow([today, asin, name, data["bsr"], data["price"]])
            print(f"{name}: BSR #{data['bsr']} | {data['price']}")

JavaScript Example

JavaScript
const API_KEY = process.env.SCAVIO_API_KEY || "your_scavio_api_key";
const ENDPOINT = "https://api.scavio.dev/api/v1/search";
const fs = require("fs");

const PRODUCTS = { B09G9FPHY6: "Echo Dot 5th Gen", B07FZ8S74R: "Fire TV Stick 4K" };

async function getBSR(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();
  return { bsr: data.product?.bestseller_rank, price: data.product?.price };
}

async function main() {
  const today = new Date().toISOString().slice(0, 10);
  for (const [asin, name] of Object.entries(PRODUCTS)) {
    const data = await getBSR(asin);
    const line = `${today},${asin},${name},${data.bsr},${data.price}\n`;
    fs.appendFileSync("bsr_history.csv", line);
    console.log(`${name}: BSR #${data.bsr} | ${data.price}`);
  }
}
main().catch(console.error);

Expected Output

JSON
Echo Dot 5th Gen: BSR #3 | $29.99
Fire TV Stick 4K: BSR #7 | $24.99

bsr_history.csv:
2026-04-19,B09G9FPHY6,Echo Dot 5th Gen,3,$29.99
2026-04-19,B07FZ8S74R,Fire TV Stick 4K,7,$24.99
2026-04-18,B09G9FPHY6,Echo Dot 5th Gen,5,$29.99
2026-04-18,B07FZ8S74R,Fire TV Stick 4K,6,$24.99

Related Tutorials

  • How to Monitor Amazon Prices Across Multiple ASINs
  • How to Get Amazon Product Reviews via API

Frequently Asked Questions

Most developers complete this tutorial in 15 to 30 minutes. You will need a Scavio API key (free tier works) and a working Python or JavaScript environment.

Python 3.8 or higher. requests library installed. A Scavio API key. A list of ASINs to track. A Scavio API key gives you 250 free credits per month.

Yes. The free tier includes 250 credits per month, which is more than enough to complete this tutorial and prototype a working solution.

Scavio has a native LangChain package (langchain-scavio), an MCP server, and a plain REST API that works with any HTTP client. This tutorial uses the raw REST API, but you can adapt to your framework of choice.

Related Resources

Best Of

Best API-Based Rank Trackers for SEO in 2026

Read more
Best Of

Best SEO Rank Tracking APIs in 2026

Read more
Solution

Build Reliable Local Rank Tracking with Scavio API

Read more
Comparison

Semrush vs Scavio

Read more
Use Case

Amazon Scraper to API Migration

Read more
Workflow

Daily Local Rank Tracking Pipeline

Read more

Start Building

Monitor Amazon bestseller ranking changes over time using the Scavio API. Track BSR for multiple products and detect trends in category performance.

Get Free API KeyRead the Docs
ScavioScavio

Real-time search API for AI agents. Search every platform, not just Google.

Product

  • Features
  • Pricing
  • Dashboard
  • Affiliates

Developers

  • Documentation
  • API Reference
  • Quickstart
  • MCP Integration
  • Python SDK

Alternatives

  • Tavily Alternative
  • SerpAPI Alternative
  • Firecrawl Alternative
  • Exa Alternative

Tools

  • JSON Formatter
  • cURL to Code
  • Token Counter
  • All Tools

© 2026 Scavio. All rights reserved.

Featured on TAAFT
Terms of ServicePrivacy Policy