Classic Chess · REST API

Opening explorer

GET /api/v1/opening-explorer/

Explore a position from an indexed Classic Chess source. Supports Lichess-style fen + play lookup.

ParameterRequiredDescription
fennoRoot FEN; omitted means the normal starting position.
playnoComma-separated UCI moves from the root, such as d2d4,d7d5; max 100 moves / 512 characters.
movesnoNumber of candidate moves (default 12, max 50).
topGamesnoNumber of reference games (default site setting, max 15).
since / untilnoInclusive year range for sources with year indexes (1400-9999).
source_type / source_keynoSelect a public key returned by the sources endpoint; the master database key is masterdb.

Example

curl "https://classicchess.com/api/v1/opening-explorer/?play=d2d4,d7d5&moves=8&topGames=15&until=1900"
GET /api/v1/opening-explorer/sources/

List currently indexed opening explorer sources.

GET /api/v1/opening-explorer/lichess/

Explore a position in the Lichess opening database. Classic Chess relays the request with its own Lichess credential, so clients never need a Lichess token. Without player the answer covers the whole Lichess database; with a Lichess username it covers that player's games. Moves carry uci, san and White/draw/Black counts; sample games carry the Lichess game id, player names, winner and month. Each client may make 60 requests per minute; an exhausted budget returns 429 with Retry-After, and 503 means Lichess is unavailable or not configured.

ParameterRequiredDescription
fennoPosition to explore; omitted means the normal starting position.
playernoLichess username (2-30 letters, digits, _ or -). Blank means the whole Lichess database.
colornoboth (default), white or black: the player's side. Used only with player.
resultnoall (default), win, loss or draw from the player's side. Any value other than all requires player.

Example

curl "https://classicchess.com/api/v1/opening-explorer/lichess/?player=DrNykterstein&color=white"
GET /api/v1/tablebase/

Exact endgame results for a legal position: coverage, WDL, DTZ and every legal move's outcome. Positions with at most 5 pieces use the site's local Syzygy tables when installed; 6 and 7 pieces use the Lichess tablebase, which is also the fallback for smaller positions. 8-piece answers are labeled partial; 9 or more pieces return covered false with a message. Missing or illegal FENs return 400. Each client may make 60 requests per minute.

ParameterRequiredDescription
fenyesA legal position in FEN, at most 200 bytes.

Example

curl -fsS "https://classicchess.com/api/v1/tablebase/?fen=8/8/8/8/8/2k5/2P5/2K5%20w%20-%20-%200%201"