Docs / Import and export

Course import/export - formats, modes, ZIP and errors

Two equivalent formats

  • Single file (.md): the default, recommended for AI. See the single-file format.
  • ZIP archive: a complete backup, suited to large courses (one file per page).

Both contain the same information and convert into each other without loss. On import the format is detected from the content (the PK signature for a ZIP), not from the file extension.

Two export modes

  • With references (default for the single file): the games, repertoires and puzzle suites used by the course remain links (id). Light and safe to have rewritten, but meant to be re-imported into the same account.
  • With resources (default for the ZIP): the resources you own are included in the file (as resource blocks) and recreated on import in the importing account, as private resources, before the course. This works across accounts. A resource owned by someone else, or that no longer exists, stays a reference (warning RESOURCE_NOT_EXPORTED).

Content of an embedded resource:

  • game: the PGN of the game (moves, variations, comments), without engine annotations;
  • repertoire: the PGN of the repertoire tree, with variations; parameters color (white or black), depthLimit, coverageThreshold;
  • puzzles from the Lichess database: parameters only (suiteType: lichess, themes, ratingMin, ratingMax, puzzleCount, seed, trackingMode, solveMode, fingerprint puzzleIdsSha256). The suite is recreated with the same seed; the warning SUITE_SELECTION_CHANGED tells you if the puzzle database has changed since the export;
  • puzzles custom suite: JSON, a list of puzzles {fen, moves, orientation, score, gameTitle, moveNumber, noIntro}; parameters suiteType: custom, introMove, defaultRating, keyMoves.

ZIP structure

course.json
pages/01-<module>/01-<page>.md
resources/games|repertoires|puzzle-suites/<key>.pgn|.json

course.json contains format: "lilychess-course", version: 1, exportMode, exportedVersion, courseId, course (title, description, baseLang, titleI18n, descriptionI18n, visibility, acceptMode), modules (each with key, id, title, titleI18n, optional preview and pages with key, id, title, titleI18n, file, published, baseHash) and resources (key, type, label, sourceId, params, file). Paths are relative, use /, and live under pages/ or resources/.

Limits

  • Single file: 20 MB.
  • ZIP: 20 MB compressed, 60 MB uncompressed, 1,000 entries.
  • At most 50 modules, 500 pages, and 1 MB per page (source text, language blocks included).
  • Paths containing .., absolute paths, backslashes, or anything outside course.json, pages/ and resources/ are refused (ARCHIVE_BAD_PATH).

How an import works

  1. The whole file is checked before anything is created: nothing is created if there is an error. Every page goes through the same checks as saving in the editor.
  2. A quote is shown, then you confirm.
  3. A new private course is created, with its pages as drafts. If something fails, everything is removed and the credits are refunded.

Creating a course, games, repertoires and puzzle suites costs the same credits as creating them one by one (see Pricing), and the quotas of your plan are cumulated over the whole file. The quote shows the exact total before you confirm.

Common report errors

  • FORMAT_UNKNOWN: wrong first line or signature.
  • FRONTMATTER_INVALID: malformed front matter (the line number is given).
  • SINGLE_PAGE_WITHOUT_MODULE, SINGLE_ORDER: a block is misplaced.
  • PAGE_TAG_INVALID: a page tag was refused (illegal diagram line, ply out of range, missing id…).
  • PAGE_LINK_UNKNOWN: a [[page:key]] points to a page that is not in the file.
  • RESOURCE_UNAVAILABLE: a resource is missing or not shared (an option replaces it with its label in bold).
  • RESOURCE_INVALID, SUITE_LIMIT, PLAN_LIMIT, INSUFFICIENT_CREDITS: invalid resource, quota reached, not enough credits.
  • ARCHIVE_*, MANIFEST_*, PAGE_FILE_MISSING, PAGE_NOT_UTF8, UNSUPPORTED_VERSION: ZIP problems.

The report is capped at 400 issues; the exact count is shown.