List Enrollments
Retrieves all enrollments for the authenticated user.Response
Array of enrollment objects
Example Request
Example Response
Create Enrollment
Enrolls a user in a course. Checks prerequisites and updates enrollment count.Request Body
Course ID to enroll in
Admin only: Enroll another user by their UUID
Admin only: Skip prerequisite checks (default: false)
Response
Created enrollment object
Example Request
Example Response
Update Enrollment Status
Updates the status of an enrollment (e.g., mark as completed).Request Body
Course ID
New status: “active”, “completed”, “suspended”
Response
Updated enrollment object
Example Request
Notes
- Setting status to “completed” automatically sets
completed_attimestamp and progress to 100% - Triggers email notifications for course completion
- Sends admin notification about the completion
Prerequisite Validation
When enrolling in a course with prerequisites, the API validates:- All prerequisite courses must be completed
- Completion is verified by
completed_attimestamp being set - In-progress enrollments are not sufficient
Prerequisite Error Response
Enrollment Notifications
The API automatically triggers email notifications:- On Enrollment: Welcome email with course access details
- On Completion: Congratulations email with certificate link (if enabled)
- Admin Notification: Notifies admin when a user completes a course
Admin Enrollment
Admins can enroll other users by providing theuserId parameter:
Error Codes
| Status Code | Description |
|---|---|
| 200 | Success |
| 400 | Bad Request - Prerequisites not met or invalid parameters |
| 401 | Unauthorized - Authentication required |
| 403 | Forbidden - Admin access required |
| 404 | Not Found - Enrollment or course not found |
| 409 | Conflict - User already enrolled |
| 500 | Internal Server Error |