auth:sanctum, the “user is not blocked” check, and the per-company policy middleware. Always send your Sanctum token as a Bearer header.
Table of contents
- Base URL & Headers
- List lessons
- Reorder lessons
- Create a lesson
- Retrieve a lesson
- Update a lesson
- Permanently delete a lesson
- Toggle lesson validation for a student
- Postman setup
Base URL & Headers
Y-m-d H:i:s format. Boolean query params accept true, false, 1, 0.
A lesson’spositionis assigned automatically on creation (next available slot per chapter). You only sendpositionwhen you want to change it via update or reorder.
List lessons
GET /lessons
Returns a paginated list of lessons belonging to a given chapter, ordered by position.
Query parameters
Example request
Response — 200 OK
Reorder lessons
POST /lessons/reorder
Bulk-updates the position of multiple lessons in a single call. The request body is a bare array — not an object.
Body
An array of{ id, position } pairs.
Example request
Response — 200 OK
Create a lesson
POST /lesson
Creates a lesson inside a chapter. The position is assigned automatically (one higher than the current maximum for that chapter).
Body parameters
Example request
Responses
200 OK
422 Unprocessable Entity — unknown type
Retrieve a lesson
GET /lesson/{id}
Returns a single lesson.
Example request
Response — 200 OK
404 Not Found
Update a lesson
POST /lesson/{id}
Updates an existing lesson. Unlike create, position is required here — send the current position if you don’t want to move the lesson.
Body parameters
Example request
Response — 200 OK
Permanently delete a lesson
DELETE /lesson/{id}/hard_delete
Force-deletes the lesson. The operation is irreversible.
⚠️ This hard-deletes the record — it does not soft-delete. If you need to keep history, archive upstream (e.g. the chapter or training) instead.
Example request
Response — 200 OK
Toggle lesson validation for a student
POST /lesson/{id}/toggle_lesson_validation
Marks (or un-marks) a lesson as completed for a specific student. This attaches or detaches the student from the lesson in the student_lesson pivot table. The response includes the fresh user progress computed by the Dashboard service, so the client can refresh its progress UI in the same round-trip.
Body parameters
Example request — mark as completed
Example request — un-mark (remove completion)
Response — 200 OK
user_progress matches whatever DashboardsController@userProgress returns for that user. Treat the example above as illustrative, not authoritative.
Error responses
422 Unprocessable Entity — missing or invalid fields:
Postman setup
- Environment variables.
base_url— your API root, e.g.http://localhost:8000token— the Sanctum token returned byPOST /auth/login
- Collection-level headers.
Accept: application/jsonAuthorization: Bearer {{token}}
- Request bodies.
- JSON bodies → Body → raw → JSON
- For Reorder, the body is a bare JSON array, not an object wrapped in a key.
contentmust always be present on create and update — use an empty string ("") rather than omitting it if the lesson has no body text.typeis optional (documentby default). It is set by hand in the training editor: the backend never derives it from the HTML, and every lesson created before 16/10/2026 isdocumentuntil an author switches it tovideo.
- Smoke-test flow.
POST /lesson— createGET /lessons?chapter_id={id}— verify it appearsPOST /lesson/{id}— updatePOST /lessons/reorder— reorder with peersPOST /lesson/{id}/toggle_lesson_validationwithtrue— mark as completedPOST /lesson/{id}/toggle_lesson_validationwithfalse— un-markDELETE /lesson/{id}/hard_delete— cleanup