curl --request GET \
--url https://api.example.com/api/stream/event \
--header 'Authorization: <authorization>'{
"type": "<string>",
"game": {
"gameId": "<string>",
"fullId": "<string>",
"color": "<string>",
"fen": "<string>",
"hasMoved": true,
"isMyTurn": true,
"lastMove": "<string>",
"opponent": {},
"perf": "<string>",
"rated": true,
"speed": "<string>",
"variant": {},
"status": {},
"winner": "<string>",
"source": "<string>",
"compat": {}
},
"challenge": {
"id": "<string>",
"url": "<string>",
"status": "<string>",
"challenger": {},
"destUser": {},
"variant": {},
"rated": true,
"speed": "<string>",
"timeControl": {},
"color": "<string>",
"perf": {},
"declineReason": "<string>"
}
}Stream personal events including game starts, game finishes, and challenge notifications
curl --request GET \
--url https://api.example.com/api/stream/event \
--header 'Authorization: <authorization>'{
"type": "<string>",
"game": {
"gameId": "<string>",
"fullId": "<string>",
"color": "<string>",
"fen": "<string>",
"hasMoved": true,
"isMyTurn": true,
"lastMove": "<string>",
"opponent": {},
"perf": "<string>",
"rated": true,
"speed": "<string>",
"variant": {},
"status": {},
"winner": "<string>",
"source": "<string>",
"compat": {}
},
"challenge": {
"id": "<string>",
"url": "<string>",
"status": "<string>",
"challenger": {},
"destUser": {},
"variant": {},
"rated": true,
"speed": "<string>",
"timeControl": {},
"color": "<string>",
"perf": {},
"declineReason": "<string>"
}
}Documentation Index
Fetch the complete documentation index at: https://mintlify.com/lichess-org/lila/llms.txt
Use this file to discover all available pages before exploring further.
GET https://lichess.org/api/stream/event
bot:play - For bot accountsboard:play - For board/external applicationschallenge:read - For reading challenges onlyAuthorization: Bearer lip_yourtokenhere
type field) are sent periodically to prevent connection timeouts.
curl https://lichess.org/api/stream/event \
-H "Authorization: Bearer lip_yourtokenhere"
const token = 'lip_yourtokenhere';
const url = 'https://lichess.org/api/stream/event';
const response = await fetch(url, {
headers: {
'Authorization': `Bearer ${token}`
}
});
const reader = response.body.getReader();
const decoder = new TextDecoder();
while (true) {
const { done, value } = await reader.read();
if (done) break;
const lines = decoder.decode(value).split('\n');
for (const line of lines) {
if (line.trim()) {
const event = JSON.parse(line);
console.log('Event:', event);
}
}
}
import requests
import json
token = 'lip_yourtokenhere'
url = 'https://lichess.org/api/stream/event'
headers = {'Authorization': f'Bearer {token}'}
with requests.get(url, headers=headers, stream=True) as response:
for line in response.iter_lines():
if line:
event = json.loads(line)
if 'type' in event:
print(f"{event['type']} event:", event)
import berserk
session = berserk.TokenSession('lip_yourtokenhere')
client = berserk.Client(session)
for event in client.board.stream_incoming_events():
if event['type'] == 'gameStart':
game_id = event['game']['gameId']
print(f"Game started: {game_id}")
elif event['type'] == 'challenge':
challenge_id = event['challenge']['id']
print(f"Challenge received: {challenge_id}")
{
"type": "gameStart",
"game": {
"gameId": "5IrD6Gzz",
"fullId": "5IrD6Gzz5IrD",
"color": "white",
"fen": "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1",
"hasMoved": false,
"isMyTurn": true,
"lastMove": "",
"opponent": {
"id": "opponent_username",
"username": "OpponentName",
"rating": 1500
},
"perf": "blitz",
"rated": true,
"secondsLeft": 300,
"source": "lobby",
"status": {
"id": 20,
"name": "started"
},
"variant": {
"key": "standard",
"name": "Standard"
},
"speed": "blitz",
"id": "5IrD6Gzz",
"compat": {
"bot": true,
"board": true
}
}
}
{
"type": "gameFinish",
"game": {
"gameId": "5IrD6Gzz",
"fullId": "5IrD6Gzz5IrD",
"color": "white",
"fen": "r1bqkb1r/pppp1ppp/2n2n2/4p3/2B1P3/5N2/PPPP1PPP/RNBQK2R w KQkq - 4 4",
"hasMoved": true,
"isMyTurn": false,
"lastMove": "f6e4",
"opponent": {
"id": "opponent_username",
"username": "OpponentName",
"rating": 1500
},
"perf": "blitz",
"rated": true,
"source": "lobby",
"status": {
"id": 30,
"name": "mate"
},
"variant": {
"key": "standard",
"name": "Standard"
},
"speed": "blitz",
"winner": "black",
"id": "5IrD6Gzz",
"compat": {
"bot": true,
"board": true
}
}
}
{
"type": "challenge",
"challenge": {
"id": "pClLeFUy",
"url": "https://lichess.org/pClLeFUy",
"status": "created",
"challenger": {
"id": "challenger_id",
"name": "ChallengerName",
"title": "GM",
"rating": 2500,
"provisional": false,
"online": true
},
"destUser": {
"id": "your_user_id",
"name": "YourName",
"title": "IM",
"rating": 2400,
"provisional": false,
"online": true
},
"variant": {
"key": "standard",
"name": "Standard",
"short": "Std"
},
"rated": true,
"speed": "blitz",
"timeControl": {
"type": "clock",
"limit": 300,
"increment": 3,
"show": "5+3"
},
"color": "random",
"perf": {
"icon": ")",
"name": "Blitz"
}
},
"compat": {
"bot": true,
"board": true
}
}
{
"type": "challengeDeclined",
"challenge": {
"id": "pClLeFUy",
"url": "https://lichess.org/pClLeFUy",
"status": "declined",
"challenger": {
"id": "your_user_id",
"name": "YourName"
},
"destUser": {
"id": "opponent_id",
"name": "OpponentName"
},
"variant": {
"key": "standard",
"name": "Standard"
},
"rated": true,
"speed": "blitz",
"timeControl": {
"type": "clock",
"limit": 300,
"increment": 3,
"show": "5+3"
},
"declineReason": "generic"
}
}
{
"type": "challengeCanceled",
"challenge": {
"id": "pClLeFUy",
"url": "https://lichess.org/pClLeFUy",
"status": "canceled",
"challenger": {
"id": "challenger_id",
"name": "ChallengerName"
},
"destUser": {
"id": "your_user_id",
"name": "YourName"
},
"variant": {
"key": "standard",
"name": "Standard"
}
}
}
gameStart, gameFinish, challenge, challengeDeclined, challengeCanceledgameStart and gameFinish events)Show Game Fields
Show Challenge Fields
gameStart event, you should immediately connect to the game stream using the game IDfullId field contains the authentication token needed for making movescompat field indicating if the challenge is compatible with bot/board APIs"compat": {"bot": false} cannot be played via the Bot API (e.g., casual games for verified bots)/api/board/game/stream/{gameId} to play movesapp/controllers/Api.scala:292-303 (eventStream method)modules/api/src/main/EventStream.scalaconf/routes:767 (GET /api/stream/event)