{
  "openapi": "3.0.1",
  "info": {
    "title": "MLB Stats Scraper & Stat Change Monitor - Hitting, Pitching",
    "description": "For fantasy baseball, betting models and analytics: season hitting, pitching and fielding from the official MLB Stats API - 4,223 stat lines for 2026 (732 hitting, 848 pitching, 2,643 fielding). Innings pitched are handled as thirds, not decimals. Monitoring returns only lines that changed.",
    "version": "0.1",
    "x-build-id": "LvikVdtwmZVUSNmKl"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/neverempty~mlb-stats-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-neverempty-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/neverempty~mlb-stats-scraper/runs": {
      "post": {
        "operationId": "runs-sync-neverempty-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/neverempty~mlb-stats-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-neverempty-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": {
          "statGroups": {
            "title": "Stat groups",
            "type": "array",
            "description": "Which stat groups to read. The MLB API answers HTTP 200 with an empty stats array for a group it does not know, which looks exactly like 'this player has no stats', so only these three are accepted.",
            "items": {
              "type": "string",
              "enum": [
                "hitting",
                "pitching",
                "fielding"
              ],
              "enumTitles": [
                "Hitting",
                "Pitching",
                "Fielding"
              ]
            },
            "default": [
              "hitting"
            ]
          },
          "season": {
            "title": "Season (year)",
            "minimum": 1876,
            "maximum": 2100,
            "type": "integer",
            "description": "Which season to read. Seasons that have not been played return zero rows, which is the API's own honest answer and is reported as such rather than as a failure.",
            "default": 2026
          },
          "playerPool": {
            "title": "Player pool",
            "enum": [
              "ALL",
              "QUALIFIED",
              "ROOKIES",
              "QUALIFIED_ROOKIES"
            ],
            "type": "string",
            "description": "Which players are included. This changes the result a lot: for 2026 hitting the API returned 732 players for ALL but only 140 for QUALIFIED (players who reached the required plate appearances).",
            "default": "ALL"
          },
          "maxPlayers": {
            "title": "Maximum stat lines to return",
            "minimum": 1,
            "maximum": 5000,
            "type": "integer",
            "description": "How many rows to return. One row is one player in one stat group. You are charged for the rows you actually receive. For reference, 2026 held 732 hitting, 848 pitching and 2,643 fielding lines.",
            "default": 200
          },
          "monitoringMode": {
            "title": "Monitoring mode: return only lines that changed",
            "type": "boolean",
            "description": "Off = return every line for the groups you picked. On = remember the exact numbers already returned and, on later runs, return a player's line again only when one of their stats has actually moved. Run it daily during the season and pay only for the players who played.",
            "default": false
          },
          "resetMonitoringState": {
            "title": "Forget what was already returned",
            "type": "boolean",
            "description": "Clear the remembered lines before this run, so everything counts as new again.",
            "default": false
          },
          "teams": {
            "title": "Only these teams",
            "type": "array",
            "description": "Keep a line only if the team name contains one of these (case-insensitive, partial). Example: Yankees, Dodgers.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "players": {
            "title": "Only these players",
            "type": "array",
            "description": "Keep a line only if the player's full name contains one of these (case-insensitive, partial). Example: Ohtani, Judge.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "positions": {
            "title": "Only these positions",
            "type": "array",
            "description": "Keep a line only if the position or its abbreviation contains one of these (case-insensitive, partial). Example: Pitcher, P, Catcher, C.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "leagues": {
            "title": "Only these leagues",
            "type": "array",
            "description": "Keep a line only if the league name contains one of these. Example: American League, National League.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "minGamesPlayed": {
            "title": "Minimum games played",
            "minimum": 0,
            "maximum": 200,
            "type": "integer",
            "description": "Keep a line only if the player appeared in at least this many games. 0 = no limit. Lines with no games-played figure are kept, because unknown is not the same as zero.",
            "default": 0
          },
          "maxRank": {
            "title": "Only the top N by the API's own rank",
            "minimum": 0,
            "maximum": 5000,
            "type": "integer",
            "description": "The API assigns each line a rank within the group. 0 = no limit. Lines with no rank are kept.",
            "default": 0
          },
          "keywords": {
            "title": "Keywords",
            "type": "array",
            "description": "Keep a line only if one (Any) or all (All) of these appear in the player, team, position, league or group name.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "keywordMatch": {
            "title": "Keyword match",
            "enum": [
              "any",
              "all"
            ],
            "type": "string",
            "description": "Any = at least one keyword. All = every keyword.",
            "default": "any"
          },
          "excludeKeywords": {
            "title": "Exclude keywords",
            "type": "array",
            "description": "Drop a line if any of these appear in the same fields.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "useProxy": {
            "title": "Use an Apify proxy",
            "type": "boolean",
            "description": "Off by default: the official MLB Stats API answered 200 from a plain Apify datacentre address when this Actor was built (2026-09-06). If it starts answering 403, 429 or 503, the Actor switches to a proxy session on its own and tries again.",
            "default": false
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}