{
  "openapi": "3.0.1",
  "info": {
    "title": "Chess Opponent Analyzer",
    "description": "Analyzes a chess player's game history and opening repertoire from Lichess, Chess.com, or official tournaments. Extracts ECO statistics, opening trees, performance metrics, recent trends, and surprise detections. Export to PGN or JSON.",
    "version": "0.1",
    "x-build-id": "LRDHJEFAMMIudxwyv"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/trovevault~chess-opponent-analyzer/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-trovevault-chess-opponent-analyzer",
        "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/trovevault~chess-opponent-analyzer/runs": {
      "post": {
        "operationId": "runs-sync-trovevault-chess-opponent-analyzer",
        "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/trovevault~chess-opponent-analyzer/run-sync": {
      "post": {
        "operationId": "run-sync-trovevault-chess-opponent-analyzer",
        "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": {
          "players": {
            "title": "Players (multi-player mode)",
            "type": "array",
            "description": "Array of player objects for analyzing multiple opponents in a single run. Each object can have: lichessUsername, chesscomUsername, and platform (optional, overrides the global Platform setting). When this field is set, the individual lichessUsername and chesscomUsername fields are ignored. Each player produces one row per opening in the dataset. Example: [{\"lichessUsername\": \"nihalsarin\", \"platform\": \"lichess\"}, {\"chesscomUsername\": \"Hikaru\", \"platform\": \"chesscom\"}]"
          },
          "lichessUsername": {
            "title": "Lichess Username",
            "type": "string",
            "description": "The Lichess username of the player to analyze. The actor fetches all available rated games for this player and builds a full opening repertoire analysis. Example: 'DrNykterstein' (Magnus Carlsen) or 'nihalsarin' (Nihal Sarin). Case-insensitive. Required when platform is 'lichess' or 'all'."
          },
          "chesscomUsername": {
            "title": "Chess.com Username",
            "type": "string",
            "description": "The Chess.com username of the player to analyze. The actor fetches games from the Chess.com public API. Example: 'MagnusCarlsen' or 'Hikaru'. Required when platform is 'chesscom' or 'all'. Chess.com usernames are case-insensitive."
          },
          "platform": {
            "title": "Platform",
            "enum": [
              "lichess",
              "chesscom",
              "all"
            ],
            "type": "string",
            "description": "Which platform(s) to fetch games from. 'lichess' uses the free Lichess API (no token required). 'chesscom' uses the public Chess.com API. 'all' fetches from both and merges results. Recommendation: start with 'lichess' -- it has the best API and includes many official events.",
            "default": "lichess"
          },
          "dateFrom": {
            "title": "Date From",
            "type": "string",
            "description": "Start of the date range to fetch games from, in ISO format (YYYY-MM-DD). Example: '2024-01-01'. Leave empty to fetch from the beginning of the player's history. Combine with dateTo to focus on a specific tournament preparation window, e.g. last 6 months."
          },
          "dateTo": {
            "title": "Date To",
            "type": "string",
            "description": "End of the date range to fetch games from, in ISO format (YYYY-MM-DD). Example: '2024-12-31'. Leave empty to fetch up to today. Useful for studying a player's form before a specific event."
          },
          "timeControls": {
            "title": "Time Controls",
            "type": "array",
            "description": "Which time controls to include. Select multiple to compare repertoire differences across speeds. Recommendation: use 'classical' or 'rapid' for serious tournament preparation -- blitz/bullet repertoires often differ significantly from classical play.",
            "items": {
              "type": "string",
              "enum": [
                "all",
                "classical",
                "rapid",
                "blitz",
                "bullet"
              ],
              "enumTitles": [
                "All time controls",
                "Classical (60+ min)",
                "Rapid (10-60 min)",
                "Blitz (3-10 min)",
                "Bullet (<3 min)"
              ]
            },
            "default": [
              "all"
            ]
          },
          "rated": {
            "title": "Game Type",
            "enum": [
              "rated",
              "casual",
              "all"
            ],
            "type": "string",
            "description": "Whether to include rated games, casual games, or both. Recommendation: use 'rated' -- rated games reflect a player's real preparation and effort. Casual games may include experiments or intentional losses.",
            "default": "rated"
          },
          "color": {
            "title": "Color",
            "enum": [
              "both",
              "white",
              "black"
            ],
            "type": "string",
            "description": "Whether to analyze games where the target player had white, black, or both colors. Use 'both' for a full repertoire overview. Use 'white' or 'black' to study a specific color in depth -- e.g. to answer 'what does he play against 1.e4?'",
            "default": "both"
          },
          "minOpponentRating": {
            "title": "Minimum Opponent Rating",
            "minimum": 0,
            "type": "integer",
            "description": "Only include games where the opponent's rating is at or above this value. Example: 2400 filters out games vs club players and focuses on elite-level games. Set to 0 to include all games. For professional preparation, 2300-2500 is a reasonable threshold.",
            "default": 0
          },
          "maxGames": {
            "title": "Max Games",
            "minimum": 1,
            "maximum": 1500,
            "type": "integer",
            "description": "Maximum number of games to fetch and analyze. Higher values give more statistically significant opening frequencies but take longer and cost more. Recommendation: 200-500 for most players. Use 1000+ only for players with very large game libraries or rare openings.",
            "default": 500
          },
          "openingTreeDepth": {
            "title": "Opening Tree Depth (plies)",
            "minimum": 4,
            "maximum": 30,
            "type": "integer",
            "description": "How many half-moves (plies) to include in the opening tree. 12 plies = 6 full moves, which covers most opening theory. Higher values reveal deeper preparation but produce larger output. Recommendation: 12 for general study, 20-24 for specific line preparation.",
            "default": 12
          },
          "lichessApiToken": {
            "title": "Lichess API Token (optional)",
            "type": "string",
            "description": "Optional Lichess personal API token. Without a token, Lichess allows ~20 requests/second. With a token, rate limits are higher and you can access private game data. Generate a token at lichess.org/account/oauth/token. Scopes needed: none for public games."
          },
          "datasetId": {
            "title": "Dataset ID (optional)",
            "type": "string",
            "description": "ID of an existing Apify dataset to append results to. Useful for aggregating analysis from multiple players into a single dataset for comparison. Leave blank to use only the default run dataset."
          },
          "runId": {
            "title": "Run ID (optional)",
            "type": "string",
            "description": "ID of an existing Apify actor run to associate results with. Used when chaining actors in multi-step pipelines. Leave blank for standalone runs."
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}