StoryStats

API example

MLB endpoints

All MLB endpoints live under https://api.balldontlie.io/stories/mlb. Every request requires a Bearer API key in the Authorization header.

List games

Returns all MLB games scheduled on a given date. Use this endpoint first to discover game IDs, then pass those IDs to the story endpoints below.

GET/stories/mlb/games

Query parameters

NameTypeRequiredDescription
datestringYesISO-8601 calendar date in YYYY-MM-DD format (e.g. 2026-04-12).
timezonestringNoIANA timezone name used to resolve the date boundary. Defaults to UTC.

Example request

curl -H "Authorization: Bearer YOUR_API_KEY" \
  "https://api.balldontlie.io/stories/mlb/games?date=2026-04-13&timezone=America/New_York"

Example response

{
  "data": [
    {
      "id": 5058004,
      "home_team": {
        "id": 25,
        "slug": "seattle-mariners",
        "abbreviation": "SEA",
        "display_name": "Seattle Mariners",
        "short_display_name": "Mariners",
        "name": "Mariners",
        "location": "Seattle",
        "league": "American",
        "division": "West"
      },
      "away_team": {
        "id": 11,
        "slug": "houston-astros",
        "abbreviation": "HOU",
        "display_name": "Houston Astros",
        "short_display_name": "Astros",
        "name": "Astros",
        "location": "Houston",
        "league": "American",
        "division": "West"
      },
      "start_time": "2026-04-13T16:10:00.000-04:00"
    }
  ]
}

Response schema

data

Games scheduled on the requested date, ordered by start_time ascending.

FieldTypeDescription
idintegerGame identifier. Pass this value as :game_id to the story endpoints below.
home_teamobjectHome team. See Team below.
away_teamobjectAway team. See Team below.
start_timestring (date-time)Scheduled tipoff in RFC 3339 format. The UTC offset reflects the timezone query parameter (UTC when omitted).

Team

Returned on both home_team and away_team for every MLB game.

FieldTypeDescription
idintegerStable BallDontLie team identifier. Joins to the MLB teams endpoint.
abbreviationstringThree-letter team code (e.g. SEA).
display_namestring| nullFull display name (e.g. Seattle Mariners).
short_display_namestring| nullShort display name (e.g. Mariners).
namestringTeam nickname (e.g. Mariners).
locationstringHome city (e.g. Seattle).
slugstring| nullURL-safe slug (e.g. seattle-mariners).
leaguestringOne of American or National.
divisionstringDivision name (e.g. West).

Get pregame story

Returns a single aggregated pregame story. Generated within 1 hour before the scheduled start time. Returns 404 if the story has not been generated yet (game is more than 1 hour away).

GET/stories/mlb/games/{game_id}/pregame

Query parameters

NameTypeRequiredDescription
audiencestringNoEither betting or stats. Defaults to betting.
tonestringNoEither editorial or humor. Defaults to editorial.

Example request

curl -H "Authorization: Bearer YOUR_API_KEY" \
  "https://api.balldontlie.io/stories/mlb/games/5058004/pregame?audience=betting&tone=editorial"

Example response

{
  "game": { "id": 5058004 },
  "story": {
    "id": 192847,
    "created_at": "2026-04-13T19:10:50.219Z",
    "content": "SEA is -181 behind George Kirby, whose 3.60 ERA and 0.90 WHIP come in just 20 IP, versus Mike Burrows' 5.63 ERA and 1.75 WHIP in 16 IP. HOU has gone 1-8 on the road and 0-3 vs the M's, with the total up to 8 from 7.5.",
    "entity_tags": {
      "teams": [
        { "id": 25, "name": "Seattle Mariners", "abbreviation": "SEA" },
        { "id": 11, "name": "Houston Astros", "abbreviation": "HOU" }
      ],
      "players": [
        { "id": 528, "name": "Jose Altuve" },
        { "id": 596, "name": "Yordan Alvarez" }
      ]
    }
  }
}

Response schema

game

Compact reference to the game this response is scoped to. Echoes the :game_id path parameter.

FieldTypeDescription
idintegerGame identifier matching the one supplied in the request path.

story

The single narrative object for this phase. Deterministic for a given (game_id, audience, tone) tuple.

FieldTypeDescription
idintegerStable story identifier. Safe to use as an idempotency key.
created_atstring (date-time)RFC 3339 timestamp (UTC) marking when the narrative was written.
contentstring| nullTweet-length narrative body (≤280 characters). Null only in the rare case that the requested tone has not yet been rendered for this story.
entity_tagsobjectTeams and players referenced in content. See entity_tags below.

entity_tags

Structured list of the teams and players referenced in the narrative. Use the IDs to join to the corresponding BallDontLie sport APIs.

FieldTypeDescription
teamsarray<object>Teams mentioned in the story. Each element is { id: integer, name: string, abbreviation: string }.
playersarray<object>Players mentioned in the story. Each element is { id: integer, name: string, team?: string }, where team is the abbreviation when known.

Get live stories

Returns event-driven stories for a live game, sorted oldest to newest by created_at. Live games produce guaranteed period-end checkpoints plus conditional stories triggered by momentum shifts, prop breaches, and milestones. Returns an empty array if no live stories have been generated yet.

GET/stories/mlb/games/{game_id}/live

Query parameters

