MLB API endpoint
Returns the at-bats of an MLB game by numeric `id`. Each play has its inning and half, batter, pitcher, event and description, and a list of individual pitch and event records with timing and pitch data. The response includes a `total` count of plays.
/mlb/game-play-by-playQuery parameters: id (required numeric MLB game id).
| Field | Filled in, of 63 checked | Values in the sample |
|---|---|---|
| at_bat_index | 63 | |
| event | 63 | “Groundout” and 10 other values |
| event_type | 63 | field_out (28), strikeout (18), single (6) and 5 more |
| description | 63 | “Paul Goldschmidt grounds out, third baseman Pedro Ramírez t…” and 56 other values |
| inning | 63 | 1 to 9, median 5 |
| half_inning | 63 | top (32), bottom (31) |
| is_complete | 63 | true in 63 of 63 |
| batter | 63 | |
| pitcher | 63 | |
| events | 63 | median 5 entries |
| Parameter | Type | Required | Default | Description | Example |
|---|---|---|---|---|---|
| id | string | Yes | Numeric MLB game id | 824651 | |
| x-api-key (header) | string | Yes | API key required |
curl -X GET "https://api.crawlora.net/api/v1/mlb/game-play-by-play?id=824651" \ -H "x-api-key: $CRAWLORA_API_KEY"
{
"code": 200,
"data": {
"game_id": 824651,
"total": 63,
"plays": [
{
"at_bat_index": 0,
"event": "Strikeout",
"inning": 1
}
]
}
}Request schema
No body schema
Response schema
#/definitions/mlb.playByPlayResponseDoc
| Field | Type | Required | Enum | Bounds | Example | Description |
|---|---|---|---|---|---|---|
| code | integer | No | ||||
| data | mlb.PlayByPlayResponse | No | ||||
| data.fetched_at | string | No | ||||
| data.game_id | integer | No | ||||
| data.plays | array | No | ||||
| data.plays[].at_bat_index | integer | No | ||||
| data.plays[].batter | mlb.NamedRef | No | ||||
| data.plays[].batter.id | integer | No | MLB id of the player or league. | |||
| data.plays[].batter.name | string | No | Name of the player or league. | |||
| data.plays[].description | string | No | ||||
| data.plays[].event | string | No | ||||
| data.plays[].event_type | string | No | ||||
| data.plays[].events | array | No | ||||
| data.plays[].events[].description | string | No | ||||
| data.plays[].events[].details | object | No | ||||
| data.plays[].events[].end_time | string | No | ||||
| data.plays[].events[].index | integer | No | ||||
| data.plays[].events[].is_pitch | boolean | No | ||||
| data.plays[].events[].pitch_data | object | No | ||||
| data.plays[].events[].pitch_number | integer | No | ||||
| data.plays[].events[].start_time | string | No | ||||
| data.plays[].events[].type | string | No | ||||
| data.plays[].half_inning | string | No | ||||
| data.plays[].inning | integer | No | ||||
| data.plays[].is_complete | boolean | No | ||||
| data.plays[].pitcher | mlb.NamedRef | No | ||||
| data.plays[].pitcher.id | integer | No | MLB id of the player or league. | |||
| data.plays[].pitcher.name | string | No | Name of the player or league. | |||
| data.source_url | string | No | ||||
| data.total | integer | No | ||||
| msg | string | No |
| Status | Description | Schema |
|---|---|---|
| 400 | Bad Request | #/definitions/app.Response |
| 404 | Not Found | #/definitions/app.Response |
| 503 | Service Unavailable | #/definitions/app.Response |
Use environment variables for secrets and keep Crawlora API keys server-side.
curl -X GET "https://api.crawlora.net/api/v1/mlb/game-play-by-play?id=824651" \
-H "x-api-key: $CRAWLORA_API_KEY"