Classic Chess · REST API

Command-line client

The Python SDK provides the classicchess-api command for archive and account APIs. It needs Python 3.10 or newer and has no runtime dependencies. Catalogs, profiles, biographies, and notable games display readable text in a terminal; pipes and redirected output keep full JSON. Use --names for catalog names only, --plain for readable text, or --json for full data. Game commands also support --pgn.

For Python library use, install the public Python package following its README, then import ClassicChessClient directly.

Then run it

# Master database
classicchess-api master stats -q Capablanca
classicchess-api master games --players Fischer Spassky --year 1972
classicchess-api master export --players Fischer Spassky --year 1972 --output games.pgn
classicchess-api master pgn a1b2c3d4 --output game.pgn
classicchess-api players tal

# Discover complete catalogs (--plain also shows slugs and game counts)
classicchess-api public players --names
classicchess-api public events --names
classicchess-api annotated books --names
classicchess-api public players --plain

# Use exact player slugs from the list
classicchess-api public player mikhail-tal
classicchess-api public bio mikhail-tal
classicchess-api public notable mikhail-tal
classicchess-api public notable mikhail-tal --json
classicchess-api public events --plain
classicchess-api public events -q London
classicchess-api public games --archive-event london-1851 --all-pages
classicchess-api public games --archive-player mikhail-tal --eco B33 --all-pages
classicchess-api public games --archive-player mikhail-tal --since 1960 --until 1965
classicchess-api public export --archive-player mikhail-tal --output tal.pgn
classicchess-api public pgn mikhail-tal/tal-vs-larsen-1965

# Account collections
CLASSICCHESS_API_TOKEN=... classicchess-api account collections list
CLASSICCHESS_API_TOKEN=... classicchess-api account collections import-player "Tal 1960-1965" mikhail-tal --since 1960 --until 1965

Installed Python package

python3 -m classicchess_api players tal
from classicchess_api import ClassicChessClient

client = ClassicChessClient()
stats = client.master_stats(query="Fischer Spassky")
games = client.master_games("Fischer Spassky 1972", page_size=10)

Add --all-pages to follow pagination automatically and --limit to cap the number of results. Account commands read CLASSICCHESS_API_TOKEN or --api-token.