Skip to content

Extend Student Course Access

The extendStudentCourseAccess mutation allows you to extend a student’s access to a course by updating the ended_at date. This is useful when you want to grant additional time for course completion.

Input Parameters

FieldTypeDescription
userIdString!ID of the student (User) whose access should be extended
courseIdString!ID of the course to extend access for
extensionDaysIntNumber of days to extend the access from the current ended_at date
newEndedAtIntNew expiration date (Unix Timestamp). Takes precedence over extension_days if both are provided
indefiniteBooleanIf true, removes the access end date, granting unlimited access. Takes precedence over all other time parameters

Return Fields

The updated enrollment with extended 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). Null if indefinite access is granted
type ExtendStudentCourseAccessPayload {
enrollment {
id
completionRate
course {
id
slug
}
user {
id
name
email
}
endedAt
}
}

Example

mutation {
extendStudentCourseAccess(
userId: "387b0c87-0f85-44cc-833e-7306c1b5d3e6"
courseId: "9a1216f7-36de-4c50-8094-2ebfb7d3c383"
extensionDays: 30
) {
enrollment {
id
course {
id
slug
}
user {
id
name
}
endedAt
}
}
}

Example with Indefinite Access

mutation {
extendStudentCourseAccess(
userId: "387b0c87-0f85-44cc-833e-7306c1b5d3e6"
courseId: "9a1216f7-36de-4c50-8094-2ebfb7d3c383"
indefinite: true
) {
enrollment {
id
course {
id
slug
}
user {
id
name
}
endedAt
}
}
}

Sample Response

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

Common Errors

ErrorDescription
Student is not enrolled in this courseThe student is not enrolled in the specified course
Invalid extension periodThe provided extension days or new end date is invalid
Current enrollment has no end dateCannot extend an enrollment that already has indefinite access