STAT-API

MLB at_bats API

at_batsmlb.at_bats
Every plate appearance in every MLB game — the batter, the pitcher, the count, the pitch sequence, and the outcome (single, double, home run, strikeout, walk, hit-by-pitch, etc.).
GET/api/v1/mlb/at_bats
Requires one of: game_id — requests satisfying none of these return 400.
Parameters
game_idquerybigintoptional
Filter to a single game.
limitqueryintegeroptionaldefault 50
Page size. Defaults to 50; max 5000.
from_idquerybigintoptional
Return 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/at_bats?game_id=1'
Responses
200at_bats rows matching the declared filter set, wrapped in { at_bats, 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/json
Response Schema(39 fields)show schema ▸
FieldTypeReferencesDescription
idkey
bigint—Primary Key
batter_id
bigint—
e.g. 996
game_id
bigint—
e.g. 69
inning_id
bigint—
e.g. 908
pitcher_id
bigint—
e.g. 174
at_bat_number
integer——
e.g. 0
balls
integer——
e.g. 0
bat_side
stringnullable—Batter side for this matchup (L/R) — per-PA truth, resolves switch hitters
e.g. — (all-null in sample)
end_outs
integer——
e.g. 2
end_runners
integer——
e.g. 0
end_time
timestamptznullable—Wall-clock end of the plate appearance, as the league records it
e.g. — (all-null in sample)
expected_batting_avg
decimalnullable——
e.g. 0.0050
expected_woba
decimalnullable——
e.g. 0.0000
hit_coord_x
floatnullable——
e.g. 104.05
hit_coord_y
floatnullable——
e.g. 149.88
hit_distance
integernullable——
e.g. 4
hit_exit_velocity
floatnullable——
e.g. 98.4
hit_launch_angle
floatnullable——
e.g. 5
hit_location
stringnullable——
Values:ground_ballfly_ballline_drivepopupbunt_grounderbunt_popup
hit_type
stringnullable——
Values:ground_ballfly_ballline_drivepopupbunt_grounderbunt_popup
is_barrel
booleannullable——
Values:falsetrue
is_flare_burner
booleannullable—Launch angle 10-25 AND exit velocity < 95
Values:falsetrue
is_hard_hit
booleannullable——
Values:falsetrue
is_solid_contact
booleannullable—Launch angle 20-25 AND exit velocity 95-100
Values:falsetrue
is_sweet_spot
booleannullable—Launch angle between 8-32 degrees
Values:falsetrue
is_topped
booleannullable—Launch angle < 10 AND exit velocity < 90
Values:falsetrue
is_under
booleannullable—Launch angle less than 10 degrees
Values:falsetrue
launch_speed_angle_zone
integernullable——
e.g. 3
pitch_count
integer——
e.g. 4
pitch_hand
stringnullable—Pitcher hand for this matchup (L/R)
e.g. — (all-null in sample)
result
string——
e.g. Strikeout
runs_scored
integer——
e.g. 0
spray_angle
floatnullable—Horizontal angle from center field (degrees)
e.g. -6
start_outs
integer——
e.g. 1
start_runners
integer——
e.g. 0
start_time
timestamptznullable—Wall-clock start of the plate appearance, as the league records it
e.g. — (all-null in sample)
statcast_quality_score
decimalnullable—Statcast data quality score (0.0-1.0)
e.g. 1.0000
strikes
integer——
e.g. 2
tracking_confidence
decimalnullable—Confidence in tracking data accuracy
e.g. — (all-null in sample)
GET/api/v1/mlb/at_bats/{id}
Parameters
idpathbigintrequired
Primary key (id) of the at_bat 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/at_bats/{pk_value}'
Responses
200Single at_bat row.application/jsonshow example ▸
404Row not found.
Response Schema(39 fields)show schema ▸
FieldTypeReferencesDescription
idkey
bigint—Primary Key
batter_id
bigint—
e.g. 996
game_id
bigint—
e.g. 69
inning_id
bigint—
e.g. 908
pitcher_id
bigint—
e.g. 174
at_bat_number
integer——
e.g. 0
balls
integer——
e.g. 0
bat_side
stringnullable—Batter side for this matchup (L/R) — per-PA truth, resolves switch hitters
e.g. — (all-null in sample)
end_outs
integer——
e.g. 2
end_runners
integer——
e.g. 0
end_time
timestamptznullable—Wall-clock end of the plate appearance, as the league records it
e.g. — (all-null in sample)
expected_batting_avg
decimalnullable——
e.g. 0.0050
expected_woba
decimalnullable——
e.g. 0.0000
hit_coord_x
floatnullable——
e.g. 104.05
hit_coord_y
floatnullable——
e.g. 149.88
hit_distance
integernullable——
e.g. 4
hit_exit_velocity
floatnullable——
e.g. 98.4
hit_launch_angle
floatnullable——
e.g. 5
hit_location
stringnullable——
Values:ground_ballfly_ballline_drivepopupbunt_grounderbunt_popup
hit_type
stringnullable——
Values:ground_ballfly_ballline_drivepopupbunt_grounderbunt_popup
is_barrel
booleannullable——
Values:falsetrue
is_flare_burner
booleannullable—Launch angle 10-25 AND exit velocity < 95
Values:falsetrue
is_hard_hit
booleannullable——
Values:falsetrue
is_solid_contact
booleannullable—Launch angle 20-25 AND exit velocity 95-100
Values:falsetrue
is_sweet_spot
booleannullable—Launch angle between 8-32 degrees
Values:falsetrue
is_topped
booleannullable—Launch angle < 10 AND exit velocity < 90
Values:falsetrue
is_under
booleannullable—Launch angle less than 10 degrees
Values:falsetrue
launch_speed_angle_zone
integernullable——
e.g. 3
pitch_count
integer——
e.g. 4
pitch_hand
stringnullable—Pitcher hand for this matchup (L/R)
e.g. — (all-null in sample)
result
string——
e.g. Strikeout
runs_scored
integer——
e.g. 0
spray_angle
floatnullable—Horizontal angle from center field (degrees)
e.g. -6
start_outs
integer——
e.g. 1
start_runners
integer——
e.g. 0
start_time
timestamptznullable—Wall-clock start of the plate appearance, as the league records it
e.g. — (all-null in sample)
statcast_quality_score
decimalnullable—Statcast data quality score (0.0-1.0)
e.g. 1.0000
strikes
integer——
e.g. 2
tracking_confidence
decimalnullable—Confidence in tracking data accuracy
e.g. — (all-null in sample)