{
  "openapi": "3.0.1",
  "info": {
    "title": "Official MLB Team, Schedule & Stat Line Scraper",
    "description": "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.",
    "version": "1.1",
    "x-build-id": "cCMwmOrwZkNoObEE3"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/dataspryva~official-mlb-team-schedule-and-stat-line-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-dataspryva-official-mlb-team-schedule-and-stat-line-scraper",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/acts/dataspryva~official-mlb-team-schedule-and-stat-line-scraper/runs": {
      "post": {
        "operationId": "runs-sync-dataspryva-official-mlb-team-schedule-and-stat-line-scraper",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor and returns information about the initiated run in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/runsResponseSchema"
                }
              }
            }
          }
        }
      }
    },
    "/acts/dataspryva~official-mlb-team-schedule-and-stat-line-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-dataspryva-official-mlb-team-schedule-and-stat-line-scraper",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "inputSchema": {
        "type": "object",
        "required": [
          "mode"
        ],
        "properties": {
          "mode": {
            "title": "Mode",
            "enum": [
              "getTeams",
              "getPlayers",
              "getPlayerStats",
              "getGameLog",
              "getSchedule",
              "getStandings",
              "getBoxscore",
              "getLeaders",
              "getReference"
            ],
            "type": "string",
            "description": "What to fetch. Nine modes cover teams, players/rosters, player stats, game logs, schedules, standings, box scores, leaders, and reference data.",
            "default": "getPlayerStats"
          },
          "seasons": {
            "title": "Seasons",
            "type": "array",
            "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).",
            "items": {
              "type": "string"
            },
            "default": []
          },
          "teamIds": {
            "title": "Teams",
            "type": "array",
            "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.",
            "items": {
              "type": "string"
            },
            "default": []
          },
          "playerIds": {
            "title": "Player IDs",
            "type": "array",
            "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.",
            "items": {
              "type": "string"
            },
            "default": []
          },
          "gamePks": {
            "title": "Game IDs",
            "type": "array",
            "description": "MLB game IDs (gamePk), e.g. 822974. Used by mode=getBoxscore. Leave empty to derive games from seasons, dates, or teams.",
            "items": {
              "type": "string"
            },
            "default": []
          },
          "startDate": {
            "title": "Start date",
            "type": "string",
            "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."
          },
          "endDate": {
            "title": "End date",
            "type": "string",
            "description": "End date in YYYY-MM-DD format. Used by schedule, box score, and player stats (statType=byDateRange)."
          },
          "statGroup": {
            "title": "Stat group",
            "enum": [
              "hitting",
              "pitching",
              "fielding"
            ],
            "type": "string",
            "description": "Which stat category to return for players, player stats, game logs, box scores, and leaders.",
            "default": "hitting"
          },
          "statType": {
            "title": "Stat type",
            "enum": [
              "season",
              "career",
              "yearByYear",
              "byMonth",
              "byDayOfWeek",
              "homeAndAway",
              "byDateRange"
            ],
            "type": "string",
            "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.",
            "default": "season"
          },
          "rosterType": {
            "title": "Roster type",
            "enum": [
              "active",
              "40Man",
              "fullSeason",
              "depthChart",
              "coach"
            ],
            "type": "string",
            "description": "Which roster to return for mode=getPlayers when teamIds is set.",
            "default": "active"
          },
          "searchQuery": {
            "title": "Search query",
            "type": "string",
            "description": "Find players by name for mode=getPlayers, e.g. Ohtani or Aaron Judge. Returns up to 50 matching players."
          },
          "leagueId": {
            "title": "League",
            "enum": [
              "both",
              "AL",
              "NL"
            ],
            "type": "string",
            "description": "Filter standings and leaders to the American League, National League, or both.",
            "default": "both"
          },
          "gameType": {
            "title": "Game type",
            "enum": [
              "S",
              "R",
              "F",
              "D",
              "L",
              "W",
              "C",
              "P",
              "A",
              "I",
              "E"
            ],
            "type": "string",
            "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).",
            "default": "R"
          },
          "leaderCategory": {
            "title": "Leader category",
            "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"
            ],
            "type": "string",
            "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.",
            "default": "homeRuns"
          },
          "referenceType": {
            "title": "Reference data",
            "enum": [
              "venues",
              "leagues",
              "divisions",
              "seasons"
            ],
            "type": "string",
            "description": "Which reference dataset to return for mode=getReference.",
            "default": "venues"
          },
          "includeStats": {
            "title": "Include season stats",
            "type": "boolean",
            "description": "For mode=getPlayers, attach each player's season stats for the selected stat group.",
            "default": false
          },
          "includeTeamTotals": {
            "title": "Include team totals and line score",
            "type": "boolean",
            "description": "For mode=getBoxscore, add one team-total record per side per game, including the inning-by-inning line score.",
            "default": false
          },
          "maxItems": {
            "title": "Maximum records",
            "minimum": 1,
            "maximum": 10000,
            "type": "integer",
            "description": "Hard cap on the number of records returned (1–10,000).",
            "default": 50
          }
        }
      },
      "runsResponseSchema": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "actId": {
                "type": "string"
              },
              "userId": {
                "type": "string"
              },
              "startedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "finishedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "status": {
                "type": "string",
                "example": "READY"
              },
              "meta": {
                "type": "object",
                "properties": {
                  "origin": {
                    "type": "string",
                    "example": "API"
                  },
                  "userAgent": {
                    "type": "string"
                  }
                }
              },
              "stats": {
                "type": "object",
                "properties": {
                  "inputBodyLen": {
                    "type": "integer",
                    "example": 2000
                  },
                  "rebootCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "restartCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "resurrectCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "computeUnits": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "options": {
                "type": "object",
                "properties": {
                  "build": {
                    "type": "string",
                    "example": "latest"
                  },
                  "timeoutSecs": {
                    "type": "integer",
                    "example": 300
                  },
                  "memoryMbytes": {
                    "type": "integer",
                    "example": 1024
                  },
                  "diskMbytes": {
                    "type": "integer",
                    "example": 2048
                  }
                }
              },
              "buildId": {
                "type": "string"
              },
              "defaultKeyValueStoreId": {
                "type": "string"
              },
              "defaultDatasetId": {
                "type": "string"
              },
              "defaultRequestQueueId": {
                "type": "string"
              },
              "buildNumber": {
                "type": "string",
                "example": "1.0.0"
              },
              "containerUrl": {
                "type": "string"
              },
              "usage": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "integer",
                    "example": 1
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "usageTotalUsd": {
                "type": "number",
                "example": 0.00005
              },
              "usageUsd": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "number",
                    "example": 0.00005
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}