{
  "openapi": "3.0.1",
  "info": {
    "title": "OddsPortal, ESPN, Sofascore & FBref Sports Odds Scraper",
    "description": "Extract flat, analytics-ready sports matches, lineups, team & player stats, and pre-match or historical bookmaker odds (1X2, Moneyline, Over/Under) from OddsPortal, ESPN API, Football-Data, Sofascore, and FBref. Clean JSON/CSV/Parquet output ready for pandas, R & quant models.",
    "version": "1.0",
    "x-build-id": "4xmlKLTKCYXktr0e4"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/vesper_studio~sports-stats-odds-extractor/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-vesper_studio-sports-stats-odds-extractor",
        "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/vesper_studio~sports-stats-odds-extractor/runs": {
      "post": {
        "operationId": "runs-sync-vesper_studio-sports-stats-odds-extractor",
        "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/vesper_studio~sports-stats-odds-extractor/run-sync": {
      "post": {
        "operationId": "run-sync-vesper_studio-sports-stats-odds-extractor",
        "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": {
          "source": {
            "title": "Data Source Mode",
            "enum": [
              "oddsportal",
              "espn",
              "football_data",
              "sofascore",
              "fbref"
            ],
            "type": "string",
            "description": "Select extraction backend. 'oddsportal' (upcoming & historical multi-bookmaker odds, 200 OK without proxy), 'espn' (JSON API for fixtures, lineups, player/team stats, and open/close odds, 200 OK without proxy), 'football_data' (historical match stats + multi-bookmaker CSV odds, 200 OK without proxy), 'sofascore' (Sofascore API JSON; may require residential proxy if 403 challenge), 'fbref' (FBref HTML + commented tables with 3.5-6s rate limit; may require residential proxy if 403 Cloudflare challenge).",
            "default": "oddsportal"
          },
          "sport": {
            "title": "Sport",
            "enum": [
              "football",
              "basketball",
              "hockey",
              "american-football",
              "baseball",
              "tennis"
            ],
            "type": "string",
            "description": "Target sport discipline.",
            "default": "football"
          },
          "leagueOrUrl": {
            "title": "League Slug or Direct URL",
            "type": "string",
            "description": "League preset/slug (e.g., 'england/premier-league', 'spain/laliga', 'italy/serie-a', 'germany/bundesliga', 'france/ligue-1', 'europe/champions-league', 'usa/nba', 'usa/nhl', 'usa/nfl', 'eng.1', 'E0', 'today') OR a full source URL (e.g., 'https://www.oddsportal.com/football/england/premier-league/' or 'https://fbref.com/en/comps/9/Premier-League-Stats').",
            "default": "england/premier-league"
          },
          "dateFrom": {
            "title": "Date From (YYYY-MM-DD)",
            "pattern": "^(\\d{4}-\\d{2}-\\d{2})?$",
            "type": "string",
            "description": "Optional inclusive start date filter (YYYY-MM-DD)."
          },
          "dateTo": {
            "title": "Date To (YYYY-MM-DD)",
            "pattern": "^(\\d{4}-\\d{2}-\\d{2})?$",
            "type": "string",
            "description": "Optional inclusive end date filter (YYYY-MM-DD)."
          },
          "season": {
            "title": "Season Code (optional)",
            "type": "string",
            "description": "Optional season code for Football-Data.co.uk (e.g. '2526', '2425') or FBref URLs."
          },
          "oddsPortalMarketType": {
            "title": "OddsPortal Fixture Scope",
            "enum": [
              "both",
              "upcoming",
              "results"
            ],
            "type": "string",
            "description": "For 'oddsportal': fetch 'upcoming' pre-match odds, 'results' historical closing odds, or 'both'.",
            "default": "both"
          },
          "maxMatches": {
            "title": "Max Matches",
            "minimum": 1,
            "maximum": 5000,
            "type": "integer",
            "description": "Maximum number of matches (or FBref table rows cap multiplier) to extract.",
            "default": 50
          },
          "includeLineups": {
            "title": "Include Lineups & Player Rows",
            "type": "boolean",
            "description": "Extract starting lineups, bench/substitutions, and per-player match statistics when supported by the source.",
            "default": true
          },
          "includeStats": {
            "title": "Include Team & Match Statistics",
            "type": "boolean",
            "description": "Extract team-level match statistics (shots, possession, fouls, corners, rebounds, etc.).",
            "default": true
          },
          "includeOdds": {
            "title": "Include Pre-Match / Historical Odds",
            "type": "boolean",
            "description": "Extract bookmaker-level odds rows (1X2, Moneyline, Spread, Over/Under, implied probabilities, overround).",
            "default": true
          },
          "requestDelayMs": {
            "title": "Minimum Request Delay (ms)",
            "minimum": 100,
            "maximum": 15000,
            "type": "integer",
            "description": "Minimum adaptive delay between requests to the same domain in milliseconds. Automatically raised to >= 3500 ms for fbref.com to respect Sports-Reference strict 429 limits.",
            "default": 250
          },
          "concurrency": {
            "title": "HTTP Concurrency",
            "minimum": 1,
            "maximum": 12,
            "type": "integer",
            "description": "Maximum concurrent HTTP requests (per-domain rate limiter still serializes bursts).",
            "default": 4
          },
          "requestTimeoutSeconds": {
            "title": "HTTP Timeout (seconds)",
            "minimum": 5,
            "maximum": 60,
            "type": "integer",
            "description": "Per-request timeout in seconds.",
            "default": 20
          },
          "maxTotalChargeUsd": {
            "title": "Max Total Charge USD (safety guard)",
            "minimum": 0,
            "type": "number",
            "description": "Optional hard USD spending cap enforced alongside Apify Pay-Per-Event pricing limits."
          },
          "proxyConfiguration": {
            "title": "Proxy Configuration (optional)",
            "type": "object",
            "description": "Optional proxy settings. Zero proxy by default — OddsPortal, ESPN API, and Football-Data.co.uk work directly with curl_cffi TLS impersonation. Use Apify Residential proxies if querying Sofascore/FBref or if your datacenter IP receives a 403.",
            "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
                  },
                  "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}