NameTypeRequiredDescription
audiencestringNoEither betting or stats. Defaults to betting.
tonestringNoEither editorial or humor. Defaults to editorial.

Example request

curl -H "Authorization: Bearer YOUR_API_KEY" \
  "https://api.balldontlie.io/stories/mlb/games/5058004/live?audience=betting&tone=editorial"

Example response

{
  "game": { "id": 5058004 },
  "data": [
    {
      "id": 192921,
      "created_at": "2026-04-13T20:50:23.390Z",
      "type": "batter_breakout",
      "content": "Josh Naylor has already cleared his 1.5 total bases line in the 3rd, going 2-for-2 with a homer as SEA jumps out to a 5-0 lead.",
      "entity_tags": {
        "teams": [
          { "id": 25, "name": "Seattle Mariners", "abbreviation": "SEA" },
          { "id": 11, "name": "Houston Astros", "abbreviation": "HOU" }
        ],
        "players": [
          { "id": 1059, "name": "Josh Naylor", "team": "SEA" }
        ]
      },
      "game_snapshot": {
        "period": 3,
        "home_score": 5,
        "away_score": 0,
        "minutes_remaining": 0
      }
    }
  ]
}

Response schema

game

Compact reference to the game this response is scoped to. Echoes the :game_id path parameter.

FieldTypeDescription
idintegerGame identifier matching the one supplied in the request path.

data

Array of live stories for the game, ordered oldest to newest by created_at. Empty if no live stories have fired yet.

FieldTypeDescription
idintegerStable story identifier. Safe to use as an idempotency key.
created_atstring (date-time)RFC 3339 timestamp (UTC) marking when the narrative was written.
typestringDetection module that produced this story (e.g. game_over, close_game, prop_exceeded, batter_breakout). Useful for routing stories into downstream product surfaces.
contentstring| nullTweet-length narrative body (≤280 characters). Null only in the rare case that the requested tone has not yet been rendered for this story.
entity_tagsobjectTeams and players referenced in content. See entity_tags below.
game_snapshotobjectScore and clock at the moment the story fired. See game_snapshot below.

entity_tags

Structured list of the teams and players referenced in the narrative. Use the IDs to join to the corresponding BallDontLie sport APIs.

FieldTypeDescription
teamsarray<object>Teams mentioned in the story. Each element is { id: integer, name: string, abbreviation: string }.
playersarray<object>Players mentioned in the story. Each element is { id: integer, name: string, team?: string }, where team is the abbreviation when known.

game_snapshot

Point-in-time state of the game when the story was generated. Useful for rendering a score banner alongside the narrative.

FieldTypeDescription
home_scoreintegerHome team score at the moment the story fired.
away_scoreintegerAway team score at the moment the story fired.
periodintegerInning number. 1–9 for regulation, 10+ for extras.
minutes_remainingintegerWhole minutes remaining in the current period.
clockstring| nullRaw game-clock string when available (e.g. "6:22"). Present on most live triggers; may be absent on period-boundary events.

Get postgame story

Returns the most recent postgame story, generated immediately after the game goes final. Evaluates the pregame narrative against actual results. Returns 404 if no postgame story has been generated yet.

GET/stories/mlb/games/{game_id}/postgame

Query parameters

NameTypeRequiredDescription
audiencestringNoEither betting or stats. Defaults to betting.
tonestringNoEither editorial or humor. Defaults to editorial.

Example request

curl -H "Authorization: Bearer YOUR_API_KEY" \
  "https://api.balldontlie.io/stories/mlb/games/5058004/postgame?audience=betting&tone=editorial"

Example response

{
  "game": { "id": 5058004 },
  "story": {
    "id": 193011,
    "created_at": "2026-04-13T22:48:09.512Z",
    "content": "SEA cashed both ways: 6-2 over HOU, covering -1.5 as the game sailed over 7.5 with 8 runs. Josh Naylor was the swing piece — 2 HR, 5 RBI, 8 TB — while Mike Burrows got tagged for 6 ER on 11 H.",
    "entity_tags": {
      "teams": [
        { "id": 25, "name": "Seattle Mariners", "abbreviation": "SEA" },
        { "id": 11, "name": "Houston Astros", "abbreviation": "HOU" }
      ],
      "players": [
        { "id": 1059, "name": "Josh Naylor", "team": "SEA" }
      ]
    }
  }
}

Response schema

game

Compact reference to the game this response is scoped to. Echoes the :game_id path parameter.

FieldTypeDescription
idintegerGame identifier matching the one supplied in the request path.

story

The single narrative object for this phase. Deterministic for a given (game_id, audience, tone) tuple.

FieldTypeDescription
idintegerStable story identifier. Safe to use as an idempotency key.
created_atstring (date-time)RFC 3339 timestamp (UTC) marking when the narrative was written.
contentstring| nullTweet-length narrative body (≤280 characters). Null only in the rare case that the requested tone has not yet been rendered for this story.
entity_tagsobjectTeams and players referenced in content. See entity_tags below.

entity_tags

Structured list of the teams and players referenced in the narrative. Use the IDs to join to the corresponding BallDontLie sport APIs.

FieldTypeDescription
teamsarray<object>Teams mentioned in the story. Each element is { id: integer, name: string, abbreviation: string }.
playersarray<object>Players mentioned in the story. Each element is { id: integer, name: string, team?: string }, where team is the abbreviation when known.