{"openapi":"3.1.0","info":{"title":"Stockfish API","version":"1.0.0","description":"Hosted Stockfish chess engine. Agent-friendly: see /llms.txt."},"servers":[{"url":"https://stockfishapi.com/v1"}],"security":[{"bearer":[]},{}],"components":{"securitySchemes":{"bearer":{"type":"http","scheme":"bearer"}},"schemas":{"Score":{"type":"object","properties":{"type":{"enum":["cp","mate"]},"value":{"type":"integer"}},"required":["type","value"]},"Pv":{"type":"object","properties":{"rank":{"type":"integer"},"eval":{"$ref":"#/components/schemas/Score"},"moves":{"type":"array","items":{"type":"string"}}}},"EvalRequest":{"type":"object","required":["fen"],"properties":{"fen":{"type":"string"},"depth":{"type":"integer","minimum":1,"maximum":30,"default":14},"multipv":{"type":"integer","minimum":1,"maximum":10,"default":1},"movetime_ms":{"type":"integer","minimum":50,"maximum":60000},"engine":{"type":"string","default":"latest","description":"Engine version id from GET /engines, or `latest`."},"path":{"enum":["auto","wasm","native"],"default":"auto"},"options":{"type":"object","description":"UCI options by JSON name; schema and defaults from GET /engines.","properties":{"hash_mb":{"type":"integer"},"limit_strength":{"type":"boolean"},"elo":{"type":"integer"},"skill_level":{"type":"integer"},"chess960":{"type":"boolean"},"show_wdl":{"type":"boolean"},"move_overhead_ms":{"type":"integer"}}}}},"EvalResponse":{"type":"object","properties":{"eval":{"$ref":"#/components/schemas/Score"},"bestmove":{"type":"string"},"pvs":{"type":"array","items":{"$ref":"#/components/schemas/Pv"}},"depth":{"type":"integer"},"nodes":{"type":"integer"},"engine":{"type":"string"},"cached":{"type":"boolean"},"cost_units":{"type":"integer"}}},"Problem":{"type":"object","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"integer"},"detail":{"type":"string"},"next_action":{"enum":["fix_request","retry_after","upgrade","raise_budget","verify_email","contact","sign_up"]}}}}},"paths":{"/eval":{"post":{"operationId":"evaluatePosition","x-cost-units":"see GET /price","x-plan-min":"free","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EvalRequest"}}}},"responses":{"200":{"description":"Evaluation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EvalResponse"}}}},"402":{"description":"Upgrade needed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}}}},"/bestmove":{"post":{"operationId":"bestMove","x-plan-min":"free","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EvalRequest"}}}},"responses":{"200":{"description":"Best move","content":{"application/json":{"schema":{"type":"object","properties":{"bestmove":{"type":"string"},"eval":{"$ref":"#/components/schemas/Score"}}}}}}}}},"/engines":{"get":{"operationId":"listEngines","security":[],"x-cost-units":0,"responses":{"200":{"description":"Versions, default, option schema","content":{"application/json":{"schema":{"type":"object"}}}}}}},"/price":{"get":{"operationId":"getPrice","parameters":[{"name":"endpoint","in":"query","schema":{"enum":["eval","bestmove","analyze","batch"]}},{"name":"depth","in":"query","schema":{"type":"integer"}},{"name":"multipv","in":"query","schema":{"type":"integer"}},{"name":"plies","in":"query","schema":{"type":"integer"}},{"name":"items","in":"query","schema":{"type":"integer"}}],"responses":{"200":{"description":"Units and USD","content":{"application/json":{"schema":{"type":"object"}}}}}}},"/legal-moves":{"post":{"operationId":"legalMoves","x-cost-units":0,"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"fen":{"type":"string"}}}}}},"responses":{"200":{"description":"Moves","content":{"application/json":{"schema":{"type":"object"}}}}}}},"/validate":{"post":{"operationId":"validateFen","x-cost-units":0,"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"fen":{"type":"string"}}}}}},"responses":{"200":{"description":"Validity","content":{"application/json":{"schema":{"type":"object"}}}}}}},"/signup":{"post":{"operationId":"signup","security":[],"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["email"],"properties":{"email":{"type":"string"},"name":{"type":"string"},"agent":{"type":"string"},"source":{"type":"string"}}}}}},"responses":{"201":{"description":"Key issued","content":{"application/json":{"schema":{"type":"object","properties":{"api_key":{"type":"string"},"key_id":{"type":"string"},"plan":{"type":"string"}}}}}}}}},"/me":{"get":{"operationId":"me","responses":{"200":{"description":"Account","content":{"application/json":{"schema":{"type":"object"}}}}}}},"/usage":{"get":{"operationId":"usage","parameters":[{"name":"group_by","in":"query","schema":{"type":"string","example":"key,day"}}],"responses":{"200":{"description":"Usage","content":{"application/json":{"schema":{"type":"object"}}}}}}},"/keys":{"get":{"operationId":"listKeys","responses":{"200":{"description":"Keys","content":{"application/json":{"schema":{"type":"object"}}}}}},"post":{"operationId":"createKey","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"label":{"type":"string"},"scopes":{"type":"array","items":{"type":"string"}},"budget_units":{"type":"integer"},"budget_usd":{"type":"number"},"env":{"enum":["live","test"]}}}}}},"responses":{"201":{"description":"Key created","content":{"application/json":{"schema":{"type":"object"}}}}}}},"/keys/{id}":{"patch":{"operationId":"updateKey","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Updated","content":{"application/json":{"schema":{"type":"object"}}}}}},"delete":{"operationId":"revokeKey","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"Revoked"}}}},"/keys/{id}/rotate":{"post":{"operationId":"rotateKey","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"201":{"description":"New key","content":{"application/json":{"schema":{"type":"object"}}}}}}},"/analyze":{"post":{"operationId":"analyzeGame","description":"Queue up to 50 positions at depth 1–14 with 1–3 principal variations. Returns a job id; poll /jobs/{id} or stream /jobs/{id}/events.","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"pgn":{"type":"string"},"fen":{"type":"string"},"depth":{"type":"integer"},"multipv":{"type":"integer"}}}}}},"responses":{"202":{"description":"Queued job","content":{"application/json":{"schema":{"type":"object"}}}}}}},"/batch":{"post":{"operationId":"batchAnalyze","requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["fens"],"properties":{"fens":{"type":"array","items":{"type":"string"},"minItems":1,"maxItems":50},"depth":{"type":"integer","minimum":1,"maximum":14},"multipv":{"type":"integer","minimum":1,"maximum":3}}}}}},"description":"Queue up to 50 positions at depth 1–14 with 1–3 principal variations. Returns a job id; poll /jobs/{id} or stream /jobs/{id}/events.","responses":{"202":{"description":"Queued job","content":{"application/json":{"schema":{"type":"object"}}}}}}},"/jobs/{id}":{"get":{"operationId":"getJob","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Job state","content":{"application/json":{"schema":{"type":"object"}}}}}},"delete":{"operationId":"cancelJob","responses":{"200":{"description":"Cancellation state","content":{"application/json":{"schema":{"type":"object"}}}}}}},"/jobs/{id}/result":{"get":{"operationId":"getJobResult","responses":{"200":{"description":"Completed positions","content":{"application/json":{"schema":{"type":"object"}}}}}}},"/billing/checkout":{"post":{"operationId":"createCheckout","requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["plan"],"properties":{"plan":{"enum":["hobby","pro"]}}}}}},"responses":{"200":{"description":"Checkout URL","content":{"application/json":{"schema":{"type":"object","properties":{"checkout_url":{"type":"string"}}}}}}}}},"/billing/portal":{"post":{"operationId":"createPortal","responses":{"200":{"description":"Portal URL","content":{"application/json":{"schema":{"type":"object"}}}}}}}}}