{
  "openapi": "3.0.1",
  "info": {
    "title": "MLB Stats Scraper — Players, Teams, Scores & Standings",
    "description": "Extract structured MLB player statistics, team rosters, game schedules, scores, standings, and game details. Eight extraction modes with flexible filters and clean JSON output.",
    "version": "0.1",
    "x-build-id": "y76Y77bYH5tXTNgSW"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/zapticx~mlb-stats-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-zapticx-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/zapticx~mlb-stats-scraper/runs": {
      "post": {
        "operationId": "runs-sync-zapticx-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/zapticx~mlb-stats-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-zapticx-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": {
          "mode": {
            "title": "What to get",
            "enum": [
              "standings",
              "teams",
              "rosters",
              "players",
              "batting_stats",
              "pitching_stats",
              "schedules",
              "game_details"
            ],
            "type": "string",
            "description": "<b>Teams</b>: all clubs of a season. <b>Rosters</b>: players on each team. <b>Players</b>: player profiles by ID or name. <b>Batting / Pitching stats</b>: stat lines by player, by team, or a league table. <b>Schedules</b>: games and final scores. <b>Standings</b>: division tables. <b>Game details</b>: box score, line score, lineups and starting pitchers.",
            "default": "standings"
          },
          "seasons": {
            "title": "Seasons",
            "type": "array",
            "description": "One or more season years, e.g. 2025. Leave empty for the latest season. Up to 30 seasons; data goes back to 1876.",
            "items": {
              "type": "string"
            }
          },
          "teams": {
            "title": "Teams",
            "type": "array",
            "description": "Team ID (147), abbreviation (NYY) or name (Yankees, New York Yankees). Leave empty for all teams. Used by Teams, Rosters, stats, Schedules and Game details.",
            "items": {
              "type": "string"
            }
          },
          "playerIds": {
            "title": "Player IDs",
            "type": "array",
            "description": "MLB player IDs, e.g. 592450 (Aaron Judge) or 660271 (Shohei Ohtani). Used by Players and the stats modes.",
            "items": {
              "type": "string"
            }
          },
          "playerNames": {
            "title": "Player names",
            "type": "array",
            "description": "Player names to look up, e.g. Aaron Judge. Every player matching a name is included; the run summary lists names that matched more than one player.",
            "items": {
              "type": "string"
            }
          },
          "statType": {
            "title": "Stat type",
            "enum": [
              "season",
              "career",
              "yearByYear"
            ],
            "type": "string",
            "description": "Season lines, career totals, or one line per season (year by year). Career and year-by-year need Player IDs or names.",
            "default": "season"
          },
          "statsGameType": {
            "title": "Regular season or postseason",
            "enum": [
              "R",
              "P"
            ],
            "type": "string",
            "description": "Which games the stat lines cover.",
            "default": "R"
          },
          "playerPool": {
            "title": "League table players",
            "enum": [
              "qualified",
              "all"
            ],
            "type": "string",
            "description": "When no players or teams are given, the stats modes return a league table. Qualified = players with enough plate appearances or innings to qualify; All = everyone.",
            "default": "qualified"
          },
          "rosterType": {
            "title": "Roster type",
            "enum": [
              "active",
              "40Man",
              "fullSeason"
            ],
            "type": "string",
            "description": "Active (26-man), 40-man, or everyone who played for the team that season. For past seasons the API returns the full-season roster; each record says which roster was returned.",
            "default": "active"
          },
          "startDate": {
            "title": "Start date",
            "type": "string",
            "description": "First game date (YYYY-MM-DD) for Schedules and Game details. Overrides Seasons in Schedules mode."
          },
          "endDate": {
            "title": "End date",
            "type": "string",
            "description": "Last game date (YYYY-MM-DD). Up to 366 days after the start date (31 days for Game details). Defaults to the start date."
          },
          "gameIds": {
            "title": "Game IDs",
            "type": "array",
            "description": "MLB game IDs (gamePk), e.g. 776440, for Game details. When given, the date range is ignored.",
            "items": {
              "type": "string"
            }
          },
          "gameTypes": {
            "title": "Game types",
            "type": "array",
            "description": "Limit Schedules and Game details to these game types. Leave empty for all games, including the postseason.",
            "items": {
              "type": "string",
              "enum": [
                "R",
                "F",
                "D",
                "L",
                "W",
                "S",
                "A",
                "E"
              ],
              "enumTitles": [
                "Regular season",
                "Wild Card",
                "Division Series",
                "League Championship Series",
                "World Series",
                "Spring training",
                "All-Star game",
                "Exhibition"
              ]
            }
          },
          "gameStatus": {
            "title": "Game status",
            "enum": [
              "all",
              "completed",
              "upcoming"
            ],
            "type": "string",
            "description": "All games, only completed games, or only games that have not started.",
            "default": "all"
          },
          "maxResults": {
            "title": "Maximum results",
            "minimum": 1,
            "maximum": 5000,
            "type": "integer",
            "description": "Stop after this many records (max 5000; Game details max 250).",
            "default": 100
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}