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:

BrandExampleIdType
HockeyTage Thompson8479420integer
BasketballLuka Doncic"3945274"string
FootballJosh Allen"00-0034857"dashed string
SoccerBukayo 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:

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:

  1. Normalize names. Remove accents, punctuation and suffixes such as Jr., and lowercase. José Álvarez and Jose Alvarez Jr. become the same string.
  2. Match on normalized name plus team. Team is a strong tiebreaker inside one season.
  3. 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.
  4. Refuse to guess. Zero or several candidates go to the review queue.
  5. 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:

When not to use this

Get a free key

Checked against the live API on 2026-12-06. Questions: hello@sportsdatahq.com.