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)

OpenAPI Specification

lichess-bot-api-openapi.yml Raw ↑
openapi: 3.1.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:
    PuzzleModePerf:
      type: object
      properties:
        runs:
          type: integer
        score:
          type: integer
      required:
      - runs
      - score
    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
    ChallengeColor:
      type: string
      enum:
      - white
      - black
      - random
    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
    GameFullEvent:
      type: object
      properties:
        type:
          type: string
          const: gameFull
        id:
          type: string
        variant:
          $ref: '#/components/schemas/Variant'
        clock:
          type: object
          properties:
            initial:
              type: integer
              format: int64
              description: Initial time in milliseconds
            increment:
              type: integer
              format: int64
              description: Increment time in milliseconds
        speed:
          $ref: '#/components/schemas/Speed'
        perf:
          type: object
          properties:
            name:
              type: string
              description: Translated perf name (e.g. "Classical" or "Blitz")
        rated:
          type: boolean
        createdAt:
          type: integer
          format: int64
        white:
          $ref: '#/components/schemas/GameEventPlayer'
        black:
          $ref: '#/components/schemas/GameEventPlayer'
        initialFen:
          type: string
          default: startpos
        state:
          $ref: '#/components/schemas/GameStateEvent'
        daysPerTurn:
          type: integer
          description: If the game is correspondence
        tournamentId:
          type: string
      required:
      - type
      - id
      - variant
      - speed
      - perf
      - rated
      - createdAt
      - white
      - black
      - initialFen
      - state
      example:
        id: BEOucQJo
        variant:
          key: standard
          name: Standard
          short: Std
        speed: rapid
        perf:
          name: Rapid
        rated: false
        createdAt: 1745112707998
        white:
          id: bobby
          name: Bobby
          title: null
          rating: 1751
        black:
          id: mary
          name: Mary
          title: null
          rating: 1021
        initialFen: startpos
        clock:
          initial: 900000
          increment: 0
        type: gameFull
        state:
          type: gameState
          moves: d2d3
          wtime: 900000
          btime: 900000
          winc: 0
          binc: 0
          status: started
    Variant:
      type: object
      properties:
        key:
          $ref: '#/components/schemas/VariantKey'
        name:
          type: string
        short:
          type: string
      required:
      - key
      - name
    GameStateEvent:
      type: object
      properties:
        type:
          type: string
          const: gameState
        moves:
          type: string
          description: 'Current moves in UCI format (King to rook for Chess690-compatible castling

            notation)

            '
        wtime:
          type: integer
          description: Integer of milliseconds White has left on the clock
        btime:
          type: integer
          description: Integer of milliseconds Black has left on the clock
        winc:
          type: integer
          description: Integer of White Fisher increment.
        binc:
          type: integer
          description: Integer of Black Fisher increment.
        status:
          $ref: '#/components/schemas/GameStatusName'
        winner:
          $ref: '#/components/schemas/GameColor'
          description: Color of the winner, if any
        wdraw:
          type: boolean
          description: true if white is offering draw, else omitted
        bdraw:
          type: boolean
          description: true if black is offering draw, else omitted
        wtakeback:
          type: boolean
          description: true if white is proposing takeback, else omitted
        btakeback:
          type: boolean
          description: true if black is proposing takeback, else omitted
        expiration:
          type: object
          description: A game may be aborted if a player doesn't make their first move in time
          properties:
            idleMillis:
              type: integer
              description: Milliseconds since the last move was played, or since the game started
            millisToMove:
              type: integer
              description: Time each player has to make their first move, before the game is aborted
          required:
          - idleMillis
          - millisToMove
      required:
      - type
      - moves
      - wtime
      - btime
      - winc
      - binc
      - status
      example:
        type: gameState
        moves: e2e4 c7c5 f2f4 d7d6 g1f3 b8c6 f1c4 g8f6 d2d3 g7g6 e1g1 f8g7 b1c3
        wtime: 7598040
        btime: 8395220
        winc: 10000
        binc: 10000
        wdraw: false
        bdraw: false
        wtakeback: false
        btakeback: false
        status: started
    ChallengeCanceledEvent:
      type: object
      properties:
        type:
          type: string
          const: challengeCanceled
        challenge:
          $ref: '#/components/schemas/ChallengeJson'
      required:
      - type
      - challenge
    PlayTime:
      type: object
      properties:
        total:
          type: integer
        tv:
          type: integer
        human:
          type: integer
      required:
      - total
      - tv
    Patron:
      type: boolean
      deprecated: true
      description: 'Use patronColor value instead to determine if player is a patron.

        '
    VariantKey:
      type: string
      enum:
      - standard
      - chess960
      - crazyhouse
      - antichess
      - atomic
      - horde
      - kingOfTheHill
      - racingKings
      - threeCheck
      - fromPosition
      example: standard
      default: standard
    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:
     

# --- 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