canonical: https://jentic.com/apis/lichess.org/lichess-org-api-reference

# Lichess.org API reference

Jentic publishes the only available OpenAPI specification for Lichess.org API reference, keeping it validated and agent-ready. The Lichess API exposes the free, open-source chess platform's full feature set including account management, game streaming, puzzle workflows, broadcasts, tournaments, bot play, and analysis. Agents can stream live game events, fetch player rating histories, query the opening explorer and tablebase, run puzzle dashboards, and operate Lichess bots. The API is OAuth2-protected with personal access tokens and supports newline-delimited JSON streaming for board events and TV feeds.

## For AI agents

Read player profiles, stream chess games, run puzzle workflows, and operate bots on Lichess via OAuth2-authenticated endpoints across 170 path entries.

## Scope

Does not handle over-the-board tournament management, chess engine hosting, or paid premium-account billing - use for Lichess platform game, puzzle, and bot operations only.

## Capabilities

- Stream live game state and board events for ongoing Lichess games via NDJSON feeds
- Fetch user profiles, rating histories, and per-perf statistics for any Lichess account
- Query the opening explorer and Syzygy tablebase to evaluate chess positions
- Operate a Lichess bot account with move submission, chat, and game acceptance endpoints
- Run puzzle dashboards, daily puzzles, and racer/storm activity feeds for training analysis
- Manage broadcasts, tournaments, and bulk pairings for organized chess events

## Use cases

### Chess Coaching Dashboard

Pull player rating history, puzzle activity, and game archives from Lichess to build a coaching dashboard that highlights weaknesses across openings and time controls. Endpoints cover rating-history, per-perf statistics, and puzzle dashboards across configurable day windows. Integration takes a few hours via OAuth2 with read-only scopes.

Example prompt: Fetch the rating history for username 'DrNykterstein' and the last 30 days of puzzle dashboard activity, then summarize weakest opening categories

### Live Tournament Broadcast

Stream Lichess broadcasts and tournament games for live commentary or visualization. The broadcasts and tournaments tags expose round-by-round PGN streaming so agents can react to moves as they happen. Suited for chess news sites and streaming overlays needing sub-second latency.

Example prompt: Subscribe to the broadcast round stream for tournament ID 'broadcast-id-123' and emit each move as it arrives

### Chess Bot Operation

Run a chess bot on Lichess by upgrading an account to bot status, accepting challenges, and submitting moves through the bot endpoints. The Board and Bot tags expose the full game lifecycle including chat, draw offers, and resignation. A working bot integration takes one to two days versus weeks of manual UCI plumbing.

Example prompt: Accept the next incoming challenge for the authenticated bot account and play a move every time it is the bot's turn

### AI Agent Chess Analysis

An AI agent uses Jentic to discover Lichess endpoints by intent, then composes opening explorer queries, tablebase lookups, and game export operations to analyze a user's recent games. Agents avoid scraping the web UI by calling the structured API directly through Jentic's your Jentic One instance credential vault.

Example prompt: Search Jentic for 'analyze a chess game on Lichess', load the game export and opening explorer schemas, then produce a move-by-move analysis for game ID 'abc123'

## Key endpoints

| Method | Path | Description |
| --- | --- | --- |
| GET | `/api/user/{username}` | Get public profile for a Lichess user |
| GET | `/api/user/{username}/rating-history` | Get rating history across all perfs |
| GET | `/api/users/status` | Get realtime online status for users |
| GET | `/api/puzzle/daily` | Get the daily Lichess puzzle |
| GET | `/game/export/{gameId}` | Export a game as PGN or JSON |

## Key resources

- **Account** — Authenticated user profile, email, preferences, and timeline operations
- **Games** — Export games as PGN, stream ongoing games, and query game metadata
- **Puzzles** — Daily puzzle, puzzle batches, dashboards, and racer/storm activity
- **Bot** — Bot account upgrade, challenge acceptance, and move submission
- **Broadcasts** — Live tournament round streaming and broadcast management
- **Opening Explorer** — Query Masters, Lichess, and player opening databases by FEN

## Why Jentic

- **Setup:** Wiring the Lichess API by hand means running its OAuth2 flow, matching the right scopes to each of the 170 operations across games, puzzles, and bots, and calling lichess.org yourself. Through Jentic you install once, import the Lichess API from the API Directory, store the token once, and your agent calls it.
- **Permission scoping:** Lichess reads carry the username or game id in the path (`/api/user/{username}`, `/game/export/{gameId}`) while account and bot actions run against fixed endpoints, so scope the agent to the operations it needs, such as fetching a rating history or the daily puzzle. You leave out account or bot-move operations unless you add them, so it only calls the ones you allow.
- **Credential handling:** Your Lichess OAuth2 token is stored once, encrypted, by your own Jentic One instance and injected at execution time. It never enters the agent's prompt, logs, or context.
- **Discovery method:** Agents search Jentic by intent such as 'fetch a Lichess rating history' or 'get the daily puzzle', and Jentic returns the matching Lichess operation with its input schema and required scopes so the agent calls the right endpoint without browsing the reference docs.

## Related APIs

- **Twitter API v2** — Post Lichess game results and broadcasts to social timelines
- **Spotify Web API** — Pair chess streaming with curated background playlists for a chess-content overlay
- **Lichess.org API reference** — Identical Lichess spec under the 'main' slug

## FAQ

### Why is there no official OpenAPI spec for Lichess.org API reference?

Lichess does not publish a maintained OpenAPI specification. Jentic generates and maintains this spec so that AI agents and developers can call the Lichess API via structured tooling. It is validated against the live API and kept up to date. Get started with Jentic One, the self-hosted execution layer.

### What authentication does the Lichess API use?

Lichess uses OAuth2 with personal access tokens. Scopes determine which endpoints are accessible - for example, 'bot:play' is required for bot move submission and 'preference:read' for account preferences. Through Jentic, the token is stored in your Jentic One instance and never enters the agent's prompt context.

### Can I run a chess bot with the Lichess API?

Yes. Upgrade an empty account to bot status via `/api/bot/account/upgrade`, then use `/api/bot/game/stream/{gameId}` and `/api/bot/game/{gameId}/move/{move}` to play. Bot accounts cannot have played any human games before upgrade.

### What are the rate limits for the Lichess API?

Lichess applies per-endpoint rate limits - most read endpoints allow 20 requests per second per IP, and abusive clients receive HTTP 429 responses. Streaming endpoints count separately. Exceeding limits returns 429 with a Retry-After hint.

### How do I stream live game events through Jentic?

Run pip install jentic, then search Jentic with 'stream a Lichess game' to retrieve the `/api/board/game/stream/{gameId}` operation schema. Execute it through the SDK; Jentic returns NDJSON chunks as the game progresses.

### Is the Lichess API free?

Yes. Lichess is free and open-source, and the API has no paid tier. Heavy commercial use should respect the rate limits and the Lichess terms of service.

### Can I limit what my agent is allowed to do with the Lichess API?

Yes. Because Jentic One is self-hosted, your own rules decide which of the 170 Lichess operations and which OAuth2 token the agent may use. You can allow only the read operations you need, such as GET `/api/user/{username}/rating-history` or GET `/api/puzzle/daily`, and leave out account or bot-move endpoints like `/api/bot/game/{gameId}/move/{move}` unless you explicitly add them. The agent can call only the operations you grant, and the stored token is injected at execution time rather than exposed to the model.
