{
  "openapi": "3.0.1",
  "info": {
    "title": "Sports Reference Stats Scraper - NBA & NHL",
    "description": "Scrape NBA player and team stats from Basketball-Reference and NHL stats from Hockey-Reference: per-season stats, advanced metrics (PER, win shares, BPM), team rosters and salaries. One row per season, 23 seasons for LeBron James in one page. Export CSV, Excel, JSON. No login or API key.",
    "version": "0.1",
    "x-build-id": "s8D0YuTHx5QUOUaCj"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/recordsdata~sports-reference-stats-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-recordsdata-sports-reference-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/recordsdata~sports-reference-stats-scraper/runs": {
      "post": {
        "operationId": "runs-sync-recordsdata-sports-reference-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/recordsdata~sports-reference-stats-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-recordsdata-sports-reference-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": {
          "mode": {
            "title": "What do you want to do?",
            "enum": [
              "urls",
              "season",
              "index"
            ],
            "type": "string",
            "description": "Start URLs: stats from player, team, season or letter pages you paste. Whole league season: every player of one NBA or NHL season. Player index: the players-by-letter list of one sport (name, id, years active).",
            "default": "urls"
          },
          "startUrls": {
            "title": "Page links (player, team, season or letter)",
            "type": "array",
            "description": "Examples: a player /players/j/jamesle01.html, a team season /teams/WSH/2024.html, a league table /leagues/NBA_2025_per_game.html or /leagues/NHL_2025_skaters.html, a letter index /players/a/. Prefilled with LeBron James.",
            "default": [
              {
                "url": "https://www.basketball-reference.com/players/j/jamesle01.html"
              }
            ],
            "items": {
              "type": "object",
              "required": [
                "url"
              ],
              "properties": {
                "url": {
                  "type": "string",
                  "title": "URL of a web page",
                  "format": "uri"
                }
              }
            }
          },
          "sport": {
            "title": "Sport",
            "enum": [
              "basketball",
              "hockey"
            ],
            "type": "string",
            "description": "Basketball = NBA (basketball-reference.com), hockey = NHL (hockey-reference.com). Default: basketball.",
            "default": "basketball"
          },
          "season": {
            "title": "Season (ending year, Whole league season mode)",
            "minimum": 1918,
            "maximum": 2100,
            "type": "integer",
            "description": "The year the season ends: 2025 means season 2024-25. Basketball from 1947, hockey from 1918. Default 2025.",
            "default": 2025
          },
          "statType": {
            "title": "Season table (Whole league season mode)",
            "enum": [
              "standard",
              "totals",
              "advanced"
            ],
            "type": "string",
            "description": "Standard: per-game stats (basketball) or season stats (hockey). Totals: season totals, basketball only. Advanced: PER, win shares and BPM for basketball; Corsi, Fenwick, PDO and zone starts for hockey skaters.",
            "default": "standard"
          },
          "playerType": {
            "title": "Hockey: skaters or goalies",
            "enum": [
              "skaters",
              "goalies"
            ],
            "type": "string",
            "description": "Hockey only. In Whole league season mode it picks the league table; on team pages it picks which stat table is read. Default: skaters.",
            "default": "skaters"
          },
          "letter": {
            "title": "Last-name letter (Player index mode)",
            "maxLength": 1,
            "type": "string",
            "description": "One letter, a to z: players whose last name starts with it, for example a. Default a.",
            "default": "a"
          },
          "maxItems": {
            "title": "Max rows",
            "minimum": 1,
            "maximum": 1000000,
            "type": "integer",
            "description": "Maximum number of main rows (player-season rows, league-table rows or index rows). Free plan: capped at 10 rows per run. Paid plans: up to 1,000,000. Prefilled with 10. Extra rows from the options below are not counted here."
          },
          "includeBio": {
            "title": "Add bio and draft details (free)",
            "type": "boolean",
            "description": "Adds the bio block of a player page to every row of that player: full name, positions, height and weight in cm and kg, birth date and place, college, draft round, pick and year, debut. No extra charge and no extra request.",
            "default": false
          },
          "numericValues": {
            "title": "Return stats as numbers",
            "type": "boolean",
            "description": "Return stat values as numbers (0.512, 27.1) instead of text ('.512', '27.1'). Ids, names, positions, seasons and dates stay text. Off by default so existing integrations keep working.",
            "default": false
          },
          "includePlayoffs": {
            "title": "Add playoff stats",
            "type": "boolean",
            "description": "Adds the playoff table of each page as extra rows (and playoff advanced rows if Advanced stats is on). Works on player, team and league-season pages. Billed per extra row.",
            "default": false
          },
          "includeCareer": {
            "title": "Add career totals",
            "type": "boolean",
            "description": "Adds the career total rows of a player page: all-seasons, per-team and per-league rows, with seasons played. Billed per extra row.",
            "default": false
          },
          "includeAdvanced": {
            "title": "Add advanced stats per season",
            "type": "boolean",
            "description": "Adds advanced metrics rows per season: PER, win shares and BPM (basketball); rate and plus-minus stats (hockey). Billed per extra row.",
            "default": false
          },
          "includeCorsiFenwick": {
            "title": "Add Corsi and Fenwick (hockey only)",
            "type": "boolean",
            "description": "Adds hockey possession rows per season: Corsi for and against, CF%, Fenwick, PDO and zone starts. Hockey skater and team pages only. Billed like advanced stats.",
            "default": false
          },
          "includeRoster": {
            "title": "Add team roster (team links only)",
            "type": "boolean",
            "description": "Adds the full roster of a team-season page, one row per player. Only applies to team links. Billed per extra row.",
            "default": false
          },
          "includeSalaries": {
            "title": "Add salary history (basketball only)",
            "type": "boolean",
            "description": "Adds salary rows per season where published. Basketball-reference only. Billed per extra row.",
            "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
                  },
                  "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}