Lichess API

Games & Comics / OAuth Advanced HTTPS
Varies by plan (check documentation)

Overview

Lichess is a free, open-source chess platform, and its API lets you access games, puzzles, player stats, and real-time tournament data. Many endpoints are public and require no authentication, while actions like creating challenges need OAuth. It is a great API for chess enthusiasts who want to build tools or analyze games.

💡

Beginner Tip

Start with a public endpoint like fetching a user profile (no API key needed) — try /api/user/{username} with a known Lichess username to see game counts and ratings. For write operations like creating challenges, you will need to set up OAuth.

Available Data

Lichess data via REST API
JSON-formatted response data
Requires OAuth authentication

Example Response

JSON Response
{
  "id": 1,
  "name": "Lichess",
  "data": "Access to all data of users, games, puzzles and etc on Lichess",
  "source": "Lichess"
}

Field Reference

id Lowercase username used as the unique identifier on Lichess
username Display username with original casing
perfs Performance ratings keyed by game variant (e.g. blitz, rapid, classical), each containing rating and games count
createdAt Unix timestamp (milliseconds) when the account was created
playTime Total and TV play time in seconds
count Game count breakdown: all, rated, win, loss, draw, etc.

Implementation Example

// ⚠️ Note: This URL may be a documentation page. Check official docs for actual API endpoint.
const url = "https://lichess.org/api";
// Replace headers or query params with the values required by this API.
const response = await fetch(url, {
  headers: {
  "Authorization": "Bearer YOUR_API_KEY"
  }
});
if (!response.ok) throw new Error(`Request failed: ${response.status}`);
const data = await response.json();
console.log(data);

What Can You Build?

Note: These code examples are AI-generated and unverified. Always refer to the official API documentation for accurate usage.

Common Errors & Troubleshooting

429 Too Many Requests Exceeding the rate limit — unauthenticated requests are throttled more aggressively
Add a delay between requests and authenticate with an OAuth token to get a higher rate limit
401 Unauthorized Accessing a protected endpoint without a valid OAuth token
Generate a personal API token in your Lichess account settings under API Access Tokens and include it as a Bearer token
NDJSON stream parsing errors Some endpoints return newline-delimited JSON (NDJSON) instead of a standard JSON array
Split the response body by newlines and parse each line individually as a separate JSON object

Matrix Score Breakdown

🌐 Reachability 0/30
⚡ Speed 15/20
🔒 Security 15/15
🛠 Developer XP 3/20
✓ Reliability 0/15

Partially tested on Apr 5, 2026

Technical Specifications

Auth OAuth
HTTPS REQUIRED
CORS UNKNOWN
Category Games & Comics
Difficulty Advanced
Verified: 2026-04-04

Similar APIs

View All →