MLB play_by_plays API
play_by_plays
mlb.play_by_playsEvery individual play of every MLB game — every plate appearance, baserunning event, defensive play, and substitution with the inning, outs, base state, and score at the moment.
GET/api/v1/mlb/play_by_playsList play_by_plays for MLB
Requires one of:
game_id — requests satisfying none of these return 400.Parameters
game_idquerybigintoptionalFilter to a single game.
limitqueryintegeroptionaldefault 50Page size. Defaults to 50; max 5000.
from_idquerybigintoptionalReturn rows with id strictly greater than this value; page using the previous response's `next_from_id`. Omit on the first page.
Restores the documented defaults (trial keys only accept the unchanged defaults).
Request
curl -sS --compressed \
-H 'Authorization: Bearer YOUR_API_KEY' \
'https://api.stat-api.com/api/v1/mlb/play_by_plays?game_id=1'Responses
200play_by_plays rows matching the declared filter set, wrapped in { play_by_plays, limit, next_from_id }. next_from_id is the last row's id on a full page — pass it back via ?from_id= to walk the full result; null marks the terminal page.application/jsonshow example ▸
400No declared filter set was satisfied — response body matches MissingRequiredFiltersError; pick one combo from the accepted-sets hint and resend.
application/jsonResponse Schema(26 fields)show schema ▸
| Field | Type | References | Description |
|---|---|---|---|
idkey | bigint | — | Primary Key |
at_bat_id | bigintnullable | — e.g. 1 | |
batter_id | bigintnullable | — e.g. 996 | |
catcher_id | bigintnullable | — e.g. — (all-null in sample) | |
first_base_runner_id | bigintnullable | — e.g. 996 | |
game_id | bigint | — e.g. 69 | |
inning_id | bigint | — e.g. 908 | |
pitcher_id | bigintnullable | — e.g. 174 | |
play_id | bigint | — | — e.g. 0 |
player_id | bigintnullable | — e.g. 996 | |
second_base_runner_id | bigintnullable | — e.g. 996 | |
team_id | bigint | — e.g. 19 | |
third_base_runner_id | bigintnullable | — e.g. 996 | |
away_score | integernullable | — | — e.g. — (all-null in sample) |
count_balls | integer | — | — e.g. 0 |
count_strikes | integer | — | — e.g. 2 |
end_time | timestamptznullable | — | Wall-clock end of the play, as the league records it e.g. — (all-null in sample) |
event_sub_type | integer | — | — e.g. 0 |
event_type | integer | — | — e.g. 8 |
hit_location | stringnullable | — | — Values:ground_ballfly_ballline_drivepopupbunt_grounderbunt_popup |
hit_type | stringnullable | — | — Values:ground_ballfly_ballline_drivepopupbunt_grounderbunt_popup |
home_score | integernullable | — | — e.g. — (all-null in sample) |
mlb_event_num | integer | — | — e.g. 0 |
outs | integer | — | — e.g. 1 |
runners_on_base | integer | — | — e.g. 0 |
start_time | timestamptznullable | — | Wall-clock start of the play, as the league records it e.g. — (all-null in sample) |
GET/api/v1/mlb/play_by_plays/{id}Get a single play_by_play by id
Parameters
idpathbigintrequiredPrimary key (id) of the play_by_play row.
Restores the documented defaults (trial keys only accept the unchanged defaults).
Request
curl -sS --compressed \
-H 'Authorization: Bearer YOUR_API_KEY' \
'https://api.stat-api.com/api/v1/mlb/play_by_plays/{pk_value}'Responses
200Single play_by_play row.application/jsonshow example ▸
404Row not found.
Response Schema(26 fields)show schema ▸
| Field | Type | References | Description |
|---|---|---|---|
idkey | bigint | — | Primary Key |
at_bat_id | bigintnullable | — e.g. 1 | |
batter_id | bigintnullable | — e.g. 996 | |
catcher_id | bigintnullable | — e.g. — (all-null in sample) | |
first_base_runner_id | bigintnullable | — e.g. 996 | |
game_id | bigint | — e.g. 69 | |
inning_id | bigint | — e.g. 908 | |
pitcher_id | bigintnullable | — e.g. 174 | |
play_id | bigint | — | — e.g. 0 |
player_id | bigintnullable | — e.g. 996 | |
second_base_runner_id | bigintnullable | — e.g. 996 | |
team_id | bigint | — e.g. 19 | |
third_base_runner_id | bigintnullable | — e.g. 996 | |
away_score | integernullable | — | — e.g. — (all-null in sample) |
count_balls | integer | — | — e.g. 0 |
count_strikes | integer | — | — e.g. 2 |
end_time | timestamptznullable | — | Wall-clock end of the play, as the league records it e.g. — (all-null in sample) |
event_sub_type | integer | — | — e.g. 0 |
event_type | integer | — | — e.g. 8 |
hit_location | stringnullable | — | — Values:ground_ballfly_ballline_drivepopupbunt_grounderbunt_popup |
hit_type | stringnullable | — | — Values:ground_ballfly_ballline_drivepopupbunt_grounderbunt_popup |
home_score | integernullable | — | — e.g. — (all-null in sample) |
mlb_event_num | integer | — | — e.g. 0 |
outs | integer | — | — e.g. 1 |
runners_on_base | integer | — | — e.g. 0 |
start_time | timestamptznullable | — | Wall-clock start of the play, as the league records it e.g. — (all-null in sample) |