Skip to content

Assignment Mutations

The assignment mutations allow you to create, update, and delete assignments within your Teachify courses — for example to provision a course together with its assignments, or to keep assignment content in sync with an external system.

All assignment mutations require the courses:write scope.

Creates a new assignment in a course.

Input Parameters:

FieldTypeDescription
inputAdminAssignmentInput!Input object containing assignment creation details

AdminAssignmentInput Fields:

FieldTypeRequiredDescription
courseIdString!YesParent course ID. Course must belong to the same school
nameString!YesAssignment name
descriptionStringNoAssignment description
publishedBooleanNoWhether the assignment is visible to students. Defaults to false
startedAtBigIntNoStart time, Unix timestamp
dueAtBigIntNoDue time, Unix timestamp
positionIntNoSort position when the course orders assignments by position
contentRestrictionStringNoWhether text content is required on submissions: required, optional, none. Defaults to optional
attachmentRestrictionStringNoWhether file attachments are required on submissions: required, optional, none. Defaults to none
fileTypes[String!]NoAccepted MIME types for submission attachments. Note: application/msword and the docx MIME type are kept in sync server-side — docx is auto-added when msword is present and removed when it is not, so the stored list may differ slightly from what was sent
commentableBooleanNoWhether students can comment on submissions. Defaults to true

Limitation: instructor reference files on an assignment (the attachments teachers upload alongside the instructions) cannot currently be created or read through the Admin API.

Example:

mutation CreateAssignment {
createAssignment(input: {
courseId: "course-123"
name: "Week 1 Essay"
description: "Write a 500-word essay on the assigned topic."
published: true
dueAt: 1767225600
contentRestriction: "required"
attachmentRestriction: "optional"
fileTypes: ["application/pdf"]
}) {
assignment {
id
name
published
dueAt
}
errors
}
}

Updates an existing assignment. This is a partial update — only the provided fields are changed. Passing null for startedAt or dueAt clears the timestamp.

Input Parameters:

FieldTypeDescription
idString!ID of the assignment to update
inputAdminAssignmentUpdateInput!Fields to change

AdminAssignmentUpdateInput accepts the same fields as AdminAssignmentInput except courseId (an assignment cannot be moved to another course), and all fields are optional.

Example:

mutation UpdateAssignment {
updateAssignment(
id: "assignment-456"
input: {
published: true
dueAt: 1767830400
}
) {
assignment {
id
published
dueAt
}
errors
}
}

Soft-deletes an assignment. Deletion is rejected when the assignment has already received submissions, so student work stays reachable.

Input Parameters:

FieldTypeDescription
idString!ID of the assignment to delete

Example:

mutation DeleteAssignment {
deleteAssignment(id: "assignment-456") {
success
errors
}
}

Note: This mutation is still under development and will be fully documented when available.

Grades a student’s assignment submission, providing feedback and a score.

All assignment mutations return an errors field containing validation errors (for example an invalid contentRestriction value). Not-found and permission problems are returned as top-level GraphQL errors with these codes:

CodeMeaning
ASSIGNMENT-001Course not found
ASSIGNMENT-002Assignment not found
ASSIGNMENT-003Cannot delete an assignment that has already received submissions

For more information about the Teachify Admin API, please refer to the API Overview.