- Update course progress (mark lectures as completed)
- Get current course progress
Update Course Progress
Mark a lecture as completed and update the user’s course progress. Automatically generates a certificate when course is completed.Authentication
Requires authentication via Clerk. TheuserId is automatically extracted from the authentication token.
Request Body
The unique identifier of the course
The unique identifier of the lecture to mark as completed
Response
Indicates whether the request was successful
Status message (e.g., “Progress Updated”)
True if all lectures in the course are now completed
True if a certificate has been generated and is available for download
Request Example
Response Examples
Error Codes
| Status Code | Description |
|---|---|
| 200 | Success |
| 400 | Invalid request data |
| 401 | Unauthorized - Invalid or missing authentication token |
| 403 | Course not purchased |
| 404 | Course not found |
| 500 | Internal server error |
Behavior Notes
- Uses
$addToSetto prevent duplicate lecture completions - Creates a
CourseProgressdocument if it doesn’t exist (upsert) - Automatically marks course as completed when all lectures are finished
- Generates a certificate PDF and uploads to Cloudinary when course is completed
- Certificate includes QR code for verification
Validation Schema
Get Course Progress
Retrieve the user’s progress for a specific course.Authentication
Requires authentication via Clerk. TheuserId is automatically extracted from the authentication token.
Request Body
The unique identifier of the course
Response
Indicates whether the request was successful
Course progress data or null if no progress exists
Error message if success is false
Request Example
Response Examples
Error Codes
| Status Code | Description |
|---|---|
| 200 | Success |
| 400 | Invalid request data |
| 401 | Unauthorized - Invalid or missing authentication token |
| 500 | Internal server error |