GET /reports/course/:courseId/completion
GET /api/reports/course/[courseId]/completion Verify authentication with Clerk Get user's profile to determine role and tenant Verify user has access (instructor or admin) Fetch the course Role-based access: instructors can only see their own courses Parse optional query parameters Get all enrollments for this course Apply date filters if provided Calculate statistics Calculate average completion time (in hours) Convert ms to hours Get activity progress for score calculation Calculate average score across all assessments Build learner details array Get user's average score for this course Round to 2 decimal places Round to 2 decimal places Round to 2 decimal places
Endpoint
GET /reports/course/:courseId/completion
Authentication
This endpoint requires authentication. Include your authentication token in the request headers.
Path Parameters
| Parameter | Type | Description |
|---|
courseId | string | Path parameter |
Query Parameters
| Parameter | Type | Description |
|---|
dateFrom | string | Query parameter |
dateTo | string | Query parameter |
status | string | Query parameter |
Error Responses
| Status Code | Error Code | Description |
|---|
| 401 | HTTP_401 | Unauthorized |
| 404 | HTTP_404 | Not Found |
| 403 | HTTP_403 | Forbidden |
| 404 | HTTP_404 | Not Found |
| 403 | HTTP_403 | Forbidden |
| 500 | HTTP_500 | Internal Server Error |
| 500 | HTTP_500 | Internal Server Error |
Example Request
curl -X GET "https://api.allurelms.com/reports/course/courseId-value/completion" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json"