Skip to content

Expire Student Course Access

The expireStudentCourseAccess mutation allows you to mark a student’s course access as expired while retaining their course data. This is useful when you want to temporarily revoke a student’s access without removing their progress and enrollment records.

Input Parameters

FieldTypeDescription
userIdString!ID of the student (User) whose access should be expired
courseIdString!ID of the course to expire access for
customEndedAtIntCustom expiration date (Unix Timestamp). Defaults to current time
reasonStringOptional reason for expiring the access

Return Fields

The updated enrollment with expired access(StudentCourseShip).

FieldTypeDescription
idString!id of the enrollment
completionRateFloatthe completion rate of the enrolled course which student achieved
courseAdminCourse!information of the enrolled course
userAdminUser!user information of the enrolled course
updatedAtInt!last updated date of the enrollment
createdAtInt!created date of the enrollment
endedAtIntexpiration date for the enrollment (Unix Timestamp)
type ExpireStudentCourseAccessPayload {
enrollment {
id
completionRate
course {
id
slug
}
user {
id
name
email
}
endedAt
}
}

Example

mutation {
expireStudentCourseAccess(
userId: "a1b2c3d4-5678-90ef-ghij-klmnopqrstuv"
courseId: "ab6ee332-614d-475d-93b5-abc5ebb1fc84"
) {
enrollment {
id
course {
id
slug
}
user {
id
name
}
endedAt
}
}
}

Sample Response

{
"data": {
"expireStudentCourseAccess": {
"enrollment": {
"id": "619ad939-8591-40ad-9364-cf3825a9bf70",
"completionRate": 0.25,
"createdAt": 1672531200,
"updatedAt": 1747297936,
"endedAt": 1747297936,
"course": {
"id": "9a1216f7-36de-4c50-8094-2ebfb7d3c383",
"slug": "course-slug"
},
"user": {
"id": "387b0c87-0f85-44cc-833e-7306c1b5d3e6",
"name": "[email protected]",
"email": "[email protected]"
}
}
}
}
}