{
  "openapi": "3.0.1",
  "info": {
    "title": "Stockfish Chess Engine: Best Move, Game Review, PGN to GIF",
    "description": "Stockfish 17.1 as an API: best move, evaluation and top lines for any FEN, Lichess-style game review of PGN (accuracy, centipawn loss, blunders with the better move), and PNG/SVG boards, evaluation graphs, annotated PGN and GIF or MP4 replays. Illegal moves come back with the legal ones.",
    "version": "0.1",
    "x-build-id": "tO5UeckSsHHLuzeK2"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/jumblemog~stockfish-chess-engine/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-jumblemog-stockfish-chess-engine",
        "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/jumblemog~stockfish-chess-engine/runs": {
      "post": {
        "operationId": "runs-sync-jumblemog-stockfish-chess-engine",
        "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/jumblemog~stockfish-chess-engine/run-sync": {
      "post": {
        "operationId": "run-sync-jumblemog-stockfish-chess-engine",
        "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": {
          "fen": {
            "title": "Position (FEN)",
            "type": "string",
            "description": "A chess position in FEN, such as r1bqkbnr/pppp1ppp/2n5/4p3/2B1P3/5N2/PPPP1PPP/RNBQK2R b KQkq - 3 3. Stockfish 17.1 finds the best move, the evaluation (centipawns or mate in N, and White's win chance) and the top lines, and the position is drawn as a PNG board. Chess960 positions (X-FEN or Shredder-FEN) work too. A position that can't happen comes back with the reason, such as a pawn on the back rank."
          },
          "pgn": {
            "title": "Game (PGN)",
            "type": "string",
            "description": "One or more games in PGN, as exported by any chess site or program, or just the moves: 1. e4 e5 2. Nf3 Nc6, or in UCI notation e2e4 e7e5 g1f3. Each game is reviewed move by move as on Lichess: each side's accuracy and average centipawn loss, and every inaccuracy, mistake and blunder with the move Stockfish preferred. A move that isn't legal comes back with its move number and the legal moves at that point."
          },
          "pgnUrls": {
            "title": "Links to PGN files",
            "type": "array",
            "description": "Links to .pgn files, such as tournament downloads, GitHub file pages, or Google Drive and Dropbox share links. A file can hold many games (see maxGames). Links to Lichess and Chess.com aren't downloaded, because their robots.txt asks automated tools not to; copy the PGN from the game's share menu into Game (PGN) instead.",
            "items": {
              "type": "string"
            }
          },
          "pgnFiles": {
            "title": "Upload PGN files",
            "type": "array",
            "description": "Upload .pgn files from your computer, or pick files you already stored in an Apify key-value store."
          },
          "outputs": {
            "title": "What to make",
            "type": "array",
            "description": "Each output applies where it fits: analysis to positions, review, graph, pgn, gif and mp4 to games, and images to both. Empty: analysis and a PNG for positions; review, a PNG, the graph and an annotated PGN for games. Without analysis or review, positions and games are only drawn and nothing is analysed.",
            "items": {
              "type": "string",
              "enum": [
                "analysis",
                "review",
                "png",
                "svg",
                "graph",
                "pgn",
                "gif",
                "mp4"
              ],
              "enumTitles": [
                "Engine analysis of positions (best move, evaluation, top lines)",
                "Engine review of games (accuracy, blunders and better moves)",
                "PNG board image (and an image of each mistake and blunder)",
                "SVG board image",
                "Evaluation graph of each game (PNG)",
                "Annotated PGN of each game (evaluations, ?! ? ?? and better lines)",
                "Game replay animation (GIF)",
                "Game replay video (MP4)"
              ]
            }
          },
          "positions": {
            "title": "Positions (batch)",
            "type": "array",
            "description": "Many positions at once. Each entry is a FEN string, or an object: {\"fen\": \"...\", \"moves\": \"e4 e5 Nf3\", \"name\": \"after 3 moves\", \"arrows\": [\"g1f3:green\", \"d8h4:red\"], \"highlights\": [\"f7\"]}. moves (SAN or UCI, as text or a list) are played from the fen, or from the starting position when fen is left out. Arrows are from-to squares with an optional color (green, red, blue or yellow)."
          },
          "games": {
            "title": "Games (batch)",
            "type": "array",
            "description": "Many games at once. Each entry is PGN text, or an object: {\"pgn\": \"1. e4 e5 ...\", \"name\": \"club-round-3\"} or {\"url\": \"https://example.com/games.pgn\", \"name\": \"club\"}."
          },
          "analysisNodes": {
            "title": "Search size for positions (nodes)",
            "minimum": 10000,
            "maximum": 3000000,
            "type": "integer",
            "description": "How many positions Stockfish searches for each position you send. The default 1,000,000 takes about 1.5 seconds and reaches about depth 20 (deeper in endgames), far beyond any human player; 3,000,000 searches about three levels deeper; 100,000 takes a tenth of a second. Each search runs on one thread with a fixed node count, so the same position gets the same answer every run.",
            "default": 1000000
          },
          "multiPv": {
            "title": "Top lines per position",
            "minimum": 1,
            "maximum": 5,
            "type": "integer",
            "description": "How many of the best moves to return for each position, each with its evaluation and the line that follows.",
            "default": 3
          },
          "engineElo": {
            "title": "Also play at this rating (Elo)",
            "minimum": 1320,
            "maximum": 3190,
            "type": "integer",
            "description": "Also return the move Stockfish chooses when limited to this rating (UCI_Elo, 1320 to 3190), for practice opponents, bots and puzzles. Leave empty for full strength only."
          },
          "reviewDepth": {
            "title": "Game review depth",
            "enum": [
              "fast",
              "standard",
              "deep"
            ],
            "type": "string",
            "description": "How hard Stockfish looks at each move of a game. Standard matches a typical online game review; deep is for close games and long endgames.",
            "default": "standard"
          },
          "boardSize": {
            "title": "Board image size (pixels)",
            "minimum": 160,
            "maximum": 2048,
            "type": "integer",
            "description": "Width and height of the board in PNG and SVG images; the evaluation bar adds a narrow strip on the left.",
            "default": 640
          },
          "theme": {
            "title": "Board colors",
            "enum": [
              "brown",
              "green",
              "blue",
              "gray",
              "purple"
            ],
            "type": "string",
            "description": "The colors of the light and dark squares.",
            "default": "brown"
          },
          "orientation": {
            "title": "Board orientation",
            "enum": [
              "auto",
              "white",
              "black"
            ],
            "type": "string",
            "description": "Which side is at the bottom of the board. With auto, images of mistakes and blunders show the board from the side that moved.",
            "default": "auto"
          },
          "coordinates": {
            "title": "Show coordinates",
            "type": "boolean",
            "description": "Write files a to h and ranks 1 to 8 along the board's edges.",
            "default": true
          },
          "showBestMove": {
            "title": "Show the best move as an arrow",
            "type": "boolean",
            "description": "Draw Stockfish's move as a green arrow on analysed positions, and the better move on mistakes in game images and animations.",
            "default": true
          },
          "evalBar": {
            "title": "Show the evaluation bar",
            "type": "boolean",
            "description": "Draw a bar beside the board that fills with White's win chance, with the score, on analysed positions and reviewed games.",
            "default": true
          },
          "animationLayout": {
            "title": "Animation shape",
            "enum": [
              "square",
              "vertical"
            ],
            "type": "string",
            "description": "The shape of the GIF and MP4 game replays.",
            "default": "square"
          },
          "animationSize": {
            "title": "Animation width (pixels)",
            "minimum": 240,
            "maximum": 1080,
            "type": "integer",
            "description": "Width of the GIF and MP4 replays. Empty: 512 for square and 720 for vertical. Use 1080 for full-HD vertical video."
          },
          "secondsPerMove": {
            "title": "Seconds per move",
            "minimum": 0.2,
            "maximum": 5,
            "type": "number",
            "description": "How long each move stays on screen in the replays. The final position is held three times as long.",
            "default": 1
          },
          "maxPlies": {
            "title": "Most half-moves per game",
            "minimum": 2,
            "maximum": 1000,
            "type": "integer",
            "description": "Only this many half-moves of each game are reviewed and drawn (400 half-moves is a 200-move game); the result says when a game was cut short.",
            "default": 400
          },
          "maxGames": {
            "title": "Most games",
            "minimum": 1,
            "maximum": 10000,
            "type": "integer",
            "description": "Stop after this many games in total, across every PGN text, file and link. Useful with files that hold thousands of games.",
            "default": 100
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}