Enroll user to course
Endpoint URL
POST /api/v2/enrollments
Enroll user to course. Enrolls a user into a specific course. Provide the course's unique ID using the course_id attribute and identify the user either by their unique ID using the user_id attribute or by their email address using the user_email attribute. course_id is required, and one of user_id or user_email is required. When both user_id and user_email are provided, user_id is used and user_email is ignored. Optionally provide role (learner or instructor) to choose the course role; when omitted, or when the user type does not allow the requested role, the default role of the user type is used. If the request is valid and both the user and course exist, the API creates the enrollment and returns the user's role in the course.
Request
Responses
- 200
- 400
- 403
- 404
- 409
Successful response
Invalid or missing request body fields, an unsupported role, or the user type is neither a learner nor an instructor
The user is dummy or archived, or the course is archived or unavailable
User or course not found, or no user matches the given user email
The user is already enrolled in the course, or there are no licenses available for it