Introduction
The MLB Stats API is a comprehensive REST API that provides access to real-time and historical baseball data including:- Game schedules and live scores
- Player statistics and biographical information
- Team rosters and standings
- Play-by-play data and win probability
- Transactions, draft results, and historical records
Base URL
All API requests are made to the MLB Stats API base URL:/api/v1/schedulebecomeshttps://statsapi.mlb.com/api/v1/schedule/api/v1.1/game/{gamePk}/feed/livebecomeshttps://statsapi.mlb.com/api/v1.1/game/813024/feed/live
Authentication
The MLB Stats API is publicly accessible and does not require authentication or API keys. All endpoints can be accessed without credentials.While no authentication is required, be mindful of rate limits and avoid excessive requests that could impact API availability.
API Versioning
The API uses URL-based versioning:- v1 - Most endpoints use
/api/v1/ - v1.1 - Live game feeds use
/api/v1.1/for enhanced real-time data
Query Parameters
Most endpoints support filtering and customization through query parameters:Common Parameters
Sport identifier.
1 = MLB, 11 = AAA, 51 = InternationalYear for seasonal data (e.g.,
"2025")Comma-separated field paths to include in response. Reduces payload size by returning only requested fields.Example:
"dates,games,gamePk,teams,team,name"Additional data to include in response. Common values:
"team", "person", "linescore"Date Parameters
Specific date in ISO format:
"2026-03-26"Start of date range in ISO format
End of date range in ISO format
Response Format
All API responses are in JSON format. The structure varies by endpoint but typically includes:Common Entity IDs
Many endpoints require specific entity IDs:Sport IDs
1- Major League Baseball (MLB)11- Triple-A (AAA)51- International Baseball
League IDs
103- American League (AL)104- National League (NL)
Team IDs (Examples)
119- Los Angeles Dodgers147- New York Yankees
Game Types
R- Regular SeasonS- Spring TrainingP- PlayoffsW- World Series
Next Steps
Try the Playground
Explore API endpoints interactively and see live responses
Browse Endpoints
View all available MLB Stats API endpoints
Use Fetch Library
Learn how to fetch data in your TypeScript code
Preset Functions
Use pre-configured functions for common queries