Skip to main content

Export a single study

This endpoint is rate limited.
Exports all chapters of a study in PGN format.

Path Parameters

string
required
The study ID (8 characters)

Query Parameters

boolean
default:"true"
Include clock comments in the PGN moves, when available.Example: 2. exd5 { [%clk 1:01:27] } e5 { [%clk 1:01:28] }
boolean
default:"true"
Include analysis and annotator comments in the PGN moves, when available.Example: 12. Bxf6 { [%cal Gf6g7] } gxf6 { White is slightly better here. }
boolean
default:"true"
Include non-mainline moves, when available.Example: 4. d4 Bb4+ (4... Nc6 5. Nf3 e6 6. Bd3) 5. Nd2
boolean
default:"false"
Add a Source PGN tag with the study chapter URL.
boolean
default:"false"
Add a Orientation PGN tag with the chapter’s configured orientation.

Response

Returns a PGN file with all chapters of the study. Each chapter is represented as a separate game in the PGN.
string
application/x-chess-pgn
string
attachment; filename="{study-name}.pgn"

Example


Export a single chapter

Exports a single chapter of a study in PGN format.

Path Parameters

string
required
The study ID (8 characters)
string
required
The chapter ID (8 characters)

Query Parameters

boolean
default:"true"
Include clock comments in the PGN moves, when available.
boolean
default:"true"
Include analysis and annotator comments in the PGN moves, when available.
boolean
default:"true"
Include non-mainline moves, when available.
boolean
default:"false"
Add a Source PGN tag with the study chapter URL.
boolean
default:"false"
Add a Orientation PGN tag with the chapter’s configured orientation.
boolean
default:"false"
If the chapter has a computer analysis, include it in a custom X-Lichess-Analysis HTTP header.The analysis is returned as a JSON object containing evaluation and best moves.

Response

Returns a PGN file with the requested chapter.
string
application/x-chess-pgn
string
attachment; filename="{study-name}_{chapter-name}.pgn"
string
JSON analysis data (only if analysisHeader=true and analysis is available)

Example


Export all studies of a user

Download all chapters of all studies owned by a user, in PGN format.
If authenticated as the user, private and unlisted studies are included. Otherwise, only public studies are exported.

Path Parameters

string
required
The username. Use me to export studies of the authenticated user.

Query Parameters

boolean
default:"true"
Include clock comments in the PGN moves, when available.
boolean
default:"true"
Include analysis and annotator comments in the PGN moves, when available.
boolean
default:"true"
Include non-mainline moves, when available.
boolean
default:"false"
Add a Source PGN tag with the study chapter URL.
boolean
default:"false"
Add a Orientation PGN tag with the chapter’s configured orientation.

Response

Returns a streaming PGN file containing all chapters from all studies. This may be a very large file depending on how many studies the user has created.
string
application/x-chess-pgn
string
attachment; filename="{username}-all-studies.pgn" or {username}-public-studies.pgn

Example


List studies of a user

Get metadata about all studies owned by a user.
If authenticated as the user, private and unlisted studies are included. Otherwise, only public studies are returned.

Path Parameters

string
required
The username

Response

Returns an nd-json stream of study metadata objects.
string
The study ID
string
The study name
integer
Unix timestamp in milliseconds
integer
Unix timestamp in milliseconds
object
Study owner information
array
List of study members (contributors)
integer
Number of chapters in the study
integer
Number of likes the study has received
string
One of: public, unlisted, or private

Example