{
  "openapi": "3.0.1",
  "info": {
    "title": "MLB Stats Scraper — Standings, Box Scores, Statcast & Players",
    "description": "Fetch MLB baseball data in bulk: standings, league leaders, season stats, box scores, pitch-by-pitch Statcast, teams, rosters, schedules and player profiles. Clean rows for fantasy tools, betting models, dashboards and n8n.",
    "version": "1.0",
    "x-build-id": "vTRVh6G48HOxrbheq"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/hipersoft~mlb-statsapi-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-hipersoft-mlb-statsapi-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/hipersoft~mlb-statsapi-scraper/runs": {
      "post": {
        "operationId": "runs-sync-hipersoft-mlb-statsapi-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/hipersoft~mlb-statsapi-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-hipersoft-mlb-statsapi-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": "Mode",
            "enum": [
              "teams",
              "roster",
              "schedule",
              "player",
              "standings",
              "leaders",
              "stats",
              "boxscore",
              "statcast"
            ],
            "type": "string",
            "description": "What to fetch: teams, roster, schedule, player, standings (division and league tables), leaders (top players by category), stats (season hitting, pitching or fielding for all players, a team or one player), boxscore (player lines for a game) or statcast (pitch-by-pitch data with velocity, spin and exit speed).",
            "default": "teams"
          },
          "season": {
            "title": "Season (year)",
            "type": "integer",
            "description": "Four-digit year used by teams, roster, standings, leaders and stats (e.g. 2025). Defaults to the current year when left empty."
          },
          "teamId": {
            "title": "Team ID",
            "type": "integer",
            "description": "Numeric MLB team id used by the roster and stats modes (e.g. 147 for the New York Yankees). Run the teams mode first to look ids up."
          },
          "date": {
            "title": "Schedule date (YYYY-MM-DD)",
            "type": "string",
            "description": "Single date for the schedule and statcast modes, e.g. 2025-07-04. In schedule, ignored if Start date and End date are both set."
          },
          "startDate": {
            "title": "Schedule start date (YYYY-MM-DD)",
            "type": "string",
            "description": "Start of a date range for the schedule and statcast modes, e.g. 2025-07-01."
          },
          "endDate": {
            "title": "Schedule end date (YYYY-MM-DD)",
            "type": "string",
            "description": "End of a date range for the schedule and statcast modes, e.g. 2025-07-07."
          },
          "playerId": {
            "title": "Player ID",
            "type": "integer",
            "description": "Numeric MLB player id for the player, stats and statcast modes (e.g. 545361 for Mike Trout). Find ids via the roster mode."
          },
          "playerName": {
            "title": "Player name",
            "type": "string",
            "description": "Player name to search in the player mode when you do not have the id (e.g. \"Mike Trout\"). Ignored if Player ID is set."
          },
          "statGroup": {
            "title": "Stat group",
            "enum": [
              "hitting",
              "pitching",
              "fielding"
            ],
            "type": "string",
            "description": "Stats mode: which numbers to return, hitting if left empty. Leaders mode: limits results to this group; left empty, a category shared by several groups (such as strikeouts) returns each group."
          },
          "leaderCategories": {
            "title": "Leader categories",
            "type": "array",
            "description": "Categories for the leaders mode, e.g. homeRuns, battingAverage, runsBattedIn, earnedRunAverage, strikeouts.",
            "items": {
              "type": "string"
            }
          },
          "gamePks": {
            "title": "Game IDs",
            "type": "array",
            "description": "Game ids for the boxscore mode. The schedule mode returns them as gamePk.",
            "items": {
              "type": "string"
            }
          },
          "statcastPlayerType": {
            "title": "Statcast player type",
            "enum": [
              "pitcher",
              "batter"
            ],
            "type": "string",
            "description": "Whether a Player ID in the statcast mode means the pitcher or the batter.",
            "default": "pitcher"
          },
          "maxItems": {
            "title": "Maximum rows",
            "minimum": 1,
            "type": "integer",
            "description": "Most rows to return. In leaders, also the most per category and group, up to 100. When left empty, stats, boxscore and statcast stop at 1,000 rows and other modes return everything. A single day of Statcast is usually several thousand pitches, and each row is billed."
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}