DEV Community

Alabama has 71 NFL players, Duke 27 in the NBA. Mapping 5,111 pro rosters with ESPN's hidden JSON API

ESPN's website is built on a public JSON API. It has no docs and needs no key, and it covers scores, betting lines, standings, injury reports, rosters and news for the NFL, NBA, MLB, NHL, college sports and world soccer.

I used it to pull every roster in the four major US leagues (5,111 players) and answer some bar-argument questions. First, the endpoints.

The endpoints

Everything hangs off site.api.espn.com/apis/site/v2/sports/{sport}/{league}/:

  • /football/nfl/scoreboard?dates=20261130 games, scores, and the DraftKings line
  • /football/nfl/injuries league-wide injury report
  • /football/nfl/teams team list with ids
  • /football/nfl/teams/12/roster one roster
  • /football/nfl/news?limit=25 headlines

Standings live on a slightly different path: site.api.espn.com/apis/v2/sports/football/nfl/standings.

Swap football/nfl for basketball/nba, baseball/mlb, hockey/nhl, football/college-football, soccer/eng.1 (Premier League) and so on.

Three gotchas:

  • Send a normal browser User-Agent. A custom bot string gets a flat 403.
  • Date ranges are flaky. ?dates=20261101-20261107 returns a 400 on some leagues. Loop one day at a time.
  • Rosters come in two shapes. NFL and NHL group players by unit (athletes: [{position: "offense", items: [...]}]); NBA and MLB return a flat list. Handle both:
const teams = (await (await fetch('https://site.api.espn.com/apis/site/v2/sports/football/nfl/teams', { headers: { 'User-Agent': 'Mozilla/5.0' }, })).json()).sports[0].leagues[0].teams.map((t) => t.team);
for (const t of teams) {
  const r = await (await fetch(`https://site.api.espn.com/apis/site/v2/sports/football/nfl/teams/${t.id}/roster`, { headers: { 'User-Agent': 'Mozilla/5.0' }, })).json();
  const players = r.athletes.flatMap((x) => (Array.isArray(x.items) ? x.items : [x]));
  for (const p of players) console.log(t.abbreviation, p.displayName, p.position?.abbreviation, p.college?.name ?? '');
}

The scoreboard is the other useful one for bettors: before kickoff each game carries competitions[0].odds[0] with the spread (details), total (overUnder) and both moneylines.

Which colleges produce the most pros

NFL (2,563 rostered players)

College Players
Alabama 71
Ohio State 67
Georgia 66
Notre Dame 59
LSU 58
Michigan 55

NBA (530 players)

College Players
Duke 27
Kentucky 25
Arizona 16
Michigan 14
Gonzaga, North Carolina, Arkansas 12 each

63 NBA players list no college at all (international and G League routes); in the NFL it's 24.

How international each league is

Share of rostered players born outside the USA:

League Born outside USA Biggest sources
NFL 3% Canada 26, Australia 12, Nigeria 9
NBA 22% France 16, Canada 15, Australia 8
MLB 28% Dominican Republic 127, Venezuela 79
NHL 71% Canada 353 (41% of the league), Sweden 83

The NBA's players come from 44 countries, the most of the four leagues.

Who's hurt right now

Each roster entry has an injuries array, so the rosters double as an availability check. On the snapshot date, 21% of NFL and 20% of NBA rostered players had an injury listed, against about 12% in MLB and the NHL.

The league-wide /injuries endpoint adds status (Out, Questionable, IR), body part and ESPN's expected return date.

Median age: NBA 25, NFL 26, MLB 27, NHL 28.

Data and a ready-made scraper

All 5,111 players (team, position, age, height, weight, birthplace, college, experience, status, injured flag) are free on Kaggle: NFL, NBA, MLB and NHL Rosters 2026.

If you'd rather not juggle six endpoints and two roster shapes, I put the whole thing on Apify as ESPN Sports Data. One input picks scores (with the betting line), standings, injuries, rosters, news or teams for any of 25+ leagues.

What would you build on top of it?

Read on DEV Community ↗ ← Back to News

Comments

No comments yet. Start the discussion.