Research eBay prices for new and used items in Python
In this tutorial you will build a price research script for resellers. For a search term it reads Buy It Now listings in new and used condition. It prints the price range with shipping (low, quartiles, median, high), the units already sold on those listings, and the listing that sold the most. It uses the eBay Data API and about 50 lines of Python.
What you need: Python 3.8+, pip install requests, and a free RapidAPI key.
1. Subscribe to the free plan
- Open the eBay Data API on RapidAPI and subscribe to the free Basic plan (20 requests a month).
- Copy your
X-RapidAPI-Keyand export it:
export RAPIDAPI_KEY=your_key
2. A small helper to call the API
The helper sends your key, retries rate limits (HTTP 429) and server errors (5xx) with a growing wait, and stops with the API’s error message on anything else.
"""Research the going price of an item on eBay, new vs used, with sales counts.
Uses the eBay Data API on RapidAPI:
https://rapidapi.com/apiwren-apiwren-default/api/ebay-data-api-search-item-details-seller
"""
import os, sys, time
from statistics import median, quantiles
import requests
HOST = "ebay-data-api-search-item-details-seller.p.rapidapi.com"
HEADERS = {"X-RapidAPI-Key": os.environ["RAPIDAPI_KEY"], "X-RapidAPI-Host": HOST}
def get(path, **params):
"""GET one endpoint. Retries rate limits (429) and server errors (5xx)."""
for attempt in range(4):
r = requests.get(f"https://{HOST}{path}", headers=HEADERS, params=params, timeout=90)
retry = r.status_code == 429 or r.status_code in range(500, 600)
if retry and attempt != 3:
time.sleep(float(r.headers.get("Retry-After") or 2 ** (attempt + 1)))
continue
if not r.ok:
sys.exit(f"HTTP {r.status_code}: {r.text[:300]}")
body = r.json()
if isinstance(body, dict) and body.get("success") is False:
sys.exit(f"API error: {body.get('error')}")
return body
3. Search active listings
/search takes a query plus filters: condition, buying_format, country, page_size (60, 120 or 240) and more. Each item has price, shipping, quantity_sold, condition and is_sponsored. We skip sponsored results.
def listings(query, condition, country="US"):
data = get("/search", query=query, condition=condition, country=country,
buying_format="buy_it_now", page_size=60)["data"]
return data["total_results"], [i for i in data["items"] if not i["is_sponsored"] and i["price"]]
4. Compute the price picture
The landed price is price plus shipping, which is what a buyer compares. Quartiles show the typical band better than an average, which one odd listing can skew.
def landed(item):
return round(item["price"] + (item["shipping"] or 0), 2)
def summary(query, condition):
total, items = listings(query, condition)
if not items:
print(f"{condition.upper()}: no listings found")
return
prices = sorted(landed(i) for i in items)
q1, mid, q3 = quantiles(prices, n=4) if len(prices) != 1 else (prices[0],) * 3
sold = sum(i["quantity_sold"] or 0 for i in items)
best = max(items, key=lambda i: i["quantity_sold"] or 0)
print(f"{condition.upper()}: {total:,} listings on eBay, {len(items)} sampled")
print(f" price with shipping: low {prices[0]:.2f} 25% {q1:.2f} median {mid:.2f} "
f"75% {q3:.2f} high {prices[-1]:.2f} {items[0]['currency']}")
print(f" units sold across the sample: {sold:,}")
print(f" top seller listing: {best['quantity_sold']} sold at {landed(best):.2f} {best['title'][:55]}")
def main(query):
print(f"eBay price research: {query}")
for condition in ("new", "used"):
summary(query, condition)
if __name__ == "__main__":
main(" ".join(sys.argv[1:]) or "nintendo switch oled")
5. Run it
python ebay_price_research.py nintendo switch oled
Real output from a run on 2026-11-28:
eBay price research: nintendo switch oled
NEW: 1,100 listings on eBay, 44 sampled
price with shipping: low 125.38 25% 310.64 median 349.92 75% 384.42 high 413.71 USD
units sold across the sample: 541
top seller listing: 477 sold at 384.95 NEW Nintendo Switch OLED Splatoon 3 + Mario Rabbids ⭐ S
USED: 4,300 listings on eBay, 45 sampled
price with shipping: low 124.99 25% 169.55 median 187.25 75% 209.57 high 265.36 USD
units sold across the sample: 301
top seller listing: 255 sold at 159.79 Nintendo - Switch OLED Handheld Console - 64GB Model: H
These are asking prices of live listings. quantity_sold counts units sold on each listing, which shows which price points actually move.
The complete script is in examples/ebay_price_research.py.
Tips
- Set
countrytoGB,DEor another of the 14 sites to research other markets. - Add
min_priceto filter out accessories that match the same keywords. - Use
/item-detailson the top listing to read its item specifics and watchers.
Next steps
- eBay Data API on RapidAPI: all endpoints, plans and the live playground.
- eBay Data API overview and more tutorials.
- Questions? Email terrelllouis056@gmail.com.