Lichess Bot API

Play on Lichess as a bot. Allows engine play. Read the [blog post announcement of lichess bots](https://lichess.org/blog/WvDNticAAMu_mHKP/welcome-lichess-bots). Only works with [Bot accounts](#tag/bot/POST/api/bot/account/upgrade). ### Features - [Stream incoming chess moves](#tag/bot/GET/api/bot/game/stream/{gameId}) - [Play chess moves](#tag/bot/POST/api/bot/game/{gameId}/move/{move}) - [Read](#tag/bot/GET/api/bot/game/stream/{gameId}) and [write](#tag/bot/POST/api/bot/game/{gameId}/chat) in the player and spectator chats - [Receive](#tag/bot/GET/api/stream/event), [create](#tag/challenges/POST/api/challenge/{username}) and [accept](#tag/challenges/POST/api/challenge/{challengeId}/accept) (or [decline](#tag/challenges/POST/api/challenge/{challengeId}/decline)) challenges - [Abort](#tag/bot/POST/api/bot/game/{gameId}/abort) and [resign](#tag/bot/POST/api/bot/game/{gameId}/resign) games - Engine assistance is [allowed](https://lichess.org/page/fair-play) ### Restrictions - Bots can only play challenge games: pools and tournaments are off-limits - Bots cannot play UltraBullet (¼+0) because it requires making too many requests. But 0+1 and ½+0 are allowed. - Bots must follow [Lichess TOS](https://lichess.org/terms-of-service) specifically Sandbagging, Constant Aborting, Boosting, etc - Bot devs are advised to make their Bots play casual only when testing their Bots logic and to avoid breaking Lichess TOS. ### Integrations - [Python3 lichess-bot](https://github.com/lichess-bot-devs/lichess-bot) (official) - [Python3 lichess UCI bot](https://github.com/Torom/BotLi) - [JavaScript bot-o-tron](https://github.com/tailuge/bot-o-tron) - [Golang lichess-bot](https://github.com/dolegi/lichess-bot) - [Electronic Chessboard](http://www.oliviermercier.com/res/projects/chessboard/) - Yours? Please make [an issue or pull request](https://github.com/lichess-org/api). ### Links - [Announcement](https://lichess.org/blog/WvDNticAAMu_mHKP/welcome-lichess-bots) - Join the [Lichess Bots team](https://lichess.org/team/lichess-bots) with your bot account - [Get help in the discord channel](https://discord.gg/quwueFd) - Watch [Lichess Bot TV](https://lichess.org/tv/bot)

Operations 13

GET /api/stream/event Stream incoming events #
GET /api/bot/online Get online bots #
POST /api/bot/account/upgrade Upgrade to Bot account #
GET /api/bot/game/stream/{gameId} Stream Bot game state #
POST /api/bot/game/{gameId}/move/{move} Make a Bot move #
POST /api/bot/game/{gameId}/chat Write in the chat #
GET /api/bot/game/{gameId}/chat Fetch the game chat #
POST /api/bot/game/{gameId}/abort Abort a game #
POST /api/bot/game/{gameId}/resign Resign a game #
POST /api/bot/game/{gameId}/draw/{accept} Handle draw offers #
POST /api/bot/game/{gameId}/takeback/{accept} Handle takeback offers #
POST /api/bot/game/{gameId}/claim-victory Claim victory of a game #
POST /api/bot/game/{gameId}/claim-draw Claim draw of a game #

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/lichess-bot-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Discovery needs no key. Ratings and market analysis are Pro.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

lichess-bot-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  version: 2.0.144
  title: Lichess.org API reference Account Bot API
  contact:
    name: Lichess.org API
    url: https://lichess.org/api
    email: contact@lichess.org
  x-logo:
    url: https://lichess1.org/assets/logo/lichess-pad12.svg
  license:
    name: AGPL-3.0-or-later
    url: https://www.gnu.org/licenses/agpl-3.0.txt
  description: '# Introduction

    Welcome to the reference for the Lichess API! Lichess is free/libre,

    open-source chess server powered by volunteers and donations.

    - Get help in the [Lichess Discord channel](https://discord.gg/lichess)

    - API demo app with OAuth2 login and gameplay: [source](https://github.com/lichess-org/api-demo) / [demo](https://lichess-org.github.io/api-demo/)

    - API UI app with OAuth2 login and endpoint forms: [source](https://github.com/lichess-org/api-ui) / [website](https://lichess.org/api/ui)

    - [Contribute to this documentation on Github](https://github.com/lichess-org/api)

    - Check out [Lichess widgets to embed in your website](https://lichess.org/developers)

    - [Download all Lichess rated games](https://database.lichess.org/)

    - [Download all Lichess puzzles with themes, ratings and votes](https://database.lichess.org/#puzzles)

    - [Download all evaluated positions](https://database.lichess.org/#evals)


    ## Endpoint

    All requests go to `https://lichess.org` (unless otherwise specified).


    ## Clients

    - [Python general API](https://github.com/lichess-org/berserk)

    - [MicroPython general API](https://github.com/mkomon/uberserk)

    - [Python general API - async](https://pypi.org/project/async-lichess-sdk)

    - [Python Lichess Bot](https://github.com/lichess-bot-devs/lichess-bot)

    - [Python Board API for Certabo](https://github.com/haklein/certabo-lichess)

    - [Java general API](https://github.com/tors42/chariot)

    - [JavaScript & TypeScript general API](https://github.com/devjiwonchoi/equine)

    - [LichessNET - C# API Wrapper](https://github.com/Rabergsel/LichessNET)

    - [.NET general API](https://github.com/Dblike/LichessSharp)


    ## Rate limiting

    All requests are rate limited using various strategies,

    to ensure the API remains responsive for everyone.

    Only make one request at a time.

    If you receive an HTTP response with a [429 status](https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#429),

    you have exceded one of the rate limits.

    In most cases, waiting one minute before retrying will be sufficient, but some limits may require longer.

    Reduce your request frequency before retrying.


    ## Streaming with ND-JSON

    Some API endpoints stream their responses as [Newline Delimited JSON a.k.a. **nd-json**](https://github.com/ndjson/ndjson-spec), with one JSON object per line.


    Here''s a [JavaScript utility function](https://gist.github.com/ornicar/a097406810939cf7be1df8ea30e94f3e) to help reading NDJSON streamed responses.


    ## Authentication

    ### Which authentication method is right for me?

    [Read about the Lichess API authentication methods and code examples](https://github.com/lichess-org/api/blob/master/example/README.md)


    ### Personal Access Token

    Personal API access tokens allow you to quickly interact with Lichess API without going through an OAuth flow.

    - [Generate a personal access token](https://lichess.org/account/oauth/token)

    - `curl https://lichess.org/api/account -H "Authorization: Bearer {token}"`

    - [NodeJS example](https://github.com/lichess-org/api/tree/master/example/oauth-personal-token)


    ### Token Security

    - Keep your tokens secret. Do not share them in public repositories or public forums.

    - Your tokens can be used to make your account perform arbitrary actions (within the limits of the tokens'' scope). You remain responsible for all activities on your account.

    - Do not hardcode tokens in your application''s code. Use environment variables or a secure storage and ensure they are not shipped/exposed to users. Be especially careful that they are not included in frontend bundles or apps that are shipped to users.

    - If you suspect a token has been compromised, revoke it immediately.


    To see your active tokens or revoke them, see [your Personal API access tokens](https://lichess.org/account/oauth/token).


    ### Authorization Code Flow with PKCE

    The authorization code flow with PKCE allows your users to **login with Lichess**.

    Lichess supports unregistered and public clients (no client authentication, choose any unique client id).

    The only accepted code challenge method is `S256`.

    Access tokens are long-lived (expect one year), unless they are revoked.

    Refresh tokens are not supported.


    See the [documentation for the OAuth endpoints](#tag/OAuth) or

    the [PKCE RFC](https://datatracker.ietf.org/doc/html/rfc7636#section-4) for a precise protocol description.


    - [Demo app](https://lichess-org.github.io/api-demo/)

    - [Minimal client-side example](https://github.com/lichess-org/api/tree/master/example/oauth-app)

    - [Flask/Python example](https://github.com/lakinwecker/lichess-oauth-flask)

    - [Java example](https://github.com/tors42/lichess-oauth-pkce-app)

    - [NodeJS Passport strategy to login with Lichess OAuth2](https://www.npmjs.com/package/passport-lichess)


    #### Real life examples

    - [PyChess](https://github.com/gbtami/pychess-variants) ([source code](https://github.com/gbtami/pychess-variants))

    - [Lichess4545](https://www.lichess4545.com/) ([source code](https://github.com/cyanfish/heltour))

    - [English Chess Federation](https://ecf.octoknight.com/)

    - [Rotherham Online Chess](https://rotherhamonlinechess.azurewebsites.net/tournaments)


    ### Token format

    Access tokens and authorization codes match `^[A-Za-z0-9_]+$`.

    The length of tokens can be increased without notice. Make sure your application can handle at least 512 characters.

    By convention tokens have a recognizable prefix, but do not rely on this.

    '
servers:
- url: https://lichess.org
- url: https://lichess.dev
- url: http://localhost:{port}
  variables:
    port:
      default: '8080'
- url: http://l.org
tags:
- name: Bot
  description: 'Play on Lichess as a bot. Allows engine play.

    Read the [blog post announcement of lichess bots](https://lichess.org/blog/WvDNticAAMu_mHKP/welcome-lichess-bots).


    Only works with [Bot accounts](#tag/bot/POST/api/bot/account/upgrade).


    ### Features

    - [Stream incoming chess moves](#tag/bot/GET/api/bot/game/stream/{gameId})

    - [Play chess moves](#tag/bot/POST/api/bot/game/{gameId}/move/{move})

    - [Read](#tag/bot/GET/api/bot/game/stream/{gameId}) and [write](#tag/bot/POST/api/bot/game/{gameId}/chat) in the player and spectator chats

    - [Receive](#tag/bot/GET/api/stream/event), [create](#tag/challenges/POST/api/challenge/{username}) and [accept](#tag/challenges/POST/api/challenge/{challengeId}/accept) (or [decline](#tag/challenges/POST/api/challenge/{challengeId}/decline)) challenges

    - [Abort](#tag/bot/POST/api/bot/game/{gameId}/abort) and [resign](#tag/bot/POST/api/bot/game/{gameId}/resign) games

    - Engine assistance is [allowed](https://lichess.org/page/fair-play)

    ### Restrictions

    - Bots can only play challenge games:  pools and tournaments are off-limits

    - Bots cannot play UltraBullet (¼+0) because it requires making too many requests. But 0+1 and ½+0 are allowed.

    - Bots must follow [Lichess TOS](https://lichess.org/terms-of-service) specifically Sandbagging, Constant Aborting, Boosting, etc

    - Bot devs are advised to make their Bots play casual only when testing their Bots logic and to avoid breaking Lichess TOS.

    ### Integrations

    - [Python3 lichess-bot](https://github.com/lichess-bot-devs/lichess-bot) (official)

    - [Python3 lichess UCI bot](https://github.com/Torom/BotLi)

    - [JavaScript bot-o-tron](https://github.com/tailuge/bot-o-tron)

    - [Golang lichess-bot](https://github.com/dolegi/lichess-bot)

    - [Electronic Chessboard](http://www.oliviermercier.com/res/projects/chessboard/)

    - Yours? Please make [an issue or pull request](https://github.com/lichess-org/api).

    ### Links

    - [Announcement](https://lichess.org/blog/WvDNticAAMu_mHKP/welcome-lichess-bots)

    - Join the [Lichess Bots team](https://lichess.org/team/lichess-bots) with your bot account

    - [Get help in the discord channel](https://discord.gg/quwueFd)

    - Watch [Lichess Bot TV](https://lichess.org/tv/bot)

    '
paths:
  /api/stream/event:
    get:
      operationId: apiStreamEvent
      summary: Stream incoming events
      description: 'Stream the events reaching a lichess user in real time as [ndjson](#description/streaming-with-nd-json).


        An empty line is sent every 7 seconds for keep alive purposes.


        Each non-empty line is a JSON object containing a `type` field. Possible values are:

        - `gameStart` Start of a game

        - `gameFinish` Completion of a game

        - `challenge` A player sends you a challenge or you challenge someone

        - `challengeCanceled` A player cancels their challenge to you

        - `challengeDeclined` The opponent declines your challenge


        When the stream opens, all current challenges and games are sent.


        Only one global event stream can be active at a time. When the stream opens, the previous one with the same access token is closed.

        '
      tags:
      - Bot
      security:
      - OAuth2:
        - challenge:read
        - bot:play
        - board:play
      responses:
        '200':
          description: The stream of events reaching the logged in user.
          headers:
            Access-Control-Allow-Origin:
              schema:
                type: string
                default: '''*'''
          content:
            application/x-ndjson:
              schema:
                oneOf:
                - $ref: '#/components/schemas/GameStartEvent'
                - $ref: '#/components/schemas/GameFinishEvent'
                - $ref: '#/components/schemas/ChallengeEvent'
                - $ref: '#/components/schemas/ChallengeCanceledEvent'
                - $ref: '#/components/schemas/ChallengeDeclinedEvent'
              examples:
                GameStartEvent:
                  $ref: '#/components/examples/stream-gameStart.json'
                GameStartEvent (vs AI):
                  $ref: '#/components/examples/stream-gameStart-ai.json'
                GameFinishEvent:
                  $ref: '#/components/examples/stream-gameFinish.json'
                GameFinishEvent (vs AI):
                  $ref: '#/components/examples/stream-gameFinish-ai.json'
                ChallengeEvent:
                  $ref: '#/components/examples/stream-challenge.json'
                ChallengeDeclinedEvent:
                  $ref: '#/components/examples/stream-challengeDeclined.json'
                ChallengeCanceledEvent:
                  $ref: '#/components/examples/stream-challengeCanceled.json'
  /api/bot/online:
    get:
      operationId: apiBotOnline
      summary: Get online bots
      tags:
      - Bot
      security: []
      description: Stream the [online bot users](https://lichess.org/player/bots), as [ndjson](#description/streaming-with-nd-json).
      parameters:
      - in: query
        name: nb
        description: How many bot users to fetch
        schema:
          type: integer
          minimum: 1
          maximum: 512
          default: 100
          example: 20
      responses:
        '200':
          description: The list of online bot users
          headers:
            Access-Control-Allow-Origin:
              schema:
                type: string
                default: '''*'''
          content:
            application/x-ndjson:
              schema:
                $ref: '#/components/schemas/User'
              examples:
                default:
                  $ref: '#/components/examples/bot-getOnlineBots.json'
  /api/bot/account/upgrade:
    post:
      operationId: botAccountUpgrade
      summary: Upgrade to Bot account
      description: 'Upgrade a lichess player account into a Bot account. Only Bot accounts can use the Bot API.

        The account **cannot have played any game** before becoming a Bot account. The upgrade is **irreversible**. The account will only be able to play as a Bot.

        To upgrade an account to Bot, use the [official lichess-bot client](https://github.com/lichess-bot-devs/lichess-bot), or follow these steps:

        - Create an [API access token](https://lichess.org/account/oauth/token/create?scopes[]=bot:play) with "Play bot moves" permission.

        - `curl -d '''' https://lichess.org/api/bot/account/upgrade -H "Authorization: Bearer <yourTokenHere>"`

        To know if an account has already been upgraded, use the [Get my profile API](#tag/account/GET/api/account):

        the `title` field should be set to `BOT`.

        '
      tags:
      - Bot
      security:
      - OAuth2:
        - bot:play
      responses:
        '200':
          description: The bot account was successfully upgraded.
          headers:
            Access-Control-Allow-Origin:
              schema:
                type: string
                default: '''*'''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Ok'
        '400':
          description: The upgrade of the bot account failed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /api/bot/game/stream/{gameId}:
    get:
      operationId: botGameStream
      summary: Stream Bot game state
      description: 'Stream the state of a game being played with the Bot API, as [ndjson](#description/streaming-with-nd-json).

        Use this endpoint to get updates about the game in real-time, with a single request.

        Each line is a JSON object containing a `type` field. Possible values are:

        - `gameFull` Full game data. All values are immutable, except for the `state` field.

        - `gameState` Current state of the game. Immutable values not included.

        - `chatLine` Chat message sent by a user (or the bot itself) in the `room` "player" or "spectator".

        - `opponentGone` Whether the opponent has left the game, and how long before you can claim a win or draw.

        The first line is always of type `gameFull`.

        '
      tags:
      - Bot
      security:
      - OAuth2:
        - bot:play
      parameters:
      - in: path
        name: gameId
        schema:
          type: string
          example: 5IrD6Gzz
        required: true
      responses:
        '200':
          description: The stream of the bot game.
          headers:
            Access-Control-Allow-Origin:
              schema:
                type: string
                default: '''*'''
          content:
            application/x-ndjson:
              schema:
                oneOf:
                - $ref: '#/components/schemas/GameFullEvent'
                - $ref: '#/components/schemas/GameStateEvent'
                - $ref: '#/components/schemas/ChatLineEvent'
                - $ref: '#/components/schemas/OpponentGoneEvent'
        '404':
          description: The bot game was not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NotFound'
  /api/bot/game/{gameId}/move/{move}:
    post:
      operationId: botGameMove
      summary: Make a Bot move
      description: 'Make a move in a game being played with the Bot API.

        The move can also contain a draw offer/agreement.

        '
      tags:
      - Bot
      security:
      - OAuth2:
        - bot:play
      parameters:
      - in: path
        name: gameId
        schema:
          type: string
          example: 5IrD6Gzz
        required: true
      - in: path
        name: move
        required: true
        description: The move to play, in UCI format
        schema:
          type: string
          example: e2e4
      - in: query
        name: offeringDraw
        description: Whether to offer (or agree to) a draw
        schema:
          type: boolean
      responses:
        '200':
          description: The bot move was successfully made.
          headers:
            Access-Control-Allow-Origin:
              schema:
                type: string
                default: '''*'''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Ok'
        '400':
          description: The bot move failed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /api/bot/game/{gameId}/chat:
    post:
      operationId: botGameChat
      summary: Write in the chat
      description: 'Post a message to the player or spectator chat, in a game being played with the Bot API.

        '
      tags:
      - Bot
      security:
      - OAuth2:
        - bot:play
      parameters:
      - in: path
        name: gameId
        schema:
          type: string
          example: 5IrD6Gzz
        required: true
      requestBody:
        required: true
        content:
          application/x-www-form-urlencoded:
            schema:
              type: object
              properties:
                room:
                  type: string
                  enum:
                  - player
                  - spectator
                text:
                  type: string
                  example: Thank you for the game!
              required:
              - room
              - text
      responses:
        '200':
          description: The message was successfully posted in chat.
          headers:
            Access-Control-Allow-Origin:
              schema:
                type: string
                default: '''*'''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Ok'
        '400':
          description: The posting of the  message in chat failed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
    get:
      operationId: botGameChatGet
      summary: Fetch the game chat
      description: 'Get the messages posted in the game chat

        '
      tags:
      - Bot
      security:
      - OAuth2:
        - bot:play
      parameters:
      - in: path
        name: gameId
        schema:
          type: string
          example: 5IrD6Gzz
        required: true
      responses:
        '200':
          description: The messages posted in the chat.
          headers:
            Access-Control-Allow-Origin:
              schema:
                type: string
                default: '''*'''
          content:
            application/x-ndjson:
              schema:
                $ref: '#/components/schemas/PlayerGameChat'
  /api/bot/game/{gameId}/abort:
    post:
      operationId: botGameAbort
      summary: Abort a game
      description: 'Abort a game being played with the Bot API.

        '
      tags:
      - Bot
      security:
      - OAuth2:
        - bot:play
      parameters:
      - in: path
        name: gameId
        schema:
          type: string
          example: 5IrD6Gzz
        required: true
      responses:
        '200':
          description: The game was successfully aborted.
          headers:
            Access-Control-Allow-Origin:
              schema:
                type: string
                default: '''*'''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Ok'
        '400':
          description: The abortion of the game failed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /api/bot/game/{gameId}/resign:
    post:
      operationId: botGameResign
      summary: Resign a game
      description: 'Resign a game being played with the Bot API.

        '
      tags:
      - Bot
      security:
      - OAuth2:
        - bot:play
      parameters:
      - in: path
        name: gameId
        schema:
          type: string
          example: 5IrD6Gzz
        required: true
      responses:
        '200':
          description: The game was successfully resigned from.
          headers:
            Access-Control-Allow-Origin:
              schema:
                type: string
                default: '''*'''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Ok'
        '400':
          description: Resigning the game failed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /api/bot/game/{gameId}/draw/{accept}:
    post:
      operationId: botGameDraw
      summary: Handle draw offers
      description: 'Create/accept/decline draw offers with the Bot API.

        - `yes`: Offer a draw, or accept the opponent''s draw offer.

        - `no`: Decline a draw offer from the opponent.

        '
      tags:
      - Bot
      security:
      - OAuth2:
        - bot:play
      parameters:
      - in: path
        name: gameId
        schema:
          type: string
          example: 5IrD6Gzz
        required: true
      - in: path
        name: accept
        schema:
          anyOf:
          - type: boolean
          - type: string
            const: 'yes'
          example: 'yes'
        required: true
      responses:
        '200':
          description: The draw offer was successfully sent.
          headers:
            Access-Control-Allow-Origin:
              schema:
                type: string
                default: '''*'''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Ok'
        '400':
          description: The draw offering failed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /api/bot/game/{gameId}/takeback/{accept}:
    post:
      operationId: botGameTakeback
      summary: Handle takeback offers
      description: 'Create/accept/decline takebacks with the Bot API.

        - `yes`: Propose a takeback, or accept the opponent''s takeback offer.

        - `no`: Decline a takeback offer from the opponent.

        '
      tags:
      - Bot
      security:
      - OAuth2:
        - bot:play
      parameters:
      - in: path
        name: gameId
        schema:
          type: string
          example: 5IrD6Gzz
        required: true
      - in: path
        name: accept
        schema:
          anyOf:
          - type: boolean
          - type: string
            const: 'yes'
          example: 'yes'
        required: true
      responses:
        '200':
          description: The takeback offer was successfully sent.
          headers:
            Access-Control-Allow-Origin:
              schema:
                type: string
                default: '''*'''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Ok'
        '400':
          description: The takeback offering failed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /api/bot/game/{gameId}/claim-victory:
    post:
      operationId: botGameClaimVictory
      summary: Claim victory of a game
      description: 'Claim victory when the opponent has left the game for a while.

        '
      tags:
      - Bot
      security:
      - OAuth2:
        - bot:play
      parameters:
      - in: path
        name: gameId
        schema:
          type: string
          example: 5IrD6Gzz
        required: true
      responses:
        '200':
          description: The victory was successfully claimed.
          headers:
            Access-Control-Allow-Origin:
              schema:
                type: string
                default: '''*'''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Ok'
        '400':
          description: The victory claim has failed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /api/bot/game/{gameId}/claim-draw:
    post:
      operationId: botGameClaimDraw
      summary: Claim draw of a game
      description: 'Claim draw when the opponent has left the game for a while.

        '
      tags:
      - Bot
      security:
      - OAuth2:
        - bot:play
      parameters:
      - in: path
        name: gameId
        schema:
          type: string
          example: 5IrD6Gzz
        required: true
      responses:
        '200':
          description: The draw was successfully claimed.
          headers:
            Access-Control-Allow-Origin:
              schema:
                type: string
                default: '''*'''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Ok'
        '400':
          description: The draw claim has failed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    Flair:
      type: string
      description: See [available flair list and images](https://github.com/lichess-org/lila/tree/master/public/flair)
    GameStartEvent:
      type: object
      properties:
        type:
          type: string
          const: gameStart
        game:
          $ref: '#/components/schemas/GameEventInfo'
      required:
      - type
      - game
    ChatLineEvent:
      type: object
      properties:
        type:
          type: string
          const: chatLine
        room:
          type: string
          enum:
          - player
          - spectator
        username:
          type: string
        text:
          type: string
      required:
      - type
      - room
      - username
      - text
      example:
        type: chatLine
        username: thibault
        text: Good luck, have fun
        room: player
    ChallengeEvent:
      type: object
      properties:
        type:
          type: string
          const: challenge
        challenge:
          $ref: '#/components/schemas/ChallengeJson'
        compat:
          $ref: '#/components/schemas/GameCompat'
      required:
      - type
      - challenge
    GameEventPlayer:
      type: object
      properties:
        aiLevel:
          type: integer
        id:
          type: string
        name:
          type: string
        title:
          oneOf:
          - $ref: '#/components/schemas/Title'
          - type: 'null'
        rating:
          type: integer
        provisional:
          type: boolean
      required:
      - id
      - name
    ChallengeStatus:
      type: string
      enum:
      - created
      - offline
      - canceled
      - declined
      - accepted
    Profile:
      type: object
      properties:
        flag:
          type: string
          example: EC
        location:
          type: string
        bio:
          type: string
          example: Free bugs!
        realName:
          type: string
          example: Thibault Duplessis
        fideRating:
          type: integer
          example: 1500
          description: only appears if a user has set them
        uscfRating:
          type: integer
          example: 1500
          description: only appears if a user has set them
        ecfRating:
          type: integer
          example: 1500
          description: only appears if a user has set them
        cfcRating:
          type: integer
          example: 1500
          description: only appears if a user has set them
        rcfRating:
          type: integer
          example: 1500
          description: only appears if a user has set them
        dsbRating:
          type: integer
          example: 1500
          description: only appears if a user has set them
        links:
          type: string
          example: 'github.com/ornicar

            mas.to/@thibault'
    Perfs:
      type: object
      properties:
        chess960:
          $ref: '#/components/schemas/Perf'
        atomic:
          $ref: '#/components/schemas/Perf'
        racingKings:
          $ref: '#/components/schemas/Perf'
        ultraBullet:
          $ref: '#/components/schemas/Perf'
        blitz:
          $ref: '#/components/schemas/Perf'
        kingOfTheHill:
          $ref: '#/components/schemas/Perf'
        threeCheck:
          $ref: '#/components/schemas/Perf'
        antichess:
          $ref: '#/components/schemas/Perf'
        crazyhouse:
          $ref: '#/components/schemas/Perf'
        bullet:
          $ref: '#/components/schemas/Perf'
        correspondence:
          $ref: '#/components/schemas/Perf'
        horde:
          $ref: '#/components/schemas/Perf'
        puzzle:
          $ref: '#/components/schemas/Perf'
        classical:
          $ref: '#/components/schemas/Perf'
        rapid:
          $ref: '#/components/schemas/Perf'
        storm:
          $ref: '#/components/schemas/PuzzleModePerf'
        racer:
          $ref: '#/components/schemas/PuzzleModePerf'
        streak:
          $ref: '#/components/schemas/PuzzleModePerf'
    Patron:
      type: boolean
      deprecated: true
      description: 'Use patronColor value instead to determine if player is a patron.

        '
    ChallengeUser:
      type: object
      properties:
        id:
          type: string
        name:
          type: string
        rating:
          type: integer
        title:
          $ref: '#/components/schemas/Title'
        flair:
          $ref: '#/components/schemas/Flair'
        patron:
          $ref: '#/components/schemas/Patron'
        patronColor:
          $ref: '#/components/schemas/PatronColor'
        provisional:
          type: boolean
        online:
          type: boolean
        lag:
          type: integer
      required:
      - id
      - name
    GameStatusName:
      type: string
      enum:
      - created
      - started
      - aborted
      - mate
      - resign
      - stalemate
      - timeout
      - draw
      - outoftime
      - cheat
      - noStart
      - unknownFinish
      - insufficientMaterialClaim
      - variantEnd
    Title:
      type: string
      enum:
      - GM
      - WGM
      - IM
      - WIM
      - FM
      - WFM
      - NM
      - CM
      - WCM
      - WNM
      - LM
      - BOT
      description: only appears if the user is a titled player or a bot user
    PlayerGameChat:
      type: array
      items:
        type: object
        properties:
          text:
            type: string
          user:
            type: string
        required:
        - text
        - user
      example:
      - text: Takeback sent
        user: lichess
      - text: Takeback accepted
        user: lichess
      - text: Good game, well played
        user: thibault
    PuzzleModePerf:
      type: object
      properties:
        runs:
          type: integer
        score:
          type: integer
      required:
      - runs
      - score
    Variant:
      type: object
      properties:
        key:
          $ref: '#/components/schemas/VariantKey'
        name:
          type: string
        short:
          type: string
      required:
      - key
      - name
    GameStatusId:
      type: integer
      enum:
      - 10
      - 20
      - 25
      - 30
      - 31
      - 32
      - 33
      - 34
      - 35
      - 36
      - 37
      - 38
      - 39
      - 60
    PatronColor:
      type: integer
      description: 'Players can choose a color for their Patron wings.

        See [here for the color mappings](https://github.com/lichess-org/lila/blob/master/ui/lib/css/abstract/_patron-colors.scss).


        The presence of this field indicates the player is an active Patron.

        '
      minimum: 1
      maximum: 10
    Error:
      type: object
      properties:
        error:
          type: string
          description: The cause of the error.
      required:
      - error
      example:
        error: This request is invalid because [...]
    GameFullEvent:
      type: object
      properties:
        type:
          type: string
          const: gameFull
        id:
          type: string
        variant:
          $ref: '#/comp

# --- truncated at 32 KB (55 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/lichess/refs/heads/main/openapi/lichess-bot-api-openapi.yml