Dataspryva

Official MLB Team, Schedule & Stat Line Scraper

Get baseball data from MLB's own public Stats API: season hitting, pitching, and fielding lines, team rosters, game schedules and scores, or live division standings. No authentication required.

Input schema

Input fields, types, required flags, descriptions, defaults, and prefills come from the published definition. Prefill examples are distinct from defaults.

FieldTypeRequiredDescription
modestringrequiredWhat to fetch. Nine modes cover teams, players/rosters, player stats, game logs, schedules, standings, box scores, leaders, and reference data.
seasonsarrayoptionalSeason years, e.g. 2024 or 2025. Leave empty for the current season. Stats cover 1876 onward; schedules cover 1901 onward. Multiple seasons can be fetched in one run (mode=getTeams, getPlayers, getPlayerStats, getSchedule, getStandings, getLeaders, getReference).
teamIdsarrayoptionalFilter by MLB team IDs (147 = Yankees), team names (Yankees), abbreviations (NYY), or team URLs (https://www.mlb.com/yankees). Leave empty for all teams. Used by teams, players, player stats, schedule, standings, box score, and leaders modes.
Show all input fields
FieldTypeRequiredDescription
modestringrequiredWhat to fetch. Nine modes cover teams, players/rosters, player stats, game logs, schedules, standings, box scores, leaders, and reference data.
seasonsarrayoptionalSeason years, e.g. 2024 or 2025. Leave empty for the current season. Stats cover 1876 onward; schedules cover 1901 onward. Multiple seasons can be fetched in one run (mode=getTeams, getPlayers, getPlayerStats, getSchedule, getStandings, getLeaders, getReference).
teamIdsarrayoptionalFilter by MLB team IDs (147 = Yankees), team names (Yankees), abbreviations (NYY), or team URLs (https://www.mlb.com/yankees). Leave empty for all teams. Used by teams, players, player stats, schedule, standings, box score, and leaders modes.
playerIdsarrayoptionalMLB player IDs, e.g. 660271 for Shohei Ohtani. Used by players, player stats, and game log modes. Use Search query to find a player ID by name.
gamePksarrayoptionalMLB game IDs (gamePk), e.g. 822974. Used by mode=getBoxscore. Leave empty to derive games from seasons, dates, or teams.
startDatestringoptionalStart date in YYYY-MM-DD format. Used by schedule, box score, and player stats (statType=byDateRange). A single date can be set in either date field.
endDatestringoptionalEnd date in YYYY-MM-DD format. Used by schedule, box score, and player stats (statType=byDateRange).
statGroupstringoptionalWhich stat category to return for players, player stats, game logs, box scores, and leaders.
statTypestringoptionalScope for mode=getPlayerStats. Season, career, and date-range stats work for the whole player pool; season-by-season, month, day-of-week, and home/away splits require playerIds or teamIds.
rosterTypestringoptionalWhich roster to return for mode=getPlayers when teamIds is set.
searchQuerystringoptionalFind players by name for mode=getPlayers, e.g. Ohtani or Aaron Judge. Returns up to 50 matching players.
leagueIdstringoptionalFilter standings and leaders to the American League, National League, or both.
gameTypestringoptionalFilter games and stats by game type. Regular season is R; other codes include spring training (S), wild card (F), division series (D), league championship (L), World Series (W), and All-Star (A).
leaderCategorystringoptionalStat category for mode=getLeaders. Choose a category that belongs to the selected stat group, e.g. homeRuns, battingAverage, or runsBattedIn for hitting; earnedRunAverage, strikeouts, or saves for pitching; fieldingPercentage or errors for fielding.
referenceTypestringoptionalWhich reference dataset to return for mode=getReference.
includeStatsbooleanoptionalFor mode=getPlayers, attach each player's season stats for the selected stat group.
includeTeamTotalsbooleanoptionalFor mode=getBoxscore, add one team-total record per side per game, including the inning-by-inning line score.
maxItemsintegeroptionalHard cap on the number of records returned (1–10,000).

Download the published input schema

View complete JSON
{
  "description": "Fetch official MLB data from statsapi.mlb.com — teams, rosters, schedules, standings, stat lines, box scores, leaders, and reference data.",
  "properties": {
    "endDate": {
      "description": "End date in YYYY-MM-DD format. Used by schedule, box score, and player stats (statType=byDateRange).",
      "editor": "textfield",
      "title": "End date",
      "type": "string"
    },
    "gamePks": {
      "default": [],
      "description": "MLB game IDs (gamePk), e.g. 822974. Used by mode=getBoxscore. Leave empty to derive games from seasons, dates, or teams.",
      "editor": "stringList",
      "items": {
        "type": "string"
      },
      "prefill": [],
      "title": "Game IDs",
      "type": "array"
    },
    "gameType": {
      "default": "R",
      "description": "Filter games and stats by game type. Regular season is R; other codes include spring training (S), wild card (F), division series (D), league championship (L), World Series (W), and All-Star (A).",
      "editor": "select",
      "enum": [
        "S",
        "R",
        "F",
        "D",
        "L",
        "W",
        "C",
        "P",
        "A",
        "I",
        "E"
      ],
      "enumTitles": [
        "Spring Training",
        "Regular Season",
        "Wild Card",
        "Division Series",
        "League Championship Series",
        "World Series",
        "Championship",
        "Postseason",
        "All-Star Game",
        "Intrasquad",
        "Exhibition"
      ],
      "prefill": "R",
      "title": "Game type",
      "type": "string"
    },
    "includeStats": {
      "default": false,
      "description": "For mode=getPlayers, attach each player's season stats for the selected stat group.",
      "prefill": false,
      "title": "Include season stats",
      "type": "boolean"
    },
    "includeTeamTotals": {
      "default": false,
      "description": "For mode=getBoxscore, add one team-total record per side per game, including the inning-by-inning line score.",
      "prefill": false,
      "title": "Include team totals and line score",
      "type": "boolean"
    },
    "leaderCategory": {
      "default": "homeRuns",
      "description": "Stat category for mode=getLeaders. Choose a category that belongs to the selected stat group, e.g. homeRuns, battingAverage, or runsBattedIn for hitting; earnedRunAverage, strikeouts, or saves for pitching; fieldingPercentage or errors for fielding.",
      "editor": "select",
      "enum": [
        "homeRuns",
        "battingAverage",
        "runsBattedIn",
        "hits",
        "runs",
        "stolenBases",
        "doubles",
        "triples",
        "walks",
        "onBasePlusSlugging",
        "strikeouts",
        "hitByPitch",
        "caughtStealing",
        "intentionalWalks",
        "totalBases",
        "plateAppearances",
        "gamesPlayed",
        "atBats",
        "sacrificeFlies",
        "groundIntoDoublePlay",
        "earnedRunAverage",
        "wins",
        "saves",
        "whip",
        "inningsPitched",
        "losses",
        "gamesStarted",
        "completeGames",
        "shutouts",
        "holds",
        "blownSaves",
        "walksPer9Inn",
        "strikeoutsPer9Inn",
        "hitsPer9Inn",
        "winPercentage",
        "strikeoutWalkRatio",
        "battersFaced",
        "numberOfPitches",
        "wildPitches",
        "balks",
        "fieldingPercentage",
        "errors",
        "assists",
        "putOuts",
        "chances",
        "doublePlays",
        "rangeFactorPerGame",
        "innings"
      ],
      "enumTitles": [
        "Home runs",
        "Batting average",
        "Runs batted in",
        "Hits",
        "Runs",
        "Stolen bases",
        "Doubles",
        "Triples",
        "Walks",
        "On-base plus slugging",
        "Strikeouts",
        "Hit by pitch",
        "Caught stealing",
        "Intentional walks",
        "Total bases",
        "Plate appearances",
        "Games played",
        "At bats",
        "Sacrifice flies",
        "Grounded into double play",
        "Earned run average",
        "Wins",
        "Saves",
        "WHIP",
        "Innings pitched",
        "Losses",
        "Games started",
        "Complete games",
        "Shutouts",
        "Holds",
        "Blown saves",
        "Walks per 9 innings",
        "Strikeouts per 9 innings",
        "Hits per 9 innings",
        "Win percentage",
        "Strikeout-to-walk ratio",
        "Batters faced",
        "Number of pitches",
        "Wild pitches",
        "Balks",
        "Fielding percentage",
        "Errors",
        "Assists",
        "Putouts",
        "Chances",
        "Double plays",
        "Range factor per game",
        "Innings"
      ],
      "prefill": "homeRuns",
      "title": "Leader category",
      "type": "string"
    },
    "leagueId": {
      "default": "both",
      "description": "Filter standings and leaders to the American League, National League, or both.",
      "editor": "select",
      "enum": [
        "both",
        "AL",
        "NL"
      ],
      "enumTitles": [
        "Both leagues",
        "American League",
        "National League"
      ],
      "prefill": "both",
      "title": "League",
      "type": "string"
    },
    "maxItems": {
      "default": 50,
      "description": "Hard cap on the number of records returned (1–10,000).",
      "maximum": 10000,
      "minimum": 1,
      "prefill": 3,
      "title": "Maximum records",
      "type": "integer"
    },
    "mode": {
      "default": "getPlayerStats",
      "description": "What to fetch. Nine modes cover teams, players/rosters, player stats, game logs, schedules, standings, box scores, leaders, and reference data.",
      "editor": "select",
      "enum": [
        "getTeams",
        "getPlayers",
        "getPlayerStats",
        "getGameLog",
        "getSchedule",
        "getStandings",
        "getBoxscore",
        "getLeaders",
        "getReference"
      ],
      "enumTitles": [
        "Teams",
        "Players and rosters",
        "Player stats (season, career, splits)",
        "Player game-by-game log",
        "Schedule and scores",
        "Standings",
        "Box score stat lines",
        "League leaders",
        "Reference data (venues, leagues, divisions, seasons)"
      ],
      "prefill": "getPlayers",
      "title": "Mode",
      "type": "string"
    },
    "playerIds": {
      "default": [],
      "description": "MLB player IDs, e.g. 660271 for Shohei Ohtani. Used by players, player stats, and game log modes. Use Search query to find a player ID by name.",
      "editor": "stringList",
      "items": {
        "type": "string"
      },
      "prefill": [],
      "title": "Player IDs",
      "type": "array"
    },
    "referenceType": {
      "default": "venues",
      "description": "Which reference dataset to return for mode=getReference.",
      "editor": "select",
      "enum": [
        "venues",
        "leagues",
        "divisions",
        "seasons"
      ],
      "enumTitles": [
        "Ballparks and venues",
        "Leagues",
        "Divisions",
        "Season calendar"
      ],
      "prefill": "venues",
      "title": "Reference data",
      "type": "string"
    },
    "rosterType": {
      "default": "active",
      "description": "Which roster to return for mode=getPlayers when teamIds is set.",
      "editor": "select",
      "enum": [
        "active",
        "40Man",
        "fullSeason",
        "depthChart",
        "coach"
      ],
      "enumTitles": [
        "Active roster",
        "40-man roster",
        "Full-season roster",
        "Depth chart",
        "Coaching staff"
      ],
      "prefill": "active",
      "title": "Roster type",
      "type": "string"
    },
    "searchQuery": {
      "description": "Find players by name for mode=getPlayers, e.g. Ohtani or Aaron Judge. Returns up to 50 matching players.",
      "editor": "textfield",
      "title": "Search query",
      "type": "string"
    },
    "seasons": {
      "default": [],
      "description": "Season years, e.g. 2024 or 2025. Leave empty for the current season. Stats cover 1876 onward; schedules cover 1901 onward. Multiple seasons can be fetched in one run (mode=getTeams, getPlayers, getPlayerStats, getSchedule, getStandings, getLeaders, getReference).",
      "editor": "stringList",
      "items": {
        "type": "string"
      },
      "prefill": [],
      "title": "Seasons",
      "type": "array"
    },
    "startDate": {
      "description": "Start date in YYYY-MM-DD format. Used by schedule, box score, and player stats (statType=byDateRange). A single date can be set in either date field.",
      "editor": "textfield",
      "title": "Start date",
      "type": "string"
    },
    "statGroup": {
      "default": "hitting",
      "description": "Which stat category to return for players, player stats, game logs, box scores, and leaders.",
      "editor": "select",
      "enum": [
        "hitting",
        "pitching",
        "fielding"
      ],
      "enumTitles": [
        "Hitting",
        "Pitching",
        "Fielding"
      ],
      "prefill": "hitting",
      "title": "Stat group",
      "type": "string"
    },
    "statType": {
      "default": "season",
      "description": "Scope for mode=getPlayerStats. Season, career, and date-range stats work for the whole player pool; season-by-season, month, day-of-week, and home/away splits require playerIds or teamIds.",
      "editor": "select",
      "enum": [
        "season",
        "career",
        "yearByYear",
        "byMonth",
        "byDayOfWeek",
        "homeAndAway",
        "byDateRange"
      ],
      "enumTitles": [
        "Season totals",
        "Career totals",
        "Season by season",
        "By month",
        "By day of week",
        "Home and away",
        "Date range"
      ],
      "prefill": "season",
      "title": "Stat type",
      "type": "string"
    },
    "teamIds": {
      "default": [],
      "description": "Filter by MLB team IDs (147 = Yankees), team names (Yankees), abbreviations (NYY), or team URLs (https://www.mlb.com/yankees). Leave empty for all teams. Used by teams, players, player stats, schedule, standings, box score, and leaders modes.",
      "editor": "stringList",
      "items": {
        "type": "string"
      },
      "prefill": [],
      "title": "Teams",
      "type": "array"
    }
  },
  "required": [
    "mode"
  ],
  "schemaVersion": 1,
  "title": "Official MLB Team, Schedule & Stat Line Scraper Input",
  "type": "object"
}

Output schema

Published result links and storage locations. This schema is not an exhaustive contract for every field in a dataset record.

FieldTypeRequiredDescription
mlbDatastringoptionalDataset containing the requested MLB records, tagged by recordType.

Download the published output schema

View complete JSON
{
  "actorOutputSchemaVersion": 1,
  "description": "One record per MLB team, player, stat line, game, standing, leader, box-score line, venue, league, division, or season calendar row, sourced from the official MLB Stats API.",
  "properties": {
    "mlbData": {
      "description": "Dataset containing the requested MLB records, tagged by recordType.",
      "template": "{{links.apiDefaultDatasetUrl}}/items",
      "title": "MLB data records",
      "type": "string"
    }
  },
  "title": "Official MLB Team, Schedule & Stat Line Scraper Output"
}

Dataset schema

Published dataset views and any declared field definitions. A view can select only a subset of the returned record fields.

Download the published dataset schema

View complete JSON
{
  "actorSpecification": 1,
  "views": {
    "overview": {
      "display": {
        "component": "table",
        "properties": {}
      },
      "title": "MLB data",
      "transformation": {
        "fields": [
          "recordType",
          "playerName",
          "teamName",
          "gamePk",
          "officialDate",
          "statGroup",
          "leaderCategory",
          "rank",
          "value",
          "homeRuns",
          "battingAverage",
          "era"
        ]
      }
    }
  }
}

Key-value schema

Published key-value store definitions, when provided by this build.

This definition is not present in the default published build. See the published README for available documentation.

Published README

Read the full published documentation

Official MLB Team, Schedule & Stat Line Scraper

Pull Major League Baseball data straight from MLB's public Stats API. Get all 30 clubs, player bios and rosters, schedules with probable pitchers and final scores, division standings, season and career stat lines, player game logs, per-player box scores, league leaderboards, and ballpark reference data. Nine modes, one dataset, no API key, no login, and no proxy setup.

What this actor does

  • Nine modes in one actor — teams, players/rosters, player stats, game logs, schedule, standings, box scores, leaders, and reference data.
  • Complete player pool — season stats include every player the source returns, not only qualified hitters or pitchers.
  • Historical coverage — stats reach back to 1876 and schedules to 1901; request one season or several in the same run.
  • Game-level detail — schedules include probable pitchers, weather, decisions, attendance, umpires, and inning line scores; box scores return per-player batting, pitching, or fielding lines.
  • Clean, flat records — every record carries a recordType and scrapedAt; fields the source does not have for a record are omitted rather than sent as null.

Modes

Mode One record per Highlights
getTeams Club League, division, venue, franchise, logo, team URL
getPlayers Player Bio, position, bats/throws, debut, headshot, team; rosters and name search; optional season stats
getPlayerStats Player stat split Season, career, season-by-season, month, day-of-week, home/away, or date-range lines
getGameLog Player per game One row per game with the full stat line, opponent, and game ID
getSchedule Game Scores, status, probable pitchers, weather, decisions, attendance, umpires, line score
getStandings Team season record Wins, losses, pct, ranks, games back, streaks, splits, clinch and elimination numbers
getBoxscore Player per game Batting, pitching, or fielding line plus game context; optional team totals and line score
getLeaders Ranked player Category, rank, value, player, team, league
getReference Venue / league / division / season Ballpark capacity, surface, roof, coordinates, league and division metadata, season calendar

Output per record type

Team (getTeams)

recordType, teamId, name, abbreviation, teamName, shortName, locationName, clubName, franchiseName, firstYearOfPlay, teamCode, fileCode, leagueName, leagueId, divisionName, divisionId, venueName, venueId, sportName, springLeagueName, allStarStatus, active, season, logoUrl, mlbUrl, scrapedAt.

Player (getPlayers)

recordType, playerId, fullName, firstName, lastName, middleName, useName, primaryNumber, birthDate, currentAge, birthCity, birthStateProvince, birthCountry, height, weight, active, primaryPosition, primaryPositionCode, primaryPositionType, batSide, pitchHand, mlbDebutDate, draftYear, nickName, nameSlug, boxscoreName, currentTeam, currentTeamId, leagueName, divisionName, headshotUrl, mlbUrl, season. Roster rows also include jerseyNumber, rosterStatus, parentTeamId, rosterPosition, and rosterPositionAbbreviation. With includeStats, a stats object holds the selected stat group.

Player stats (getPlayerStats)

recordType, playerId, playerName, fullName, firstName, lastName, teamId, teamName, position, positionAbbreviation, leagueName, sportId, season, statType, statGroup, splitKey, splitValue, month, monthName, dayOfWeek, dayOfWeekName, isHome, situationCode, startDate, endDate, mlbUrl. Every non-empty stat field returned by MLB is included, for example: gamesPlayed, atBats, runs, hits, doubles, triples, homeRuns, rbi, baseOnBalls, walks, strikeOuts, strikeouts, stolenBases, caughtStealing, avg, battingAverage, obp, onBasePercentage, slg, sluggingPct, ops, babip, wins, losses, saves, holds, blownSaves, inningsPitched, earnedRuns, era, whip, battersFaced, numberOfPitches, completeGames, shutouts, strikeoutsPer9Inn, walksPer9Inn, fieldingPercentage, chances, putOuts, assists, errors, doublePlays.

Game log (getGameLog)

recordType, playerId, playerName, fullName, teamId, teamName, opponentId, opponentName, isHome, gamePk, officialDate, date, season, gameType, statGroup, mlbUrl, plus every non-empty stat field for that game.

Game (getSchedule)

recordType, gamePk, gameGuid, season, gameDate, officialDate, gameType, gameNumber, doubleHeader, dayNight, seriesDescription, seriesGameNumber, gamesInSeries, scheduledInnings, isTie, recordSource, publicFacing, status, abstractGameState, codedGameState, statusCode, homeTeam, homeTeamId, homeTeamAbbreviation, awayTeam, awayTeamId, awayTeamAbbreviation, homeScore, awayScore, homeWinner, awayWinner, venue, venueId, awayProbablePitcher, awayProbablePitcherId, homeProbablePitcher, homeProbablePitcherId, weatherCondition, weatherTemp, weatherWind, awayRuns, homeRuns, awayHits, homeHits, awayErrors, homeErrors, innings, winningPitcher, winningPitcherId, losingPitcher, losingPitcherId, savePitcher, savePitcherId, attendance, firstPitch, gameDurationMinutes, delayDurationMinutes, officials, noHitter, perfectGame, mlbUrl, scrapedAt.

Standing (getStandings)

recordType, teamName, teamId, leagueName, leagueId, divisionName, divisionId, season, wins, losses, gamesPlayed, pct, divisionRank, leagueRank, sportRank, wildCardRank, gamesBack, wildCardGamesBack, leagueGamesBack, sportGamesBack, divisionGamesBack, streakCode, streakType, streakNumber, runsScored, runsAllowed, runDifferential, clinched, divisionChamp, divisionLeader, hasWildcard, clinchIndicator, magicNumber, eliminationNumber, wildCardEliminationNumber, homeRecord, awayRecord, lastTenRecord, overallRecord, leagueRecord, divisionRecord, mlbUrl, scrapedAt.

Box score (getBoxscore)

recordType (battingLine, pitchingLine, fieldingLine), statGroup, gamePk, season, gameDate, officialDate, gameType, status, homeTeam, homeTeamId, awayTeam, awayTeamId, homeScore, awayScore, venue, attendance, weatherCondition, weatherWind, firstPitch, gameDurationMinutes, winningPitcher, losingPitcher, savePitcher, isHome, teamName, teamId, playerId, playerName, fullName, jerseyNumber, position, battingOrder, summary, decision, mlbUrl, and every non-empty stat field for the selected group. When games come from gamePks, only fields the boxscore payload carries are present (for example officialDate, not gameDate, gameType, or status). seasonBattingAverage, seasonOnBasePercentage, seasonSluggingPct, seasonOps, seasonEra, and seasonWhip add season context. With includeTeamTotals, teamGame records add teamStats and lineScore.

Leader (getLeaders)

recordType, leaderCategory, statGroup, season, gameType, gameTypeDescription, rank, value, playerId, playerName, teamId, teamName, leagueName, sportId, mlbUrl, scrapedAt.

Reference (getReference)

  • Venue: recordType, venueId, name, active, season, city, state, stateAbbrev, postalCode, country, address, phone, latitude, longitude, azimuthAngle, elevation, capacity, turfType, roofType, outfield distances (leftLine, left, leftCenter, center, rightCenter, right, rightLine).
  • League: recordType, leagueId, name, abbreviation, nameShort, seasonState, hasWildCard, hasSplitSeason, numGames, numTeams, numWildcardTeams, and season calendar dates.
  • Division: recordType, divisionId, name, nameShort, abbreviation, leagueId, leagueName, sportId, hasWildcard, active, sortOrder, numPlayoffTeams.
  • Season: recordType, seasonId, hasWildcard, and the full MLB season calendar (regularSeasonStartDate, regularSeasonEndDate, postSeasonStartDate, postSeasonEndDate, and related dates).

Input

Field Type Default Description
mode string getPlayerStats getTeams, getPlayers, getPlayerStats, getGameLog, getSchedule, getStandings, getBoxscore, getLeaders, getReference
seasons array – Season years, e.g. 2026; multiple seasons allowed
teamIds array all teams MLB team IDs, names, abbreviations, or team URLs (e.g. 147, Yankees, NYY)
playerIds array – MLB player IDs, e.g. 660271
gamePks array – MLB game IDs for getBoxscore
startDate string – YYYY-MM-DD for schedules, box scores, or date-range stats
endDate string – YYYY-MM-DD for schedules, box scores, or date-range stats
statGroup string hitting hitting, pitching, or fielding
statType string season season, career, yearByYear, byMonth, byDayOfWeek, homeAndAway, byDateRange
rosterType string active active, 40Man, fullSeason, depthChart, coach
searchQuery string – Player name search for getPlayers, e.g. Ohtani
leagueId string both both, AL, or NL for standings and leaders
gameType string R S, R, F, D, L, W, C, P, A, I, E
leaderCategory string homeRuns Category for getLeaders, e.g. homeRuns, battingAverage, earnedRunAverage, saves
referenceType string venues venues, leagues, divisions, or seasons
includeStats boolean false Add season stats to getPlayers rows
includeTeamTotals boolean false Add team totals and line score to getBoxscore
maxItems integer 50 Hard cap on records (1–10,000)

Examples

A team's roster with season stats

{
  "mode": "getPlayers",
  "seasons": ["2026"],
  "teamIds": ["Yankees"],
  "rosterType": "active",
  "includeStats": true,
  "maxItems": 40
}

A week of games with probable pitchers and decisions

{
  "mode": "getSchedule",
  "startDate": "2026-06-01",
  "endDate": "2026-06-07",
  "gameType": "R",
  "maxItems": 100
}

Season pitching stats for two players

{
  "mode": "getPlayerStats",
  "seasons": ["2024", "2025"],
  "playerIds": ["660271", "592450"],
  "statGroup": "pitching",
  "statType": "season",
  "maxItems": 20
}

A box score with per-player lines and team totals

{
  "mode": "getBoxscore",
  "gamePks": ["822974"],
  "statGroup": "hitting",
  "includeTeamTotals": true,
  "maxItems": 50
}

Use cases

  • Fantasy baseball — pull rosters, season lines, and per-game logs for lineup decisions.
  • Betting and prediction models — backtest with schedules, scores, probable pitchers, and box scores.
  • Sports apps and dashboards — power scoreboards, standings tables, and player pages.
  • Analytics and research — join stable MLB IDs across seasons, teams, and games.
  • Media and newsletters — generate recaps, leaderboards, and matchup previews.
  • Data engineering — build clean historical datasets with one record type per row.

FAQ

Is this an official MLB product?

No. This is an independent, third-party actor that reads MLB's public Stats API. It is not affiliated with, endorsed by, or sponsored by Major League Baseball or any club.

Do I need an API key, login, or proxy?

No. The public Stats API needs no key or account, and the actor does not require a proxy.

How far back does the data go?

Player stats go back to 1876 and schedules to 1901 in the source. Early seasons have fewer recorded fields; those fields are omitted when the source does not have them.

What is the difference between getPlayerStats, getGameLog, and getBoxscore?

getPlayerStats returns season, career, or split totals. getGameLog returns one row per player per game. getBoxscore returns every player's batting, pitching, or fielding line from one game, plus game context.

Why are some fields missing from a record?

The API does not publish every field for every player, game, or season. Empty fields are omitted rather than filled with placeholders.

Why is there no save pitcher on some games?

A save only exists when the game situation creates one. Games without a save omit savePitcher.

Can I request several seasons or teams at once?

Yes. Put multiple years in seasons and multiple IDs, names, or team URLs in teamIds. Duplicate rows are removed by MLB IDs.

Which seasons need player or team IDs for splits?

Season, career, and date-range stats work for the full player pool. Date-range stats take their seasons from startDate/endDate, so the dates and seasons do not disagree. Season-by-season, month, day-of-week, and home/away splits require playerIds or teamIds because they are per-player views in the source.

Will my existing tasks keep working?

Yes. Existing modes and output fields are preserved. Older tasks that send season or teamId are still accepted and mapped to the new fields.

Are doubleheaders handled?

Yes. Games are de-duplicated by gamePk, so both games of a doubleheader are kept.

Data source

The actor reads statsapi.mlb.com, the public JSON feed behind MLB.com and the MLB app. It is an undocumented public API; endpoint behavior and field availability can change. Use the data in accordance with MLB's terms and any applicable law.

Python quickstart

Use a schema-derived input and the Python standard library to start a run. An Apify account and token are required for execution.

Open the step-by-step Python guide →

Source build cCMwmOrwZkNoObEE3. Documentation is regenerated from the default published build; private drafts are not included.