{
  "openapi": "3.0.1",
  "info": {
    "title": "MLB Stats Scraper: Player Stats, Scores, Standings & Box Score",
    "description": "Scrape MLB stats with no API key: teams, rosters, player hitting/pitching/fielding stats, schedules and scores, box scores, and division standings from the official MLB Stats API. All 30 clubs, career and year-by-year history, playoff race. Export JSON, CSV, Excel. Fantasy and analytics ready.",
    "version": "0.1",
    "x-build-id": "hEMOWGUkcZnupoAUw"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/scrapers_lat~mlb-stats-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-scrapers_lat-mlb-stats-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/scrapers_lat~mlb-stats-scraper/runs": {
      "post": {
        "operationId": "runs-sync-scrapers_lat-mlb-stats-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/scrapers_lat~mlb-stats-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-scrapers_lat-mlb-stats-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",
        "properties": {
          "maxRecords": {
            "title": "Max Records",
            "minimum": 1,
            "maximum": 1000000,
            "type": "integer",
            "description": "Maximum number of records to collect. Optional."
          },
          "withDetails": {
            "title": "Include detailed data (roster & game modes)",
            "type": "boolean",
            "description": "In roster mode: also fetch each player's season stats and bio (height, weight, bat side, throwing hand, birthplace). In game mode: also fetch the full per-player box score (batting and pitching lines for both teams). Has no effect in other modes.",
            "default": true
          },
          "mode": {
            "title": "Mode",
            "enum": [
              "teams",
              "roster",
              "players",
              "schedule",
              "standings",
              "game",
              "venues",
              "leagues",
              "divisions",
              "seasons"
            ],
            "type": "string",
            "description": "What to collect. teams = all 30 MLB clubs. roster = every player on a team (or several teams). players = profile and season/career stats for specific players. schedule = games, scores and probable pitchers for a date or date range. standings = division standings. game = box score, line score and decisions for a game. venues/leagues/divisions/seasons = MLB reference data.",
            "default": "standings"
          },
          "season": {
            "title": "Season",
            "minimum": 1876,
            "maximum": 2030,
            "type": "integer",
            "description": "Season year (used by teams, roster, players and standings modes). Defaults to the current MLB season when left empty."
          },
          "teamId": {
            "title": "Team (roster mode)",
            "enum": [
              "109",
              "133",
              "144",
              "110",
              "111",
              "112",
              "145",
              "113",
              "114",
              "115",
              "116",
              "117",
              "118",
              "108",
              "119",
              "146",
              "158",
              "142",
              "121",
              "147",
              "143",
              "134",
              "135",
              "137",
              "136",
              "138",
              "139",
              "140",
              "141",
              "120"
            ],
            "type": "string",
            "description": "MLB team whose roster to fetch. Required for roster mode."
          },
          "teamIds": {
            "title": "Teams batch (roster mode)",
            "type": "array",
            "description": "Optional. Fetch rosters for several teams in one run (list of MLB team IDs). Combined with the single Team field above. Example: [\"147\", \"111\"] for Yankees and Red Sox.",
            "items": {
              "type": "string"
            }
          },
          "playerIds": {
            "title": "Player IDs (players mode)",
            "type": "array",
            "description": "MLB player IDs to look up in players mode (one record per player). For example 592450 is Aaron Judge and 660271 is Shohei Ohtani. Find IDs in the output of teams or roster mode.",
            "items": {
              "type": "string"
            }
          },
          "playerId": {
            "title": "Player ID (players mode, single)",
            "type": "string",
            "description": "Optional single MLB player ID for players mode. Merged with Player IDs above."
          },
          "statGroup": {
            "title": "Stat Group (players / roster mode)",
            "enum": [
              "hitting",
              "pitching",
              "fielding"
            ],
            "type": "string",
            "description": "Which season stat line to attach to each player: hitting, pitching or fielding.",
            "default": "hitting"
          },
          "date": {
            "title": "Date (schedule / game mode)",
            "type": "string",
            "description": "Date in YYYY-MM-DD format, for example 2025-07-04. Defaults to today when left empty. In schedule and game modes."
          },
          "startDate": {
            "title": "Start date (schedule mode range)",
            "type": "string",
            "description": "Optional. Start of a date range for schedule mode (YYYY-MM-DD). Use with End date to pull many days of games at once."
          },
          "endDate": {
            "title": "End date (schedule mode range)",
            "type": "string",
            "description": "Optional. End of a date range for schedule mode (YYYY-MM-DD). Use with Start date."
          },
          "gameType": {
            "title": "Game type (schedule / game / stats)",
            "type": "string",
            "description": "Optional MLB game type filter. R = regular season, S = spring training, A = all-star, F = wild card, D = division series, L = league championship, W = World Series, E = exhibition. Combine with commas, e.g. F,D,L,W for postseason."
          },
          "seasonType": {
            "title": "Season type (convenience filter)",
            "enum": [
              "",
              "regular",
              "post",
              "spring"
            ],
            "type": "string",
            "description": "Optional shortcut for Game type. regular = R, post = F,D,L,W (postseason), spring = S.",
            "default": ""
          },
          "gamePks": {
            "title": "Game IDs (game mode)",
            "type": "array",
            "description": "MLB game IDs (gamePk) to fetch in game mode. Find gamePk values in the id field of schedule mode output. When empty, game mode uses the Date field.",
            "items": {
              "type": "string"
            }
          },
          "gamePk": {
            "title": "Game ID (game mode, single)",
            "type": "string",
            "description": "Optional single MLB game ID (gamePk) for game mode. Merged with Game IDs above."
          },
          "leagueId": {
            "title": "League (standings mode)",
            "enum": [
              "103,104",
              "103",
              "104"
            ],
            "type": "string",
            "description": "League for standings mode: American League, National League, or both.",
            "default": "103,104"
          }
        }
      },
      "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
                  }
                }
              },
              "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}