Classes & Members
Class Entity
{
"id": "cls_123",
"title": "Algorithms 101",
"description": "Intro algorithms course",
"class_code": "ALGO-7P4X",
"status": "ACTIVE",
"is_archived": false,
"created_at": "2026-03-14T09:30:00Z",
"updated_at": "2026-03-14T09:30:00Z"
}
Field notes:
class_code— a short, shareable code students use to request access. Generated server-side.status—ACTIVEorARCHIVED.is_archived— convenience boolean mirroringstatus === "ARCHIVED".
Class Endpoints
GET /api/v1/classes
List all classes accessible to the current user.
- STUDENT — returns classes where the user has an
APPROVEDmembership. - TEACHER — returns classes the user created or is a member of.
- ADMIN — returns all classes in the system.
Authentication: Required
Response: Paginated list of class objects.
POST /api/v1/classes
Create a new class.
Authentication: Required — TEACHER or ADMIN global role.
Request:
{
"title": "Algorithms 101",
"description": "An introduction to algorithms and data structures."
}
Validation:
title— required, 1–200 characters.description— optional string.
Response: The created class object with 201 Created.
GET /api/v1/classes/{id}
Retrieve full details for a single class.
Authentication: Required — caller must be a member of the class or a global ADMIN.
PATCH /api/v1/classes/{id}
Update class settings (title and/or description).
Authentication: Required — class TEACHER or global ADMIN.
Request: Any subset of { "title", "description" }.
POST /api/v1/classes/{id}/archive
Archive a class. Archived classes are read-only; no new content or submissions can be created. The class remains visible to members.
Authentication: Required — class TEACHER or global ADMIN.
Request body: Empty ({} or omit).
Response: Updated class object with is_archived: true.
POST /api/v1/classes/{id}/unarchive
Restore an archived class to active status.
Authentication: Required — class TEACHER or global ADMIN.
Request body: Empty.
Class Membership
Membership Object
{
"user_id": "usr_456",
"class_id": "cls_123",
"role": "STUDENT",
"status": "APPROVED",
"joined_at": "2026-03-14T09:30:00Z"
}
Membership statuses:
| Status | Description |
|---|---|
PENDING | Student submitted a join request; awaiting approval. |
APPROVED | Student is an active member of the class. |
REJECTED | Join request was denied by a teacher or admin. |
REMOVED | Member was removed after previously being approved. |
GET /api/v1/classes/{id}/members
List all members of the class, including their status.
Authentication: Required — class member (any status for the requesting user) or global ADMIN.
Response: Paginated list of membership objects.
POST /api/v1/classes/{id}/join-request
A student requests access to a class using its class code.
Authentication: Required — STUDENT global role.
Request:
{
"class_code": "ALGO-7P4X"
}
Returns CONFLICT if the student already has a membership record (any status) for this class.
Response: The created membership object with status: "PENDING".
POST /api/v1/classes/{id}/members/approve
Approve one or more pending join requests.
Authentication: Required — class TEACHER or global ADMIN.
Request:
{
"user_ids": ["usr_456", "usr_789"]
}
Response: Array of updated membership objects.
POST /api/v1/classes/{id}/members/reject
Reject one or more pending join requests.
Authentication: Required — class TEACHER or global ADMIN.
Request:
{
"user_ids": ["usr_456"]
}
Response: Array of updated membership objects with status: "REJECTED".
POST /api/v1/classes/{id}/members/remove
Remove an approved member from the class.
Authentication: Required — class TEACHER or global ADMIN.
Request:
{
"user_id": "usr_456"
}
Notes:
- Cannot remove the last teacher from a class.
- A removed student retains a
REMOVEDmembership record (they cannot re-join without a new request).
Response: Updated membership object with status: "REMOVED".