Fix
Player ID mismatch: joining box scores and odds
Short answer: a join of stats and odds that returns nothing usually mixes id systems or id types. Each SportsDataHQ brand issues its own player id, and the type changes by sport. Look the id up with search_players, store it as text beside your own person key, and join through that crosswalk. Names are the fallback.
What the error looks like
You pull a box score table from one source and a props or odds table from another. You join on player_id. The result has zero rows, or a few hundred out of thousands, and no error is raised. A merge in pandas or a JOIN in SQL treats a missing match as normal, so the failure is silent.
There are four causes, and they show up in this order of frequency:
- Different id systems. Your stats table uses an id from one system and the odds table uses another. The numbers can even overlap by accident, which is worse than no overlap, because you get wrong joins instead of empty ones.
- Different types.
8479420as an integer does not equal"8479420"as a string. Pandas will refuse some of these merges and quietly return nothing for others. SQL engines differ in whether they cast for you. - Format drift. A football id looks like
00-0034857, and a spreadsheet will strip the leading zeros if it ever treats the column as a number. - The player changed teams or was renamed. A name and team match breaks at the trade deadline or when a name is spelled with and without an accent.
How ids differ across SportsDataHQ brands
We checked this on December 6, 2026 by calling search_players on four brands. Each call returned one player, and the id looked different every time:
| Brand | Player | Field | Id returned | Type |
|---|---|---|---|---|
| PuckAPI (hockey) | Tage Thompson | id | 8479420 | integer |
| DunkAPI (basketball) | Luka Doncic | player_id | "3945274" | string |
| EndzoneAPI (football) | Josh Allen | player_id | "00-0034857" | string |
| StrikerAPI (soccer) | Bukayo Saka | player_id | "280555" | string |
Two other details trip people up. The hockey endpoint names its parameter query and the basketball and soccer endpoints name theirs name. And in football the props rows carry the id in a field called gsis_id instead of player_id, while the hockey and basketball props rows use player_id. Game ids differ too: a hockey game is 2026020239, a football game is 2026_01_BUF_HOU, and a basketball game is a nine-digit string.
The rule that keeps this manageable: inside one brand, an id means the same thing in every endpoint. The id that search_players returns is the id that get_player_props, the game log and the shot endpoints take. A stats-to-odds join inside one brand needs no mapping at all, as long as both sides are cast to the same type.
Step 1: look the id up, do not guess it
This script runs search_players on four brands and prints each id with its type. Set one key per brand in the environment first. Brand keys come from each brand's dashboard, and each brand has 500 free credits a month. search_players costs 1 or 2 credits.
import json, os, urllib.request
# brand, host, name parameter, id field, query
BRANDS = [
("puckapi", "mcp.puckapi.com", "query", "id", "Tage Thompson"),
("dunkapi", "mcp.dunkapi.com", "name", "player_id", "Luka Doncic"),
("endzoneapi", "mcp.endzoneapi.com", "query", "player_id", "Josh Allen"),
("strikerapi", "mcp.strikerapi.com", "name", "player_id", "Bukayo Saka"),
]
for brand, host, param, id_field, who in BRANDS:
req = urllib.request.Request(
f"https://{host}/v1/search_players",
data=json.dumps({param: who, "limit": 1}).encode(),
headers={"Content-Type": "application/json", "x-api-key": os.environ[f"{brand.upper()}_KEY"]},
)
with urllib.request.urlopen(req, timeout=30) as resp:
player = json.load(resp)["data"]["players"][0]
print(f"{brand:11s} HTTP {resp.status} {player['name']:16s} {id_field}={player[id_field]!r}")Now pass that id to the odds side of the same brand. In hockey, get_player_props takes the same integer id and returns rows that carry player_id, so the join key already agrees:
curl -s -X POST https://mcp.puckapi.com/v1/get_player_props \
-H "Content-Type: application/json" -H "x-api-key: $KEY" \
-d '{"player_id": 8481721, "from_date": "2026-11-01", "to_date": "2026-11-05", "market": "player_shots_on_goal"}'Step 2: match on name, team and position when a source has its own ids
Your own spreadsheet, a model output or a table bought elsewhere has ids we cannot know. In that case match on a normalized name plus team, and use position to break ties. Strip accents, punctuation and suffixes first, because José Álvarez and Jose Alvarez Jr. are the same person.
import re, unicodedata
from collections import defaultdict
SUFFIX = re.compile(r"\b(jr|sr|ii|iii|iv)\b\.?$")
def norm(name: str) -> str:
s = unicodedata.normalize("NFKD", name).encode("ascii", "ignore").decode()
s = re.sub(r"[^a-z ]", "", s.lower().replace("-", " "))
return SUFFIX.sub("", s.strip()).strip()
stats = [
{"stat_id": "s-101", "name": "Jose Alvarez Jr.", "team": "BUF", "pos": "D"},
{"stat_id": "s-102", "name": "Sam Carlson", "team": "BUF", "pos": "C"},
{"stat_id": "s-103", "name": "Sam Carlson", "team": "BUF", "pos": "D"},
{"stat_id": "s-104", "name": "Noel Ouellet", "team": "TOR", "pos": "W"},
]
odds = [
{"player_id": 9001, "player_name": "José Álvarez", "team": "BUF", "pos": "D"},
{"player_id": 9002, "player_name": "Sam Carlson", "team": "BUF", "pos": "D"},
{"player_id": 9003, "player_name": "Noël Ouellet", "team": "TOR", "pos": "W"},
{"player_id": 9004, "player_name": "Unknown Player", "team": "TOR", "pos": "G"},
]
index = defaultdict(list)
for s in stats:
index[(norm(s["name"]), s["team"])].append(s)
matched, review = [], []
for o in odds:
hits = index.get((norm(o["player_name"]), o["team"]), [])
if len(hits) > 1: # same name, same team: position breaks the tie
hits = [h for h in hits if h["pos"] == o["pos"]]
(matched if len(hits) == 1 else review).append((o["player_id"], [h["stat_id"] for h in hits]))
print("matched:", matched)
print("needs review:", review)The output has three matches and one row for review. That last row is the point: a matcher should never guess. Anything with zero or several candidates goes to a review list that a person reads once, and the answer is written into the crosswalk so it never has to be solved again.
Step 3: keep a crosswalk table you own
Once a match is confirmed, store it. A crosswalk is a table with one row per brand id and a stable key of your own that groups the ids of one person. The full design is in the unified player id crosswalk guide. The short version is that every later join goes through that table, so the matching code runs only for new players.
Teams and schools: a ready-made college crosswalk
For college football, basketball and baseball there is a public crosswalk of team ids at collegesportsapi.com/crosswalk. It lists every Division I school with its team id and conference in each sport, as a CSV, free to download. On December 6, 2026 it held 367 schools. Football and basketball share ids for a school, and baseball is matched by school name, so 16 of 322 baseball teams have no match. This snippet reads the CSV and looks up three schools:
import csv, io, urllib.request
with urllib.request.urlopen("https://collegesportsapi.com/crosswalk.csv", timeout=30) as resp:
print("HTTP", resp.status)
rows = list(csv.DictReader(io.TextIOWrapper(resp, encoding="utf-8")))
by_school = {r["school"].lower(): r for r in rows}
for name in ["alabama", "buffalo", "army"]:
r = by_school[name]
print(r["school"], r["football_team_id"], r["mens_basketball_team_id"], r["baseball_team_id"] or "none")An empty baseball id, like Buffalo's, means no match was found. Leave it empty in your table rather than filling it with a guess.
When not to use this
- You have only one brand. Stats and odds from the same brand share ids. Cast both sides to text and join. A crosswalk is extra work you do not need.
- You need players across sports. A person who appears in two sports has two unrelated ids. We do not publish a cross-sport player key, and a name match across sports is unsafe. Build your own key and review each case by hand.
- You expect the college crosswalk to cover players. It maps teams and schools only.
- You want a fully automatic match. Name and team matching fails on twins, mid-season trades and name changes. Plan for a review queue.
Checked against the live API on 2026-12-06. Questions: hello@sportsdatahq.com.