---
title: "eBay sold listings API in Python"
url: https://www.soldcomps.io/use-cases/ebay-sold-listings-api-python
updated: 2026-11-23
answer: "To get eBay sold listings in Python, call GET https://www.soldcomps.io/v1/sold with requests and a Bearer key: one call returns up to 200 eBay sales from the last 90 days with the median, p25 and p75 already worked out, at 20 credits per search + 1 per sale returned, and the free plan includes 2,000 credits a month."
publisher: SoldComps.io (https://www.soldcomps.io)
---

# eBay sold listings API in Python

> To get eBay sold listings in Python, call GET https://www.soldcomps.io/v1/sold with requests and a Bearer key: one call returns up to 200 eBay sales from the last 90 days with the median, p25 and p75 already worked out, at 20 credits per search + 1 per sale returned, and the free plan includes 2,000 credits a month.

**Python: sold listings and the median for one item**

```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"])
```

**Next step:** [Get a free API key](https://www.soldcomps.io/signup?ref=use-case-ebay-sold-listings-api-python)

## 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

1. **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.
2. **Install requests.** pip install requests. There's no SDK to install: it's one GET endpoint, so requests or httpx is all you need.
3. **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.
4. **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.
5. **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 (p25 to p75) | Clean sales | Left out | Auction share | Sales from |
|---|---|---|---|---|---|---|---|
| [Nintendo Switch OLED](https://www.soldcomps.io/comps/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)](https://www.soldcomps.io/comps/iphone-15-pro-128gb) | used | $425.00 | $410.14 to $455.00 | 41 | 3 | 12% | Oct 20, 2026 to Nov 12, 2026 |
| [NVIDIA RTX 4070](https://www.soldcomps.io/comps/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)](https://www.soldcomps.io/comps/lego-75192-millennium-falcon) | new | $875.00 | $844.25 to $911.83 | 40 | 4 | 10% | Oct 14, 2026 to Nov 12, 2026 |
| [Sony A7 III (body only)](https://www.soldcomps.io/comps/sony-a7-iii-body) | 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: SoldComps.io eBay Sold Comps Index (https://www.soldcomps.io/comps), eBay US sold listings, snapshot 2026-11-13. Prices exclude shipping.

## 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

```bash
curl "https://www.soldcomps.io/v1/sold?q=rolex+submariner&condition=used" \
  -H "Authorization: Bearer sh_live_xxxxxxxx"
```

```javascript
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();
```

```python
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"])
```

MCP (no code): add https://www.soldcomps.io/mcp to Claude, ChatGPT or Cursor. Full reference: https://www.soldcomps.io/docs.md

## 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)](https://www.soldcomps.io/docs)
- [JavaScript and Node.js version](https://www.soldcomps.io/use-cases/ebay-sold-listings-api-javascript)
- [eBay sold price alerts (a daily Python job)](https://www.soldcomps.io/use-cases/ebay-sold-price-alerts)
- [Developer integration overview](https://www.soldcomps.io/use-cases/developer-integration)
- [Does eBay have a sold listings API?](https://www.soldcomps.io/blog/does-ebay-have-a-sold-listings-api)
- [Pricing](https://www.soldcomps.io/pricing)

SoldComps.io sells an eBay sold comps API, so we have a commercial interest here. Corrections: hello@soldcomps.io
