Skip to main content
ESPN is the primary data provider (priority 0), serving 52 pre-configured leagues plus 240+ dynamically discovered soccer leagues. The API is free, public, and requires no authentication.

API details

Base URLhttps://site.api.espn.com/apis/site/v2/sports
AuthNone required
Priority0 (tried first)
Rate limitGenerous — DNS throttling is the usual bottleneck

Key endpoints

EndpointDescription
/{sport}/{league}/scoreboard?dates={YYYYMMDD}Games on a specific date
/{sport}/{league}/teams/{team_id}/scheduleTeam schedule
/{sport}/{league}/teams/{team_id}Team details
/{sport}/{league}/summary?event={event_id}Event details and scores
/{sport}/{league}/teamsAll teams in a league (cache refresh)

League ID format

ESPN leagues use a sport/league path format in the provider_league_id column in schema.sql:
football/nfl
basketball/nba
hockey/nhl
soccer/eng.1
baseball/mlb
Soccer leagues use ESPN’s dot notation: {country}.{tier} (e.g., eng.1 for the Premier League, ger.2 for 2. Bundesliga).

Sports coverage

SportLeaguesNotes
FootballNFL, NCAAF, UFL
BasketballNBA, WNBA, G League, NCAAM, NCAAW
HockeyNHL, NCAA M/W, Olympics M/W
BaseballMLBMiLB handled by the MLB Stats provider
Soccer40+ pre-configured, 240+ discoveredDot notation: eng.1, ger.2
Combat SportsUFCEvent Card matching
LacrosseNLL, PLL, NCAA M/W
VolleyballNCAA M/W

Soccer league discovery

ESPN’s API exposes 240+ soccer leagues dynamically. During cache refresh, Teamarr queries ESPN to discover available leagues and makes them selectable in the league picker under the Soccer sport.
Discovered leagues support event matching in event groups but do not have pre-configured team import. Only the 40+ pre-configured soccer leagues support team import.

HTTP client configuration

SettingDefaultEnv variable
Max connections100ESPN_MAX_CONNECTIONS
Timeout10sESPN_TIMEOUT
Retry count3ESPN_RETRY_COUNT
Max workers100ESPN_MAX_WORKERS
Retry logic uses exponential backoff: 0.5s → 1s → 2s → 4s (capped at 10s) with ±30% jitter. Rate limit (429) responses trigger longer backoff: 5s → 10s → 20s (capped at 60s), respecting the Retry-After header if present.

Special behaviors

  • Status mapping — ESPN event statuses are normalized to Teamarr’s internal scheduled, in_progress, final, postponed, cancelled.
  • Team ID corrections — Hardcoded mapping for known ESPN data mismatches (e.g., some women’s hockey teams).
  • Tournament sports — Golf, tennis, and racing events have no home/away teams; parsed via TournamentParserMixin.
  • UFC — Parsed via UFCParserMixin with fighter name extraction from the core API.

File locations

FilePurpose
teamarr/providers/espn/provider.pyESPNProvider class
teamarr/providers/espn/client.pyHTTP client with retry logic
teamarr/providers/espn/constants.pyStatus mapping
teamarr/providers/espn/tournament.pyTournamentParserMixin (golf, tennis, racing)
teamarr/providers/espn/ufc.pyUFCParserMixin

Build docs developers (and LLMs) love