Import a PGN into a study
Add a PGN as new chapters to a study you own or can edit.
POST https://cotlet.dev/api/v1/lichess/studies/{study_id}/pgn-to-studies
write Confirm
Creates one chapter per game and returns the chapter IDs and names. A study holds at most 64 chapters, so a larger import fails. Study members, and anyone who can view the study, see the new chapters. By default you confirm each call; you can switch that off for this tool.
Parameters
| Name | Type | Description |
|---|---|---|
| study_id string required | string | Study ID from list_studies. |
| pgn string required | string | PGN text. Several games separated by two blank lines become several chapters. |
| name string | string | Chapter name, 1 to 100 characters. Ignored when the PGN holds several games. |
| orientation string | string | white or black. Detected when empty. |
| mode string | string | practice, conceal or gamebook. Default normal analysis. |
Request
curl -X POST https://cotlet.dev/api/v1/lichess/studies/study_8c41d2/pgn-to-studies \
-H "Authorization: Bearer $COTLET_API_KEY" \
-H "Content-Type: application/json" \
-d '{"pgn":"pgn"}' result = client.call("lichess", "import_pgn_to_study", {"study_id":"study_8c41d2","pgn":"pgn"}) const result = await cotlet.call('lichess', 'import_pgn_to_study', {"study_id":"study_8c41d2","pgn":"pgn"}); cotlet call lichess import_pgn_to_study --data '{"study_id":"study_8c41d2","pgn":"pgn"}' Example response
{
"study_id": "Wk3bPzQa",
"chapters_added": 2,
"chapters": [
{
"chapter_id": "c1Rt8Yup",
"name": "Round 1: Becker vs Silva"
},
{
"chapter_id": "d2Ws9Zvq",
"name": "Round 1: Ortiz vs Okafor"
}
],
"total_chapters": 14
}