Scrape eBay sold listings in Python

To scrape eBay sold listings in Python, you do not need a scraper. One short script asks GET /ebay/v1/sold for 100 sales and prints their prices. A second call opens one listing in full.

Do these steps

Click the button to copy this prompt, then paste it into your coding agent. The link tells it which page you came from.

prompt
Read https://trawl.dev/llms.txt?from=/guides/scrape-ebay-sold-listings-python and help me integrate this API into my project.
  1. Install the package.
    terminal
    pip install trawl-api
  2. Set your API key. Get a key from the free tier.
    terminal
    export TRAWL_API_KEY=your_key
  3. Run the script. The search costs 1 credit. The listing lookup costs 1 credit.
sold_listings.py 路 the script
# sold_listings.py
import statistics
from trawl_api import Trawl

client = Trawl()  # reads TRAWL_API_KEY from the environment

sold = client.ebay.sold(
    "charizard psa 10",
    condition="used",
    exclude=["lot", "proxy", "candidate", "worthy"],
    max_pages=1,  # one page: up to 100 sales, 1 credit
)

print(f"{sold.count} sales, {sold.credits_charged} credit")
for s in sold.results[:5]:
    print(f"{s.date_sold:%Y-%m-%d}  ${s.sale_price:>8.2f}  {s.title[:58]}")

prices = [s.sale_price for s in sold.results]
median = statistics.median(prices)
print(f"median ${median:.2f}, low ${min(prices):.2f}, high ${max(prices):.2f}")

# One listing in full: the sale nearest the median.
nearest = min(sold.results, key=lambda s: abs(s.sale_price - median))
item = client.ebay.item(nearest.item_id)
specifics = {a.key: a.value for a in item.attributes}
print(item.title)
print(f"  {item.condition_raw}, {specifics.get('Set')}, card {specifics.get('Card Number')}")
print(f"  seller {item.seller.username}, {item.seller.feedback_percent}% positive, {len(item.images)} images")
terminal 路 printed 2026-10-07
100 sales, 1 credit
2026-10-06  $  414.13  Charizard Set Base 1 St Edition Square psa 10 No Blastoise
2026-10-05  $  215.00  Pok茅mon 30th Anniversary Celebration - Charizard - 4/102 P
2026-10-05  $  198.50  Pok茅mon 30th Anniversary Celebration - Charizard - 4/102 P
2026-10-05  $  182.50  Charizard 4/102 Celebrations: Classic Collection Holo PSA
2026-10-05  $  207.50  MINT 30th Anniversary Celebrations Charizard PSA 10 馃拵CONTE
median $237.97, low $7.99, high $2491.47
Pok茅mon Card Charizard 4/102 Holo 30th Celebrations Potential PSA 10 (AI 9.6)
  Ungraded - Near mint or better, Celebrations: Classic Collection, card 4/102
  seller maddoxbrock, 100.0% positive, 6 images
sale prices 路 the 100 sales of the run above
0102030$0$100$200$300$400$500+2413median $237.97

client.ebay.sold() calls the eBay Sold Listings API. Each word of the query must be in the listing title. condition keeps new, used, parts or other. exclude removes titles that contain a word. Here it removes "candidate" and "worthy": ungraded cards that sellers call PSA 10 candidates.

max_pages sets the number of pages. One page holds up to 100 sales. A full page means older sales may exist. Raise max_pages, or set date_from and date_to. The eBay sold listings history guide shows the second way.

Open one listing

Each result has an item_id. client.ebay.item() opens that listing with the eBay Sold Item Details API. You get the item specifics, the images, the seller and the recorded sales. The script opens the sale nearest the median.

Without the package

The package makes one HTTPS call. You can make the same call with requests. Put the key in the x-api-key header.

sold_listings_requests.py 路 the same call with requests
# sold_listings_requests.py
import os
import requests

r = requests.get(
    "https://api.trawl.dev/ebay/v1/sold",
    params={"query": "charizard psa 10", "condition": "used", "exclude": "lot,proxy,candidate,worthy"},
    headers={"x-api-key": os.environ["TRAWL_API_KEY"]},
    timeout=30,
)
r.raise_for_status()
sold = r.json()
print(sold["count"], "sales,", sold["credits_charged"], "credit")
for s in sold["results"][:3]:
    print(s["date_sold"][:10], s["sale_price"], s["title"][:58])
terminal 路 printed 2026-10-07
100 sales, 1 credit
2026-10-06 414.13 Charizard Set Base 1 St Edition Square psa 10 No Blastoise
2026-10-05 215 Pok茅mon 30th Anniversary Celebration - Charizard - 4/102 P
2026-10-05 198.5 Pok茅mon 30th Anniversary Celebration - Charizard - 4/102 P