Guide
How to build a unified player id crosswalk
Short answer: a crosswalk is a table that maps every external id for a person to one key you own. Store ids as text, record where each mapping came from, match on normalized name, team and position, send ambiguous rows to a review queue, and join everything through the table.
Why you end up building one
Sports data arrives with the identifiers of whoever produced it. Your own spreadsheet has an id. A model output has another. Each API brand has its own, and the type changes by sport. We checked four brands on December 6, 2026:
| Brand | Example | Id | Type |
|---|---|---|---|
| Hockey | Tage Thompson | 8479420 | integer |
| Basketball | Luka Doncic | "3945274" | string |
| Football | Josh Allen | "00-0034857" | dashed string |
| Soccer | Bukayo Saka | "280555" | string |
No id is shared across sports, and no public key maps a person across them. Inside one brand, an id returned by search_players is the same id that every other endpoint accepts. That is why a stats-to-odds join inside a brand works without any mapping, and why mismatches only appear at the edges: your own tables, a second sport, or a second provider. The error version of this problem is covered in player id mismatch when joining box scores and odds.
A crosswalk also protects you from the day a provider re-keys its data. If every join goes through your own key, you fix one table instead of every query.
The schema
One table does most of the work. Each row says: this external id, from this system, is that person.
import sqlite3
db = sqlite3.connect(":memory:")
db.executescript("""
CREATE TABLE player_xwalk (
person_key TEXT NOT NULL, -- your own stable key, e.g. 'p_000001'
brand TEXT NOT NULL, -- 'puckapi', 'dunkapi', ...
brand_id TEXT NOT NULL, -- stored as text, because ids come as ints and strings
full_name TEXT NOT NULL,
valid_from TEXT NOT NULL,
PRIMARY KEY (brand, brand_id)
);
CREATE INDEX xwalk_key ON player_xwalk (person_key);
CREATE TABLE my_stats (stat_id TEXT, person_key TEXT, points INTEGER);
""")
db.executemany("INSERT INTO player_xwalk VALUES (?,?,?,?,?)", [
("p_000001", "puckapi", "8479420", "Tage Thompson", "2026-12-06"),
("p_000002", "dunkapi", "3945274", "Luka Doncic", "2026-12-06"),
("p_000002", "mysheet", "LD-77", "Luka Doncic", "2026-12-06"), # your own internal id
])
db.execute("INSERT INTO my_stats VALUES ('g1', 'p_000002', 33)")
# Join an API row (brand + id) to your own stats through the crosswalk.
api_row = {"brand": "dunkapi", "player_id": "3945274"}
row = db.execute("""
SELECT s.stat_id, s.points, x.full_name
FROM player_xwalk x JOIN my_stats s ON s.person_key = x.person_key
WHERE x.brand = ? AND x.brand_id = ?""", (api_row["brand"], str(api_row["player_id"]))).fetchone()
print(row)
# Audit: one person with two ids in the same brand is a duplicate you need to merge.
dupes = db.execute("SELECT person_key, brand, COUNT(*) FROM player_xwalk GROUP BY 1, 2 HAVING COUNT(*) > 1").fetchall()
print("duplicates:", dupes)This ran locally and printed ('g1', 33, 'Luka Doncic') and an empty duplicate list. Four design choices matter:
- The primary key is `(brand, brand_id)`. The same external id can never point to two people. Different brands may reuse the same digits, which is why the brand is part of the key.
- Ids are text. An integer in one brand and a dashed string in another cannot share a typed column. Cast on the way in and on the way out, and never on the way through a join.
- `person_key` is opaque. Do not encode a name or a sport in it. When a player turns up in two sports, both ids simply attach to one key.
- `valid_from` records when you learned the mapping. Add
sourceandconfidencecolumns if you mix automatic and manual matches, so you can later re-check the automatic ones.
Filling it: look up, then match
Seed the table from the API rather than from memory. Call search_players with a name, and read the id from the response. The hockey endpoint takes a query parameter, and basketball and soccer take name, so wrap each brand in a small adapter. Then match your own rows to those ids with a rule you can explain.
A rule set that holds up in practice:
- Normalize names. Remove accents, punctuation and suffixes such as Jr., and lowercase.
José ÁlvarezandJose Alvarez Jr.become the same string. - Match on normalized name plus team. Team is a strong tiebreaker inside one season.
- Break remaining ties with position, then birth date. Two players named Sam Carlson on one team are rare, and a position settles most of them.
- Refuse to guess. Zero or several candidates go to the review queue.
- Write every confirmed match into the crosswalk, including the manual ones, so the answer is reused.
A tested sample of steps 1 to 4 is in the error page linked above. In a run on sample data it matched three rows and sent the fourth, a player with no candidate, to review.
Teams and schools are easier
Teams change far less often than players, and public tables exist. For college football, basketball and baseball, the college team crosswalk lists every Division I school with a team id and conference per sport, as a CSV. On December 6, 2026 it held 367 schools, and 16 of 322 baseball teams had no match. Load it straight into your own table:
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")))
team_xwalk = []
for r in rows:
for sport in ["football", "mens_basketball", "womens_basketball", "baseball"]:
tid = r[f"{sport}_team_id"]
if tid: # blank means no match; do not invent one
team_xwalk.append((f"school:{r['school_id']}", sport, tid, r["school"]))
print(len(rows), "schools,", len(team_xwalk), "team ids")Here school_id is the key that groups a school's teams across sports, which is exactly the role person_key plays for players. Football and basketball share ids for most schools, and baseball is matched by school name, so check baseball rows by hand when they matter.
Keep it healthy
A crosswalk decays. Players are traded, retire, come back and change names. Plan these maintenance jobs from the start:
- Weekly unmatched report. List API ids seen in new rows that are not in the table. These are rookies and call-ups, and they are the main source of new work.
- Duplicate audit. The query above finds a person with two ids in one brand. Merge them by pointing both ids at one
person_key. - Orphan audit. Find
person_keyvalues with no id in any brand you still use. - Version the table. Keep a dated export. When a join changes, you can tell whether the data or the mapping moved.
- Never delete a row you have used. Mark it ended with an end date. Old results still refer to it.
When not to use this
- You use one brand and no outside data. Ids agree within a brand, so a crosswalk is overhead. Cast to text and join.
- You need a public, cross-sport player id. We do not publish one, and this guide does not create one for you. The key is yours, and it is only as good as your review of the hard cases.
- You cannot review exceptions. A crosswalk with unreviewed guesses is worse than no crosswalk, because bad joins look like good data. If nobody will read the review queue, match fewer rows and leave the rest unmapped.
- You want to redistribute the table. The terms let you store and use data for your own products. They do not let you republish ids as a dataset of their own. Keep the table internal.
Checked against the live API on 2026-12-06. Questions: hello@sportsdatahq.com.