POST /enrollments
POST /enrollments
GET /api/enrollments - List enrollments for the authenticated user Check authentication with Clerk Get user's profile to determine role and tenant Parse query parameters Build query Role-based filtering Learners only see their own enrollments Instructors see enrollments in their courses OR their own enrollments Admins see all enrollments (no additional filter) Apply status filter Apply course filter Apply pagination and ordering Helper function to get instructor's course IDs Return dummy UUID if no courses POST /api/enrollments - Enroll in a course Check authentication with Clerk Get user's profile Parse request body Determine target user (for admin enrolling others) Only admins can enroll other users If enrolling another user, verify they exist in the same tenant Verify course exists, is published, and in the same tenant Learners can only enroll in published courses Check for existing enrollment Create enrollment
Endpoint
POST /enrollments
Authentication
This endpoint requires authentication. Include your authentication token in the request headers.
Query Parameters
| Parameter | Type | Description |
|---|---|---|
page | string | Query parameter |
limit | string | Query parameter |
status | string | Query parameter |
courseId | string | Query parameter |
Error Responses
| Status Code | Error Code | Description |
|---|---|---|
| 401 | HTTP_401 | Unauthorized |
| 404 | HTTP_404 | Not Found |
| 500 | HTTP_500 | Internal Server Error |
| 500 | HTTP_500 | Internal Server Error |
| 401 | HTTP_401 | Unauthorized |
| 404 | HTTP_404 | Not Found |
| 400 | HTTP_400 | Bad Request |
| 403 | HTTP_403 | Forbidden |
| 404 | HTTP_404 | Not Found |
| 404 | HTTP_404 | Not Found |
| 403 | HTTP_403 | Forbidden |
| 409 | HTTP_409 | Error |
| 500 | HTTP_500 | Internal Server Error |
| 500 | HTTP_500 | Internal Server Error |
Example Request
curl -X POST "https://api.allurelms.com/enrollments" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{}'