Dev.to WebDev πŸ›  Dev πŸ‘ 0 πŸ“– 3 min read

eBay Marketplace Insights API alternative: a sold listings client in Python with paging and retries

You wanted eBay sold data, found the Marketplace Insights API, and then read the fine print: it is a limited release, production access goes to approved partners, and you get the categories eBay assigns. The Browse API i

You wanted eBay sold data, found the Marketplace Insights API, and then read the fine print: it is a limited release, production access goes to approved partners, and you get the categories eBay assigns. The Browse API is open but returns active listings only, and findCompletedItems was retired with the Finding API in February 2025.

This post builds the practical eBay Marketplace Insights API alternative: a small Python client for the SellerComps sold listings API. No partner application, no OAuth, one bearer key. It pages through results, backs off on 429, and writes a CSV.

Setup

export SELLERCOMPS_API_KEY="sc_..."
pip install requests

What the API returns

GET https://api.sellercomps.com/scrape?keyword=... returns up to 240 completed eBay sales per request, newest first, in 8 eBay countries. The parts of the response this client uses:

Field Meaning
results The sales
count Sales in this answer
hasNextPage Whether eBay has more
results[].soldPrice, soldCurrency Price as a decimal string, and its currency
results[].totalPrice Price plus shipping
results[].endedAt The sale day, YYYY-MM-DD
results[].itemId, title, condition, url The listing

The client

import csv
import os
import sys
import time

import requests

API = "https://api.sellercomps.com"
HEADERS = {"Authorization": f"Bearer {os.environ['SELLERCOMPS_API_KEY']}"}


def get(path, params, tries=4):
    for attempt in range(tries):
        r = requests.get(f"{API}{path}", params=params, headers=HEADERS, timeout=90)
        if r.status_code == 404:
            return None  # no matches or past the last page, not counted
        if r.status_code in (429, 502, 503, 504) and attempt < tries - 1:
            time.sleep(int(r.headers.get("Retry-After", 5)))
            continue
        r.raise_for_status()
        return r.json()


def sold_listings(keyword, site="ebay.com", max_pages=3, **filters):
    page = 1
    while page <= max_pages:
        data = get("/scrape", {"keyword": keyword, "ebaySite": site, "count": 240, "page": page, **filters})
        if not data:
            return
        yield from data["results"]
        if not data.get("hasNextPage"):
            return
        page += 1


if __name__ == "__main__":
    keyword = sys.argv[1] if len(sys.argv) > 1 else "nintendo switch oled"
    rows = list(sold_listings(keyword, itemCondition="used", clean="true"))
    with open("sold.csv", "w", newline="") as f:
        w = csv.writer(f)
        w.writerow(["endedAt", "itemId", "title", "condition", "soldPrice", "totalPrice", "currency", "url"])
        for s in rows:
            w.writerow([s["endedAt"], s["itemId"], s["title"], s["condition"],
                        s["soldPrice"], s["totalPrice"], s["soldCurrency"], s["url"]])
    print(len(rows), "sales written to sold.csv")

Each page is one request, so max_pages is also your budget per keyword.

Why it is written this way

  • 404 is a normal answer. A search with no matches, or a page past the last one, returns 404 and is not counted. Treat it as "done", not as an error.
  • 429 means slow down. Over your plan's requests a minute, the API answers 429 with a Retry-After header. A 502, 503 or 504 means eBay was slow; retry after a few seconds. None of those use your allowance.
  • hasNextPage drives paging. Up to 100 pages per keyword are available, newest first.
  • clean=true leaves out lots, bundles, parts or repair, empty boxes, cases and accessories, and replicas, so the rows are the item itself.

Filters you may need

ebaySite (ebay.co.uk, ebay.de, ebay.fr, ebay.it, ebay.es, ebay.ca, ebay.com.au), itemCondition, buyingFormat, minPrice and maxPrice, soldAfter and soldBefore, and categoryId. Pass them as keyword arguments to sold_listings. Each site returns its own currency, so check soldCurrency before you mix sites.

When you need more than the last few months

eBay's sold search covers the last few months. GET /history returns up to 3 years of eBay sold history for a keyword, with startDate and endDate, and totals for the whole range. Page it with nextPage until it is null. Money values there are objects with amount, currency and display, in US dollars on every site.

Two more endpoints worth knowing

  • POST /scrape/batch takes up to 100 keywords in one job and gives you one CSV of every sale at the end.
  • bestOfferPrice=true on /scrape adds acceptedOfferPrice to sales that ended with an accepted Best Offer, where eBay shows only the asking price.

The free plan has 100 requests a month, no card. The full comparison with eBay's own APIs is on the Marketplace Insights API alternative page.

Also on Medium: eBay Marketplace Insights API access (2026): 5 dead ends to skip if you are not an approved partner (https://medium.com/@sellercomps/ebay-marketplace-insights-api-access-2026-5-dead-ends-to-skip-if-you-are-not-an-approved-partner-a4340e84bc61)

πŸ“° Read the original article on Dev.to WebDev

Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes β€” full credit and traffic to the original publisher.