Skip to main content
The MLB Stats provider serves Minor League Baseball (MiLB) data via MLB’s public Stats API. It is registered at priority 40. Added in v2.3.1.
MLB itself (Major League Baseball) is served by the ESPN provider, not this one. The MLB Stats provider covers MiLB leagues only.

API details

Base URLhttps://statsapi.mlb.com/api/v1
AuthNone (public, free)
Priority40
Rate limitNone observed

Supported leagues

LeagueCodeSport ID
Triple-Aaaa11
Double-Aaa12
High-Ahigha13
Single-Aa14
Rookierookie16
The provider_league_id in schema.sql is the MLB Stats sport_id value.

Key endpoints

EndpointDescription
/sportsList all sports/leagues
/teams?sportId={id}All teams in a sport
/teams/{team_id}Team details
/schedule?sportId={id}&date={YYYY-MM-DD}&hydrate=teams,venueGames on a specific date
/schedule?sportId={id}&startDate=...&endDate=...&hydrate=teams,venueGames in a date range
The hydrate=teams,venue parameter enriches responses with full team and venue objects.

HTTP client configuration

SettingDefaultEnv variable
Max connections20MLBSTATS_MAX_CONNECTIONS
Timeout15sMLBSTATS_TIMEOUT
Retry count3MLBSTATS_RETRY_COUNT
Uses the same exponential backoff pattern as the ESPN provider (0.5s base, capped at 10s with ±30% jitter).

Team data

The provider parses team short names from the teamName field (e.g., "Pirates" from "Pittsburgh Pirates"). Team logos use the MLB Static CDN:
https://www.mlbstatic.com/team-logos/{team_id}.svg

Limitations

  • get_event() returns None — the API lacks a simple single-event endpoint.
  • MLB (major league) is served by the ESPN provider, not this one.

File locations

FilePurpose
teamarr/providers/mlbstats/provider.pyMLBStatsProvider class
teamarr/providers/mlbstats/client.pyHTTP client

Build docs developers (and LLMs) love