{
  "openapi": "3.0.1",
  "info": {
    "title": "Mlb Stats Scraper",
    "description": "Get official MLB player stats, team rosters, schedules, standings and league leaders. Search by player or team name, no need for internal IDs. No login. Built for fantasy baseball players, bettors, analysts and journalists who need clean, accurate baseball data fast.",
    "version": "1.0",
    "x-build-id": "bFS6Gs0ubIAbvCPFO"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/fabri.ce~mlb-stats-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-fabri.ce-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/fabri.ce~mlb-stats-scraper/runs": {
      "post": {
        "operationId": "runs-sync-fabri.ce-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/fabri.ce~mlb-stats-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-fabri.ce-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",
        "required": [
          "mode"
        ],
        "properties": {
          "mode": {
            "title": "Type of data",
            "enum": [
              "players",
              "teams",
              "schedule",
              "standings",
              "leaders"
            ],
            "type": "string",
            "description": "**Player profiles**: bio and season (or career) stats for one or more named players.\n**Teams**: team info, optionally with the full current roster.\n**Schedule**: games by date, date range, or team, with final scores.\n**Standings**: current division standings.\n**League leaders**: the top players in any stat category (home runs, ERA, batting average, etc).\n\n_On the Apify **Free** plan every run is limited to a fixed 10-row sample; upgrade to run your own settings._"
          },
          "playerNames": {
            "title": "Player names (for Player profiles)",
            "type": "array",
            "description": "One or more player names, e.g. `Aaron Judge`. Matched by name against the official record. No need to know internal player IDs.",
            "items": {
              "type": "string"
            }
          },
          "playerIds": {
            "title": "...or player IDs (for Player profiles)",
            "type": "array",
            "description": "Already know the numeric player ID (e.g. from a previous run)? List them here. Can be combined with the names above.",
            "items": {
              "type": "string"
            }
          },
          "teamNames": {
            "title": "Team names (for Teams, Schedule)",
            "type": "array",
            "description": "One or more team names, e.g. `Yankees` or `New York Yankees`. Leave empty in Teams mode to get all 30 teams. In Schedule mode, filters games to one team.",
            "items": {
              "type": "string"
            }
          },
          "teamIds": {
            "title": "...or team IDs (for Teams, Schedule)",
            "type": "array",
            "description": "Already know the numeric team ID? List them here. Can be combined with the names above.",
            "items": {
              "type": "string"
            }
          },
          "date": {
            "title": "Date (for Schedule)",
            "type": "string",
            "description": "Games on this single date. Format: `YYYY-MM-DD`."
          },
          "fromDate": {
            "title": "From date (for Schedule)",
            "type": "string",
            "description": "Start of a date range. Format: `YYYY-MM-DD`."
          },
          "toDate": {
            "title": "To date (for Schedule)",
            "type": "string",
            "description": "End of a date range. Format: `YYYY-MM-DD`."
          },
          "league": {
            "title": "League (for Standings)",
            "enum": [
              "both",
              "AL",
              "NL"
            ],
            "type": "string",
            "description": "Which league's standings to get."
          },
          "leaderCategory": {
            "title": "Stat category (for League leaders)",
            "type": "string",
            "description": "The stat to rank by. Common ones: `homeRuns`, `avg`, `rbi`, `stolenBases`, `era`, `strikeouts`, `wins`, `saves`, `obp`, `slg`, `ops`, `whip`."
          },
          "season": {
            "title": "Season, year (for all modes except Schedule)",
            "minimum": 1876,
            "type": "integer",
            "description": "MLB season year, e.g. `2025`. Leave empty for the current season."
          },
          "maxItems": {
            "title": "Maximum rows",
            "minimum": 1,
            "type": "integer",
            "description": "Stop once this many rows are in the dataset. Leave empty to get everything. _(Free plan: always capped at 10.)_"
          },
          "statGroup": {
            "title": "Stat type (for Player profiles)",
            "enum": [
              "auto",
              "hitting",
              "pitching",
              "fielding"
            ],
            "type": "string",
            "description": "**Auto**: hitting stats for position players, pitching stats for pitchers (recommended). Or force one specific group for every player."
          },
          "statType": {
            "title": "Season or career totals (for Player profiles)",
            "enum": [
              "season",
              "career"
            ],
            "type": "string",
            "description": "**Season**: stats for one season (see \"Season\" above, or the current season). **Career**: lifetime totals."
          },
          "includeRoster": {
            "title": "Full current roster (for Teams)",
            "type": "boolean",
            "description": "Attach every player currently on the roster (name, position, jersey number) to each team's row."
          },
          "includeBoxScore": {
            "title": "Box score details (for Schedule)",
            "type": "boolean",
            "description": "Add the inning-by-inning line score, team hits/errors, and the winning/losing/save pitcher to each game. One extra lookup per game, so it's off by default for large date ranges. Turn it on for a handful of games."
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}