DEV Community

Sam Smith
Sam Smith

Posted on

Getting exact-match eBay sold prices: filtering out the wrong model, size and card number

Disclosure: we build CompsAPI, the sold-price API this post uses. It was drafted with AI assistance, and every number below comes from calls we made on 22 November 2026. A free key needs no card.

Search eBay sold listings for iphone 13 pro 256gb and take the median. You get a clean looking number. It is also wrong, because eBay's search matched the Pro Max, a pile of listings that name three storage sizes at once, and a few phones that are not an iPhone 13 at all.

Here is that search through /v1/comps, twice, a few seconds apart:

sales median
default 221 $307.51
with match=strict 90 $270.00

133 of the 224 rows on the page were a different item. 97 were another tier (Pro Max, and one mini), 32 named a different storage size or several sizes in one listing, and the rest were missing a search word. The median was $37 too high and nothing in the response looked broken.

This post covers the three parameters that deal with it, when to use which, and where the strict one is too literal.

1. require: one thing the title must contain

eBay widens a search when it can. A two word query like mew ex comes back with every Mew ex card ever printed. If you know the card number, insist on it:

curl -H "X-API-Key: $COMPSAPI_KEY" \
  "https://api.compsapi.com/v1/sold?q=mew+ex&require=151/165&days=90&size=200&stats=1"
Enter fullscreen mode Exit fullscreen mode

The response says what the filter did:

"title_filter": {"require": ["151/165"], "count_before": 199, "removed": 192}
Enter fullscreen mode Exit fullscreen mode

Of the 199 newest mew ex sales, 7 were card 151/165. The median for the whole page was $21.95. For the card we wanted it was $6.55.

require takes up to 6 comma separated words or phrases. Matching ignores case and punctuation and lands on whole words. It is the right tool when one token identifies the item: a card number, a reference number, a colourway.

2. match=strict: the title must agree with the whole search

require only knows the words you hand it. match=strict reads your search and drops any row whose title contradicts it. It checks grade and grading company, card number, storage, size, year, product tier (Pro against Pro Max), generation, search words missing from the title, listings that name several models, parts made for the item, body only listings and signed copies.

import os
import requests

resp = requests.get(
    "https://api.compsapi.com/v1/comps",
    params={"q": "iphone 13 pro 256gb", "match": "strict"},
    headers={"X-API-Key": os.environ["COMPSAPI_KEY"]},
    timeout=60,
)
data = resp.json()
print(data["stats"]["median"], "from", data["stats"]["count"], "sales")
print(data["match_filter"])
Enter fullscreen mode Exit fullscreen mode
270.0 from 90 sales
{'match': 'strict', 'count_before': 224, 'removed': 133,
 'reasons': {'tier': 97, 'storage': 32, 'missing': 3, 'title_missing': 1}, 'version': '2026-11-22.6'}
Enter fullscreen mode Exit fullscreen mode

It is opt in, it works on /v1/sold, /v1/comps and /v1/active, and it only ever removes rows. The rules are plain title rules, so they behave the same way on every call.

3. match=check: look before you filter

Before trusting any filter with a price, look at what it would take out. match=check removes nothing and puts a match_check reason on every row it would have dropped. This script prints both medians, the reasons, and the most expensive flagged rows:

import os
import statistics
import sys
from collections import Counter

import requests

query = " ".join(sys.argv[1:])
resp = requests.get(
    "https://api.compsapi.com/v1/sold",
    params={"q": query, "days": 90, "size": 200, "match": "check"},
    headers={"X-API-Key": os.environ["COMPSAPI_KEY"]},
    timeout=60,
)
resp.raise_for_status()
rows = resp.json()["items"]

kept = [row for row in rows if not row.get("match_check")]
flagged = [row for row in rows if row.get("match_check")]

print(f"{len(rows)} sales, {len(flagged)} would be removed by match=strict")
print(f"median of all rows   ${statistics.median(r['price'] for r in rows):,.2f}")
if kept:
    print(f"median of kept rows  ${statistics.median(r['price'] for r in kept):,.2f}")

print("\nwhy rows were flagged:")
for reason, n in Counter(row["match_check"] for row in flagged).most_common():
    print(f"  {n:>3}  {reason}")

print("\nflagged rows, most expensive first:")
for row in sorted(flagged, key=lambda r: -r["price"])[:10]:
    print(f"  {row['match_check']:<14} ${row['price']:>9,.2f}  {row['title'][:60]}")
Enter fullscreen mode Exit fullscreen mode
$ python check_match.py iphone 13 pro 256gb
224 sales, 133 would be removed by match=strict
median of all rows   $307.50
median of kept rows  $270.00

why rows were flagged:
   96  tier:max
   32  storage
    2  missing:13
    1  tier:mini
    1  missing:pro
    1  title_missing

flagged rows, most expensive first:
  missing:13     $   710.00  Apple iPhone Air A19 Pro 256GB 5G Factory Unlocked, Light Go
  storage        $   616.40  APPLE IPHONE 13 PRO MAX A2484 512GB/256/128GB 6.7" FACTORY U
  tier:max       $   610.81  Apple iPhone 13 PRO MAX 256GB BLUE (FACTORY UNLOCKED) ✅1 YEA
  storage        $   603.55  Apple iPhone 13 PRO MAX 128GB 256GB 512GB (UNLOCKED) ✅1 YR W
  ...
Enter fullscreen mode Exit fullscreen mode

Every one of those is a fair removal. That is the easy case.

Where strict is too literal

Cards are harder, because sellers title the same card a dozen ways. We ran charizard 4/102 base set holo psa 9 over 90 days: 194 sales, and strict flagged 69 of them (29 for the grade, 28 for a missing word, 11 for the card number, 1 signed copy).

Most were right. A CGC 9 titled "Not PSA", German copies titled Glurak, a gold metal Celebrations card. Some were not:

card_number    $ 3,400.00  1999 Base Set Charizard -  PSA 9
missing:set    $ 3,400.00  PSA 9 CHARIZARD 1999 Pokemon Base Unlimited #4/102 Holo Rare MINT
missing:holo   $ 1,200.78  1999 Pokémon Charizard Base Set 4/102, PSA 9
Enter fullscreen mode Exit fullscreen mode

Those are the card we asked for. The seller left out the number, or wrote "Base Unlimited" where we wrote "base set". Strict takes the search at its word, so every word you add is another way for a correct listing to fail.

It also kept a row it should not have: a 2021 Celebrations reprint at $184.28 whose title holds every word of the search. The fix was in the query. Strict compares years, so we added one:

q=1999 charizard 4/102 base set holo psa 9
Enter fullscreen mode Exit fullscreen mode

That run flagged 20 rows for the year, kept 80, and no Celebrations reprint was left. The median of the kept rows was $3,550.50.

What we do now

  • Keep q to the words that identify the item. With strict on, each extra word removes correct sales whose seller did not type it.
  • Add the year when reprints exist. It is the cheapest way to separate an original from a later release.
  • Use require for a single must have token, and match=strict when model, tier, size or grade all matter.
  • Run match=check first on any new search, and read the expensive flagged rows. Ten lines of output tell you whether the filter fits the way sellers title that item.
  • Watch match_filter.removed in production. If it takes most of the page, the search is too wide or too wordy.
  • It does not judge junk. A lot or an empty box whose title matches every word stays in. That is a separate filter (exclude=junk, on by default in /v1/comps).

The full parameter list is in the API docs. The junk filter and how it was tested is written up here, and there is a page on card pricing by API if cards are your use case. A free key is 100 requests a month at compsapi.com.

Top comments (0)