{
  "openapi": "3.0.1",
  "info": {
    "title": "MLB Stats Scraper — Teams, Players, Games, Standings & Leaders",
    "description": "MLB scraper on the official Stats API — teams, full rosters with player bios, schedules and results, live standings, season hitting/pitching/fielding stats, game box scores and league leaders. Multi-season in one run, flat rows for CSV. No key, no proxies, from $0.004 per row.",
    "version": "0.0",
    "x-build-id": "iDn8Svaw78OeCmWWz"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/memo23~mlb-stats-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-memo23-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/memo23~mlb-stats-scraper/runs": {
      "post": {
        "operationId": "runs-sync-memo23-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/memo23~mlb-stats-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-memo23-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 scrape",
            "enum": [
              "teams",
              "players",
              "schedule",
              "standings",
              "playerStats",
              "gameDetails",
              "leaders"
            ],
            "type": "string",
            "description": "Which dataset to pull. Teams = all 30 clubs. Players = full rosters with bios. Schedule = games and results. Standings = division tables. Player stats = season hitting/pitching/fielding lines. Game details = box-score totals per team. Leaders = league leaderboards by category.",
            "default": "teams"
          },
          "seasons": {
            "title": "Seasons",
            "type": "array",
            "description": "One or more seasons to pull, e.g. [2026] or [2024, 2025, 2026]. Defaults to the current season. Historical data goes back to 1876.",
            "items": {
              "type": "string"
            }
          },
          "teamIds": {
            "title": "Team IDs (optional)",
            "type": "array",
            "description": "Limit to specific teams by MLB team id, e.g. 119 (Dodgers), 147 (Yankees), 111 (Red Sox). Leave empty for all 30 teams. Run the Teams mode once to get every id.",
            "items": {
              "type": "string"
            }
          },
          "playerIds": {
            "title": "Player IDs (optional)",
            "type": "array",
            "description": "Player stats mode: pull only these players by MLB person id (e.g. 660271 for Shohei Ohtani). Leave empty to use the rosters of the selected teams.",
            "items": {
              "type": "string"
            }
          },
          "gamePks": {
            "title": "Game IDs (optional)",
            "type": "array",
            "description": "Game details mode: pull only these games by gamePk. Leave empty to use the schedule for the chosen date, range or season.",
            "items": {
              "type": "string"
            }
          },
          "date": {
            "title": "Single date",
            "type": "string",
            "description": "Schedule / game details for one day, in YYYY-MM-DD format, e.g. 2026-08-03."
          },
          "fromDate": {
            "title": "From date",
            "type": "string",
            "description": "Start of a date range (YYYY-MM-DD). Use together with To date."
          },
          "toDate": {
            "title": "To date",
            "type": "string",
            "description": "End of a date range (YYYY-MM-DD). Use together with From date."
          },
          "leagueId": {
            "title": "League",
            "enum": [
              "both",
              "AL",
              "NL"
            ],
            "type": "string",
            "description": "Standings mode: restrict to the American or National League.",
            "default": "both"
          },
          "statGroup": {
            "title": "Stat group",
            "enum": [
              "hitting",
              "pitching",
              "fielding"
            ],
            "type": "string",
            "description": "Which statistics to return in Player stats and Leaders modes.",
            "default": "hitting"
          },
          "gameType": {
            "title": "Game type",
            "enum": [
              "R",
              "S",
              "P",
              "W",
              "L",
              "A"
            ],
            "type": "string",
            "description": "Which games to include in Schedule and Game details modes.",
            "default": "R"
          },
          "leaderCategories": {
            "title": "Leader categories",
            "type": "array",
            "description": "Leaders mode: which leaderboards to pull, e.g. homeRuns, battingAverage, runsBattedIn, stolenBases, strikeouts, earnedRunAverage, wins, saves.",
            "items": {
              "type": "string"
            }
          },
          "maxItems": {
            "title": "Maximum results",
            "minimum": 1,
            "type": "integer",
            "description": "Hard cap on how many rows the run returns (and is charged for).",
            "default": 1000
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}