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 URL | https://statsapi.mlb.com/api/v1 |
| Auth | None (public, free) |
| Priority | 40 |
| Rate limit | None observed |
Supported leagues
| League | Code | Sport ID |
|---|
| Triple-A | aaa | 11 |
| Double-A | aa | 12 |
| High-A | higha | 13 |
| Single-A | a | 14 |
| Rookie | rookie | 16 |
The provider_league_id in schema.sql is the MLB Stats sport_id value.
Key endpoints
| Endpoint | Description |
|---|
/sports | List 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,venue | Games on a specific date |
/schedule?sportId={id}&startDate=...&endDate=...&hydrate=teams,venue | Games in a date range |
The hydrate=teams,venue parameter enriches responses with full team and venue objects.
HTTP client configuration
| Setting | Default | Env variable |
|---|
| Max connections | 20 | MLBSTATS_MAX_CONNECTIONS |
| Timeout | 15s | MLBSTATS_TIMEOUT |
| Retry count | 3 | MLBSTATS_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
| File | Purpose |
|---|
teamarr/providers/mlbstats/provider.py | MLBStatsProvider class |
teamarr/providers/mlbstats/client.py | HTTP client |