POST /classes

Creates a new class. The authenticated user becomes the owner.

application/json

Body Required

  • name string Required

    Name of the class

    Maximum length is 50.

  • description string | null

    Description of the class

  • settings object | null

    Class-specific settings

Responses

  • 201 application/json

    Class created successfully

    Hide response attributes Show response attributes object
    • success boolean
    • code integer(int32)
    • message string
    • data object

      Class (learning group) representing a classroom with enrolled students

      Hide data attributes Show data attributes object
      • id string Required

        Unique identifier for the class

      • ownerId string Required

        ID of the teacher/owner who created the class

      • name string Required

        Name of the class (e.g., "10A1", "11B2")

        Maximum length is 50.

      • description string | null

        Description or notes about the class

      • joinCode string | null

        Unique join code for students to enroll

        Maximum length is 10.

      • settings object | null

        Class-specific settings like theme, allow_comments, etc.

      • isActive boolean

        Whether the class is active

      • createdAt string(date-time)

        Timestamp when the class was created

      • updatedAt string(date-time)

        Timestamp when the class was last updated

  • 400 application/json

    Bad Request - Invalid input data or malformed request

    Hide response attributes Show response attributes object
    • success boolean
    • code integer
    • errorCode string
    • message string
    • timestamp string(date-time)
  • 401 application/json

    Unauthorized - Invalid or missing authentication token

    Hide response attributes Show response attributes object
    • success boolean
    • code integer
    • errorCode string
    • message string
    • timestamp string(date-time)
  • 500 application/json

    Internal Server Error

    Hide response attributes Show response attributes object
    • success boolean
    • code integer
    • errorCode string
    • message string
    • timestamp string(date-time)
POST /classes
curl \
 --request POST 'http://localhost:8080/api/classes' \
 --header "Authorization: Bearer $ACCESS_TOKEN" \
 --header "Content-Type: application/json" \
 --data '{"name":"12A","description":"Advanced Science Track","settings":{"theme":"light","allow_comments":true}}'
Request examples
{
  "name": "12A",
  "description": "Advanced Science Track",
  "settings": {
    "theme": "light",
    "allow_comments": true
  }
}
Response examples (201)
{
  "success": true,
  "code": 200,
  "message": "string",
  "data": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "ownerId": "550e8400-e29b-41d4-a716-446655440001",
    "name": "12A",
    "description": "Advanced Science Track",
    "joinCode": "ABCD1234",
    "settings": {
      "theme": "light",
      "allow_comments": true
    },
    "isActive": true,
    "createdAt": "2024-01-15T10:30:00Z",
    "updatedAt": "2024-09-20T14:45:00Z"
  }
}
Response examples (400)
{
  "success": false,
  "code": 42,
  "errorCode": "string",
  "message": "string",
  "timestamp": "2026-05-04T09:42:00Z"
}
Response examples (401)
{
  "success": false,
  "code": 42,
  "errorCode": "string",
  "message": "string",
  "timestamp": "2026-05-04T09:42:00Z"
}
Response examples (500)
{
  "success": false,
  "code": 42,
  "errorCode": "string",
  "message": "string",
  "timestamp": "2026-05-04T09:42:00Z"
}