Heads-up: chapters, lessons, and quizzes are not included in a standard training export or import. Only the Back up a training endpoint bundles chapters, lessons, and chapter quizzes next to the training JSON.
Table of contents
- Base URL & Headers
- The training export schema
- Export a single training
- Export all trainings (ZIP)
- Import trainings from JSON
- Back up a training
- Import behavior at a glance
- Postman setup
Base URL & Headers
auth:sanctum, the “user is not blocked” check, and the per-company policy middleware.
The training export schema
Every per-training JSON produced by the export and bulk export endpoints follows this shape:categories holds the labels of the training’s categories: one label since 01/11/2026 (a training has one category, see Trainings → Assign categories), still as an array. Files exported earlier can list several.
Export a single training
.json file. Chapters, lessons, and quizzes are not included.
Query parameters
Example request
In Postman, click Send and Download to save the file. The filename follows the pattern {slug}-{YYYY-MM-DD-HH-mm}.json.
Responses
200 OK — file body follows the training export schema.
404 Not Found
403 Forbidden
422 Unprocessable Entity
500 Internal Server Error
Export all trainings (ZIP)
Query parameters
Example request
ZIP layout
Responses
404 Not Found
500 Internal Server Error — ZIP creation failed
500 Internal Server Error — generic failure
Import trainings from JSON
.json files. Accepts either a single file or an array.
⚠️ Import behavior is intentionally conservative:
- Instructor is always forced to the fallback system user (id
2). The originalinstructor_idin the file is ignored.- Media —
image_idandvideo_idare always set tonull.- Visibility —
is_publicis alwaysfalseafter import.- Slug is normalized, truncated to 13 characters, and suffixed with a random 4-character string on collision.
- Category — only the first label of
categoriesis kept (one category per training since 01/11/2026).- Chapters / lessons / quizzes are not imported. Use the chapter/lesson import flow separately.
Form-data fields
Per-file JSON validation
Each uploaded file is validated before insertion:revenue_percentage— required, numeric, between0and100.label— optional (defaults to"Untitled Training").slug— optional (generated fromlabelwhen missing).level— optional (defaults toBeginner).duration,price— optional (default0).discounted_price,views_count— optional.categories— optional array of labels. Only the first label is used (one category per training since 01/11/2026): it is matched by label in the target company and created when missing. The other labels are ignored and never created, so a file exported before 01/11/2026 with several categories keeps its first one.tags— optional array of labels. Missing ones are auto-created for the target company.
Example file payload
intro-to-pmp.json
Postman setup (Body → form-data)
Multi-file upload:Remove any explicitContent-Typeheader in Postman so the client adds the correctmultipart/form-data; boundary=...itself.
Responses
200 OK — all files succeeded
200 OK — partial success
Partial failures still return HTTP200. Always inspect thefailed_trainingsarray.
400 Bad Request — nothing uploaded
422 Unprocessable Entity — bad file type or missing company
Back up a training
Query parameters
Example request
ZIP layout
chapters/*.json is the full chapter record, including its lessons and, since 19/10/2026, a quizzes array with every quiz of the chapter (published and draft, creation order) with questions, options, and option items, plus the deprecated quiz (= the first one). Same shape as the chapter export schema.
Example chapter file
chapter-1-2026-04-17-12-30.json
instructor and computed rating / sales fields). quiz is the deprecated copy of quizzes[0] (or null), kept for older readers; backups made before 19/10/2026 only have quiz.
Responses
404 Not Found
403 Forbidden
500 Internal Server Error
Import behavior at a glance
Postman setup
- Environment variables. Reuse the same environment as your main API collection:
base_url— e.g.http://localhost:8000token— Sanctum token fromPOST /auth/login
- Collection-level headers.
Accept: application/jsonAuthorization: Bearer {{token}}Do not set aContent-Typeheader on the import request — Postman must build the multipart boundary itself.
- Downloading files. For
export,export-all, andbackup, click Send and Download so Postman writes the file to disk. - Smoke-test flow.
GET /trainings/export-import/export-all?company_id=1— download ZIP- Unzip and pick one file
POST /trainings/export-import/importwith that fileGET /trainings?company_id=1— confirm the new training appearsGET /trainings/export-import/backup/{id}?company_id=1— snapshot chapters too