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

ParameterTypeDescription
pagestringQuery parameter
limitstringQuery parameter
statusstringQuery parameter
courseIdstringQuery parameter

Error Responses

Status CodeError CodeDescription
401HTTP_401Unauthorized
404HTTP_404Not Found
500HTTP_500Internal Server Error
500HTTP_500Internal Server Error
401HTTP_401Unauthorized
404HTTP_404Not Found
400HTTP_400Bad Request
403HTTP_403Forbidden
404HTTP_404Not Found
404HTTP_404Not Found
403HTTP_403Forbidden
409HTTP_409Error
500HTTP_500Internal Server Error
500HTTP_500Internal Server Error

Example Request

curl -X POST "https://api.allurelms.com/enrollments" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{}'