Major League Baseball Statistics
select a query from the list at right or ...
Get more information on parameters listed below using the meta query. This is a way to find possible values for parameters required or possible for some of the functions in the list at right.
choose
awards
baseballStats
eventTypes
gameStatus
gameTypes
hitTrajectories
jobTypes
languages
leageLeaderTypes
logicalEvents
metrics
pitchCodes
pitchTypes
platforms/option>
positions
reviewReasons
rosterTypes
scheduleEventTypes
situationCodes
sky
standingTypes
statGroups
windDirection
Get general information about statsapi endpoints for use in
fashioning your own custom query using get
choose
attendance
awards
conferences
divisions
draft
game
game_diff
game_timestamps
game_changes
game_contextMetrics
game_winProbability
game_boxscore
game_color
game_color_diff
game_color_timestamps
game_linescore
game_playByPlay
gamePace
highLow
homeRunDerby
league
league_allStarBallot
leage_allStarWriteIns
team_leaders
people
people_changes
people_freeAgents
person
person_stats
jobs
jobs_umpires
jobs_umpire_games
jobs_datacasters
jobs_officialScorers
schedule
schedule_tied
schedule_postseason
schedule_postseason_series
schedule_postseason_tuneIn
seasons
season
sports
sports_players
standings
stats
stats_leaders
stats_streaks
teams
teams_history
teams_stats
teams_affiliates
team
team_alumni
team_coaches
team_personnel
team_leaders
team_roster
team_stats
transactions
venue
Submit your own query to a statsapi endpoint. (see list)
Quick Start
To get started, choose a team id from the chart then click "last_game" from the list of links at right and enter the team id in the box then click submit. This will return a game number (gamePk I belive is the parameter name). Click game_highlights at right and enter the game number. Click the links to watch highlight video. This should give you the basic idea of how this API works. Some queries may list several parameters but that doesn't mean they are all required. To research some possible parameter values, use the meta search that appears on the page (refresh if it's not there). MLB does not make the details of this API publicly available, so you have to figure out what you can. Have fun!
MLB Team Information
Complete Listing of MLB Team Information for MLB Gameday API
Team ID
Code
File Code
Abbreviation
Name
Full Name
Brief Name
108
ana
ana
LAA
LA Angels
Los Angeles Angels
Angels
109
ari
ari
ARI
Arizona
Arizona Diamondbacks
D-backs
110
bal
bal
BAL
Baltimore
Baltimore Orioles
Orioles
111
bos
bos
BOS
Boston
Boston Red Sox
Red Sox
112
chn
chc
CHC
Chi Cubs
Chicago Cubs
Cubs
113
cin
cin
CIN
Cincinnati
Cincinnati Reds
Reds
114
cle
cle
CLE
Cleveland
Cleveland Indians
Indians
115
col
col
COL
Colorado
Colorado Rockies
Rockies
116
det
det
DET
Detroit
Detroit Tigers
Tigers
117
hou
hou
HOU
Houston
Houston Astros
Astros
118
kca
kc
KC
Kansas City
Kansas City Royals
Royals
119
lan
la
LAD
LA Dodgers
Los Angeles Dodgers
Dodgers
120
was
was
WSH
Washington
Washington Nationals
Nationals
121
nyn
nym
NYM
NY Mets
New York Mets
Mets
133
oak
oak
OAK
Oakland
Oakland Athletics
Athletics
134
pit
pit
PIT
Pittsburgh
Pittsburgh Pirates
Pirates
135
sdn
sd
SD
San Diego
San Diego Padres
Padres
136
sea
sea
SEA
Seattle
Seattle Mariners
Mariners
137
sfn
sf
SF
San Francisco
San Francisco Giants
Giants
138
sln
stl
STL
St. Louis
St. Louis Cardinals
Cardinals
139
tba
tb
TB
Tampa Bay
Tampa Bay Rays
Rays
140
tex
tex
TEX
Texas
Texas Rangers
Rangers
141
tor
tor
TOR
Toronto
Toronto Blue Jays
Blue Jays
142
min
min
MIN
Minnesota
Minnesota Twins
Twins
143
phi
phi
PHI
Philadelphia
Philadelphia Phillies
Phillies
144
atl
atl
ATL
Atlanta
Atlanta Braves
Braves
145
cha
cws
CWS
Chi White Sox
Chicago White Sox
White Sox
146
mia
mia
MIA
Miami
Miami Marlins
Marlins
147
nya
nyy
NYY
NY Yankees
New York Yankees
Yankees
158
mil
mil
MIL
Milwaukee
Milwaukee Brewers
Brewers
159
aas
al
AL
AL All-Stars
American League All-Stars
AL All-Stars
160
nas
nl
NL
NL All-Stars
National League All-Stars
NL All-Stars
statsapi.boxscore(gamePk, battingBox=True, battingInfo=True, fieldingInfo=True, pitchingBox=True, gameInfo=True, timecode=None)
statsapi.boxscore_data(gamePk, timecode=None)
statsapi.game_highlight_data(gamePk)
statsapi.game_highlights(gamePk)
statsapi.game_pace(season=datetime.now().year, sportId=1)
statsapi.game_pace_data(season=datetime.now().year, sportId=1)
statsapi.game_scoring_play_data(gamePk)
statsapi.game_scoring_plays(gamePk)
statsapi.last_game(teamId)
statsapi.latest_season(sportId=1)
statsapi.league_leader_data(leaderCategories, season=None, limit=10, statGroup=None, leagueId=None, gameTypes=None, playerPool=None, sportId=1, statType=None)
statsapi.league_leaders(leaderCategories, season=None, limit=10, statGroup=None, leagueId=None, gameTypes=None, playerPool=None, sportId=1, statType=None)
statsapi.linescore(gamePk, timecode=None)
statsapi.lookup_player(lookup_value, gameType="R", season=None, sportId=1)
statsapi.lookup_team(lookup_value, activeStatus="Y", season=None, sportIds=1)
statsapi.next_game(teamId)
statsapi.player_stat_data(personId, group="[hitting,pitching,fielding]", type="season", sportId=1)
statsapi.player_stats(personId, group="[hitting,pitching,fielding]", type="season")
statsapi.roster(teamId, rosterType=None, season=datetime.now().year, date=None)
statsapi.schedule(date=None, start_date=None, end_date=None, team="", opponent="", sportId=1, game_id=None)
statsapi.standings(leagueId="103,104", division="all", include_wildcard=True, season=None, standingsTypes=None, date=None)
statsapi.standings_data(leagueId="103,104", division="all", include_wildcard=True, season=None, standingsTypes=None, date=None)
statsapi.team_leader_data(teamId, leaderCategories, season=datetime.now().year, leaderGameTypes="R", limit=10)
statsapi.team_leaders(teamId, leaderCategories, season=datetime.now().year, leaderGameTypes="R", limit=10)