eBay sold listings API in Python
import os, time, requests
API = "https://www.soldcomps.io/v1/sold"
KEY = os.environ["SOLDCOMPS_KEY"] # free key: soldcomps.io/signup
def sold(q, **params):
"""eBay sold listings for one search. Retries 429/502, which are never billed."""
for attempt in range(4):
r = requests.get(API, params={"q": q, **params},
headers={"Authorization": f"Bearer {KEY}"}, timeout=30)
if r.status_code in (429, 502):
time.sleep(int(r.headers.get("Retry-After", 2 ** attempt)))
continue
r.raise_for_status()
return r.json()
r.raise_for_status()
data = sold("nintendo switch oled", condition="used", limit=20)
s = data["stats"]
print(f'{data["count"]} sales, median {s["median"]} {s["currency"]} (p25 {s["p25"]}, p75 {s["p75"]})')
for item in data["items"]:
if not item["flags"]: # flagged sales (lots, parts, outliers) are left out of stats
print(item["sold_at"], item["sold_price"]["value"], item["title"])The job
Python is where most pricing scripts, notebooks and repricers start, and the first thing they need is what an item actually sold for. eBay's Finding API, which used to answer that with findCompletedItems, was decommissioned on 2025-02-04, and the Marketplace Insights API that replaced it for sold data isn't open to new developers.
The code above is the whole integration: one GET request with requests, a retry for rate limits, and the stats eBay's own search doesn't give you. No eBay keyset, OAuth or scraping.
How to do it
- Get a key and export it. Sign up free at /signup (2,000 credits a month, no card), then export SOLDCOMPS_KEY=sh_live_... in your shell or .env.
- Install requests. pip install requests. There's no SDK to install: it's one GET endpoint, so requests or httpx is all you need.
- Call /v1/sold. Pass q plus any filters: condition, site (EBAY_US, EBAY_GB, EBAY_DE), days, min_price / max_price, buying_format and limit.
- Use stats, not your own average. stats.median, p25 and p75 come from clean sales only. Each item has flags; an empty list means it was counted.
- Retry 429 and 502. Honor Retry-After on 429; back off on 502. Neither is billed, so retrying costs nothing.
What five Python calls returned (eBay US, snapshot Nov 13, 2026)
| Item | Condition | Median | Middle half | Clean sales | Left out | Auctions | Sales from |
|---|---|---|---|---|---|---|---|
| Nintendo Switch OLED | used | $165.00 | $159.50 to $182.50 | 35 | 9 | 20% | Nov 11, 2026 to Nov 12, 2026 |
| iPhone 15 Pro 128GB (unlocked) | used | $425.00 | $410.14 to $455.00 | 41 | 3 | 12% | Oct 20, 2026 to Nov 12, 2026 |
| NVIDIA RTX 4070 | used | $619.00 | $550.00 to $650.00 | 41 | 3 | 10% | Nov 1, 2026 to Nov 12, 2026 |
| LEGO 75192 Millennium Falcon (sealed) | new | $875.00 | $844.25 to $911.83 | 40 | 4 | 10% | Oct 14, 2026 to Nov 12, 2026 |
| Sony A7 III (body only) | used | $828.00 | $770.00 to $914.05 | 39 | 4 | 10% | Oct 14, 2026 to Nov 11, 2026 |
- Across these five calls eBay returned 219 sales and 196 were clean enough to count (89%); the rest were lots, for-parts units, accessories, outliers or hidden Best Offers. stats already excludes them, so data["stats"]["median"] is safe to use as-is.
- At limit=20 each call costs 40 credits, so these five cost 200 of the free plan's 2,000. The stats are the same at any limit: they always use every matching sale.
Source: the eBay Sold Comps Index, eBay US sold listings, snapshot 2026-11-13. Prices exclude shipping. “Left out” = lots, for-parts units, outliers and hidden Best Offers (methodology).
Cost per call
| limit (sales listed) | Credits per search | Searches on Free (2,000 credits) | Searches on Starter ($5, 50,000 credits) |
|---|---|---|---|
| 1 | 21 | 95 | 2,380 |
| 10 | 30 | 66 | 1,666 |
| 20 | 40 | 50 | 1,250 |
| 50 | 70 | 28 | 714 |
| 200 | 220 | 9 | 227 |
Code
curl "https://www.soldcomps.io/v1/sold?q=rolex+submariner&condition=used" \ -H "Authorization: Bearer sh_live_xxxxxxxx"
const url = new URL("https://www.soldcomps.io/v1/sold");
url.searchParams.set("q", "charizard 4/102 \"psa 9\"");
url.searchParams.set("buying_format", "auction");
const res = await fetch(url, { headers: { Authorization: `Bearer ${process.env.SOLDCOMPS_KEY}` } });
if (!res.ok) throw new Error(`${res.status} ${(await res.json()).error.code}`);
const { count, stats, items } = await res.json();import requests
r = requests.get(
"https://www.soldcomps.io/v1/sold",
params={"q": "rolex submariner 126610ln", "condition": "used"},
headers={"Authorization": "Bearer sh_live_xxxxxxxx"},
timeout=30,
)
r.raise_for_status()
data = r.json()
print(data["count"], "sales, median", data["stats"]["median"])No code: add the MCP server https://www.soldcomps.io/mcp to Claude, ChatGPT or Cursor (setup). Full reference in the API docs.
When SoldComps.io is not the right tool
- Sold history beyond 90 days in code: CompsAPI and CompSniper document up to three years.
- Accepted Best Offer amounts: they aren't returned; sales with a hidden offer amount are flagged and left out of stats.
- Active (unsold) listings: use eBay's Browse API, which is open to developers with an application token.
Frequently asked questions
Is there a Python SDK?
No, and you don't need one: the API is a single GET endpoint that returns JSON, so requests or httpx covers it in a few lines.
How do I load the sales into pandas?
pd.json_normalize(data["items"]) gives one row per sale, with nested fields flattened into columns such as sold_price.value and shipping.value. Filter out rows whose flags list isn't empty to match the stats.
Can I search eBay UK or Germany from Python?
Yes. Add site="EBAY_GB" or site="EBAY_DE" to the params; prices come back in GBP or EUR.
How do I keep costs down?
Set limit to the number of sales you'll actually show (often 10 to 20). Stats use every matching sale regardless, and you pay 20 credits per search + 1 per sale returned. Repeat searches within 12 hours are served from cache.
Related
- API docs (all parameters and fields)
- JavaScript and Node.js version
- eBay sold price alerts (a daily Python job)
- Developer integration overview
- Does eBay have a sold listings API?
- Pricing
SoldComps.io sells an eBay sold comps API, so we have a commercial interest here. Corrections: hello@soldcomps.io.