{
  "openapi": "3.0.1",
  "info": {
    "title": "Baseball Savant Scraper: Scheduled Statcast Data",
    "description": "Extract MLB Statcast pitch data (velocity, spin rate, launch angle, exit velocity) and player-season leaderboards (xBA, xwOBA, barrel%) from Baseball Savant. The only Statcast actor with scheduled incremental sync, pulling only games since last run. No pybaseball timeouts or manual CSV exports.",
    "version": "0.1",
    "x-build-id": "jKY6tLZJ5pWbA1bkn"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/getascraper~baseball-savant-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-getascraper-baseball-savant-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/getascraper~baseball-savant-scraper/runs": {
      "post": {
        "operationId": "runs-sync-getascraper-baseball-savant-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/getascraper~baseball-savant-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-getascraper-baseball-savant-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": {
          "runMode": {
            "title": "Run mode",
            "enum": [
              "dateRange",
              "incremental"
            ],
            "type": "string",
            "description": "Incremental mode is designed for Apify Schedules: each run automatically picks up where the previous successful run left off, so you never re-pull the same games twice.",
            "default": "dateRange"
          },
          "startDate": {
            "title": "Start date",
            "type": "string",
            "description": "First game date to include (YYYY-MM-DD). Ignored when Run mode is Incremental.",
            "default": ""
          },
          "endDate": {
            "title": "End date",
            "type": "string",
            "description": "Last game date to include (YYYY-MM-DD). Ignored when Run mode is Incremental (incremental mode always pulls through yesterday, since today's games may still be in progress).",
            "default": ""
          },
          "lookbackDays": {
            "title": "First-run lookback (days)",
            "minimum": 1,
            "maximum": 30,
            "type": "integer",
            "description": "Only used the very first time Incremental mode runs (no saved sync state yet). How many days back from today to start pulling.",
            "default": 3
          },
          "playerType": {
            "title": "Player perspective",
            "enum": [
              "pitcher",
              "batter"
            ],
            "type": "string",
            "description": "Statcast search perspective. Both return the same pitch events, just filterable from either side.",
            "default": "pitcher"
          },
          "team": {
            "title": "Team (optional)",
            "type": "string",
            "description": "Optional 3-letter MLB team abbreviation (e.g. NYY, LAD, BOS) to restrict results to games involving this team. Leave blank for all teams.",
            "default": ""
          },
          "outputMode": {
            "title": "Output mode",
            "enum": [
              "pitchDetails",
              "leaderboard",
              "both"
            ],
            "type": "string",
            "description": "Pitch-level detail is the full 100+ column Statcast export per pitch. Leaderboard is aggregated player-season expected-stats (xBA, xwOBA, barrel%).",
            "default": "pitchDetails"
          },
          "leaderboardYear": {
            "title": "Leaderboard season year",
            "minimum": 2015,
            "maximum": 2030,
            "type": "integer",
            "description": "MLB season year for the leaderboard pull (e.g. 2026).",
            "default": 2026
          },
          "leaderboardType": {
            "title": "Leaderboard type",
            "enum": [
              "batter",
              "pitcher"
            ],
            "type": "string",
            "description": "Whether the leaderboard covers batters or pitchers.",
            "default": "batter"
          },
          "leaderboardMinPa": {
            "title": "Minimum qualifier (PA or IP)",
            "minimum": 0,
            "type": "integer",
            "description": "Minimum plate appearances (batter) or innings pitched (pitcher) threshold for the leaderboard, matching Baseball Savant's own qualifier filter.",
            "default": 50
          },
          "chunkDays": {
            "title": "Date-chunk size (days)",
            "minimum": 1,
            "maximum": 14,
            "type": "integer",
            "description": "Number of days pulled per individual request to /statcast_search/csv. Smaller chunks are safer for wide ranges; MLB season runs late March through October.",
            "default": 3
          },
          "maxItems": {
            "title": "Max items",
            "minimum": 0,
            "type": "integer",
            "description": "Maximum number of dataset records to push across the whole run (0 = unlimited). If the limit is hit mid-range, the incremental sync cursor still only advances through the last fully-completed date chunk, so the next run resumes cleanly.",
            "default": 5000
          },
          "proxyConfiguration": {
            "title": "Proxy configuration",
            "type": "object",
            "description": "Off by default. Baseball Savant's CSV/JSON export endpoints are fully open (no anti-bot challenge, no IP-reputation gating observed) and confirmed to time out when routed through Apify's datacenter proxy pool, so a direct connection is both faster and more reliable. Only enable if you see blocks at high volume.",
            "default": {
              "useApifyProxy": 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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}