Skip to main content

Export games by user

Download all games of any user in PGN or ndjson format. Games are sorted by reverse chronological order (most recent first).
This endpoint streams potentially large amounts of data. Make sure to handle the stream properly and avoid loading everything into memory.

Endpoint

Also available at:

Path Parameters

string
required
The username of the player whose games to export

Query Parameters

integer
Download games played since this timestamp (in milliseconds)
integer
Download games played until this timestamp (in milliseconds)
integer
Maximum number of games to download. Leave empty to download all games.
string
Filter games by opponent username
boolean
Download only rated (true) or casual (false) games. Leave empty for both.
string
Filter by speed or variant. Multiple values can be specified, separated by commas.Examples: blitz,rapid,classical, bullet, ultraBullet, chess960, crazyhouse, antichess, atomic, horde, kingOfTheHill, racingKings, threeCheck
string
Filter by player color: white or black
boolean
Download only games with computer analysis available (true) or without (false). Leave empty for both.
boolean
default:"false"
Include ongoing games. Ongoing games will be omitted by default.
boolean
default:"true"
Include finished games. Set to false to only get ongoing games.
boolean
default:"true"
Include the PGN moves
boolean
default:"false"
Include the full PGN within the JSON response (only for ndjson format)
boolean
default:"true"
Include the PGN tags
boolean
default:"false"
Include clock comments in the PGN moves when available. This makes the response significantly larger.
boolean
default:"true"
Include analysis evaluation comments in the PGN when available
boolean
default:"false"
Include accuracy percent of each player when available
boolean
default:"false"
Include the opening name
boolean
default:"false"
Include the division data (plies of opening, middlegame, endgame)
boolean
default:"false"
Insert textual annotations in the PGN about the opening, analysis variations, mistakes, and game termination
string
default:"dateDesc"
Sort order: dateAsc (oldest first) or dateDesc (newest first)

Request Headers

string
Specify the response format:
  • application/x-chess-pgn or application/pgn for PGN format (default)
  • application/x-ndjson for newline-delimited JSON

Example Requests

Download all blitz games as PGN

Download rated games against a specific opponent

Download recent games with analysis

Response Formats

PGN Format

When Accept: application/x-chess-pgn is specified, games are returned in standard PGN format:

NDJSON Format

When Accept: application/x-ndjson is specified, each game is a JSON object on a separate line:

NDJSON Response Fields

string
Game ID
boolean
Whether the game was rated
string
Game variant (standard, chess960, crazyhouse, etc.)
string
Game speed (ultraBullet, bullet, blitz, rapid, classical, correspondence)
string
Performance type used for rating
integer
Game creation timestamp in milliseconds
integer
Timestamp of the last move in milliseconds
string
Game status: created, started, aborted, mate, resign, stalemate, timeout, draw, outoftime, cheat, noStart, unknownFinish, variantEnd
object
Information about both players
string
Game winner: white or black (absent for draws)
object
Opening information (if opening=true)
string
Game moves in UCI or SAN format (if moves=true)
string
Full PGN of the game (if pgnInJson=true)
object
Clock configuration
string
Tournament ID if the game was part of a tournament
object
Game phase division (if division=true)

Rate Limiting

Rate limits depend on:
  • Whether you’re authenticated
  • Whether you’re requesting your own games
  • Your OAuth token’s rate limit
  • Whether you’re verified
Typical limits:
  • Authenticated users (own games): ~60 games per second
  • OAuth requests: ~30 games per second
  • Anonymous requests: ~25 games per second
Use OAuth authentication to get higher rate limits and access private game data.

Streaming Best Practices

  1. Process line by line: Don’t load the entire response into memory
  2. Handle disconnections: Implement retry logic with exponential backoff
  3. Use compression: The server supports gzip compression
  4. Respect rate limits: Space out your requests appropriately

Example: Processing Streamed Games