Skip to main content

Cohort Subjects

Assign subjects to cohorts and manage student enrollment in those subjects.

All endpoints require Authorization: Bearer <token> and X-SCHOOL-ID headers unless noted otherwise.


List Cohort Subjects

GET /cohort-subjects

Returns a paginated list of subject assignments for cohorts.

Query Parameters

ParameterTypeRequiredDefaultDescription
pageNumberintegerYes0Zero-indexed page
pageSizeintegerYes50Results per page
batchuuidNoFilter by batch ID
baseuuidNoFilter by base subject ID
sessionstringNoFilter by session

Example

curl -X GET "https://api.vanillatots.com/cohort-subjects?pageNumber=0&pageSize=25&batch=batch-uuid" \
-H "Authorization: Bearer $TOKEN" \
-H "X-SCHOOL-ID: $SCHOOL_ID"

Response 200 OK

{
"page_number": 0,
"page_size": 25,
"total_pages": 2,
"total": 30,
"data": [
{
"id": "uuid",
"elective": false,
"subject": "Mathematics",
"code": "MATH",
"cohort": "cohort-uuid"
}
]
}

Create Cohort Subject

POST /cohort-subjects

Assign a subject to a cohort.

Request Body

FieldTypeRequiredDescription
cohort_iduuidYesCohort ID
subject_iduuidYesSubject template ID
electivebooleanYesWhether the subject is elective

Example

curl -X POST https://api.vanillatots.com/cohort-subjects \
-H "Authorization: Bearer $TOKEN" \
-H "X-SCHOOL-ID: $SCHOOL_ID" \
-H "Content-Type: application/json" \
-d '{
"cohort_id": "cohort-uuid",
"subject_id": "subject-uuid",
"elective": false
}'

Response 200 OK — Returns the created CohortSubjectResponse.


Get Cohort Subject

GET /cohort-subjects/{id}

Retrieve a single cohort subject assignment.

Path Parameters

ParameterTypeDescription
iduuidCohort subject ID

Response 200 OK — Returns a CohortSubjectResponse object.


Add Students to Subject

PATCH /cohort-subjects/{id}/students

Enroll students into a specific cohort subject.

Path Parameters

ParameterTypeDescription
iduuidCohort subject ID

Request Body — An array of student UUIDs.

["student-uuid-1", "student-uuid-2", "student-uuid-3"]

Example

curl -X PATCH https://api.vanillatots.com/cohort-subjects/{id}/students \
-H "Authorization: Bearer $TOKEN" \
-H "X-SCHOOL-ID: $SCHOOL_ID" \
-H "Content-Type: application/json" \
-d '["student-uuid-1", "student-uuid-2"]'

Response 200 OK — Returns the updated CohortSubjectResponse.


Remove Student from Subject

DELETE /cohort-subjects/{id}/students/{student_id}

Remove a single student from a cohort subject.

Path Parameters

ParameterTypeDescription
iduuidCohort subject ID
student_iduuidStudent ID

Response 200 OK