Skip to content

Remove Student from Course

The removeStudentFromCourse mutation allows you to completely remove a student’s enrollment from a specified course. This action revokes the student’s access to course content and removes all enrollment records.

Input Parameters

FieldTypeDescription
userIdString!ID of the student (User) to remove from the course
courseIdString!ID of the course to remove the student from

Return Fields

FieldTypeDescription
successBoolean!Indicates whether the removal was successful
messageStringAdditional information about the operation result
type RemoveStudentFromCoursePayload {
success
message
}

Example

mutation {
removeStudentFromCourse(
userId: "a1b2c3d4-5678-90ef-ghij-klmnopqrstuv"
courseId: "ab6ee332-614d-475d-93b5-abc5ebb1fc84"
) {
success
message
}
}

Sample Response

{
"data": {
"removeStudentFromCourse": {
"message": "Student successfully removed from the course",
"success": true
}
}
}

Common Errors

ErrorDescription
Student is not enrolled in this courseThe student is not in the course.