Introduction
The Lichess API provides programmatic access to Lichess’s features and data. It’s free, open, and used by thousands of applications worldwide.REST API
Standard HTTP endpoints for games, users, tournaments, and more
Streaming API
Server-Sent Events for real-time game updates and activity
Bot API
Build chess bots that play on Lichess automatically
Authentication
OAuth2 for accessing user data and actions
Base URL
All API requests use the base URL:Response Formats
The API supports multiple response formats:JSON (Application/JSON)
JSON (Application/JSON)
Standard JSON responses for most endpoints. Include
Accept: application/json header or .json extension.NDJSON (Application/x-ndjson)
NDJSON (Application/x-ndjson)
Newline-delimited JSON for streaming endpoints. Each line is a complete JSON object.
PGN (Application/x-chess-pgn)
PGN (Application/x-chess-pgn)
Standard chess notation format for game data.
Authentication
Most endpoints work without authentication, but some features require an OAuth2 access token:- Creating games or challenges
- Accessing private user data
- Managing your account
- Bot API endpoints
Rate Limiting
Rate limits protect the API from abuse:- Anonymous requests: More restrictive limits
- Authenticated requests: Higher limits based on account standing
- Streaming endpoints: Connection-based limits
Versioning
The Lichess API does not use explicit versioning. Changes are backward-compatible when possible, with deprecation notices for breaking changes.Subscribe to the Lichess changelog for API updates and announcements.
Best Practices
Use streaming endpoints
For real-time data, use streaming endpoints (NDJSON) instead of polling. This reduces load and provides instant updates.
Handle errors gracefully
Implement exponential backoff for rate limit errors. Handle network failures with retries.
HTTP Status Codes
The API uses standard HTTP status codes:| Code | Meaning |
|---|---|
| 200 | Success |
| 201 | Resource created |
| 204 | Success with no content |
| 400 | Bad request (invalid parameters) |
| 401 | Unauthorized (missing or invalid token) |
| 403 | Forbidden (insufficient permissions) |
| 404 | Resource not found |
| 429 | Too many requests (rate limited) |
| 500 | Internal server error |
Getting Help
Discord Community
Join the Lichess Discord for API support and discussions
GitHub Issues
Report bugs or request features on GitHub
Next Steps
Authentication
Set up OAuth2 authentication
Export Games
Download game data in PGN or JSON
Bot API
Create a chess bot

