eBay sold listings API in JavaScript and Node.js

To get eBay sold listings in JavaScript, call GET https://www.soldcomps.io/v1/sold with fetch from your server and a Bearer key: it returns up to 200 eBay sales from the last 90 days plus the median, p25 and p75, at 20 credits per search + 1 per sale returned, with 2,000 free credits a month; keep the key server-side.
Node.js 18+: sold listings with retries
// sold.mjs, Node 18+ (built-in fetch). Free key: soldcomps.io/signup
const API = "https://www.soldcomps.io/v1/sold";

export async function sold(q, params = {}) {
  const url = new URL(API);
  url.search = new URLSearchParams({ q, ...params });
  for (let attempt = 0; attempt < 4; attempt++) {
    const res = await fetch(url, { headers: { Authorization: `Bearer ${process.env.SOLDCOMPS_KEY}` } });
    if (res.status === 429 || res.status === 502) { // never billed: wait, then retry
      const wait = Number(res.headers.get("retry-after")) || 2 ** attempt;
      await new Promise((r) => setTimeout(r, wait * 1000));
      continue;
    }
    const body = await res.json();
    if (!res.ok) throw new Error(`${res.status} ${body.error.code}: ${body.error.message}`);
    return body;
  }
  throw new Error("still rate limited after 4 tries");
}

const { count, stats, items } = await sold("steam deck oled", { condition: "used", limit: "20" });
console.log(`${count} sales, median ${stats.median} ${stats.currency} (p25 ${stats.p25}, p75 ${stats.p75})`);
console.log(items.filter((i) => i.flags.length === 0).map((i) => [i.sold_at, i.sold_price.value]));

Get a free API key

The job

Listing tools, Chrome extensions, marketplace apps and Next.js sites need sold prices in JavaScript. eBay's Browse API only returns items still for sale, and its sold-data API, Marketplace Insights, isn't open to new developers.

The function above runs anywhere with fetch: a Next.js route handler, Express, a serverless function or a queue worker. Call it from your server, never from the browser, because the key is a secret.

How to do it

  1. Get a key. Free at /signup, no card. Store it as SOLDCOMPS_KEY in your server environment.
  2. Call it server-side. From a route handler or API endpoint, call sold(q, params) and return only what the page needs: median, p25, p75 and a few sales.
  3. Handle errors by code. Every error has error.code and error.message. 429 rate_limited and 502 upstream_unavailable are safe to retry; 402 quota_exceeded means out of credits.
  4. Cache on your side too. Results for the same search are cached for up to 12 hours on ours; cache them on yours for the same window to cut calls.
  5. Credit the data. If you show prices publicly, display "Sold data by SoldComps.io" with a link (Terms, section 3).

What five calls returned (eBay US, snapshot Nov 13, 2026)

ItemConditionMedianMiddle halfClean salesLeft outAuctionsSales from
PlayStation 5 (disc)used$475.00$449.99 to $519.994045%Nov 11, 2026 to Nov 12, 2026
Steam Deck OLED 512GBused$600.00$590.00 to $629.9941315%Nov 9, 2026 to Nov 12, 2026
AirPods Pro (2nd gen)used$65.00$59.97 to $73.0035826%Sep 17, 2026 to Nov 11, 2026
Nike Dunk Low Panda (size 10, new)new$65.00$53.98 to $79.643516%Aug 16, 2026 to Nov 11, 2026
NVIDIA RTX 3080used$414.97$385.00 to $459.994135%Sep 13, 2026 to Nov 12, 2026

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 searchSearches on Free (2,000 credits)Searches on Starter ($5, 50,000 credits)
121952,380
1030661,666
2040501,250
507028714
2002209227

Code

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

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

Frequently asked questions

Can I call it from the browser?

Don't: the key would be visible to anyone. Call it from your server (a Next.js route handler, Express route or serverless function) and send the browser only the numbers.

Is there an npm package?

No package is needed. It's one GET endpoint returning JSON, so the built-in fetch in Node 18+ is enough. There's an OpenAPI spec at /openapi.json if you want to generate types.

Does it work with TypeScript?

Yes. Generate types from /openapi.json, or type the fields you use: count, stats.median, stats.p25, stats.p75 and items[].sold_price.value.

What does a call cost?

20 credits per search plus 1 credit per sale returned: a 50-sale search costs 70, a 200-sale search costs 220, a search with no sales costs 20. Failed calls and usage checks cost nothing.

Related

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