POST /classes/join/{joinCode}

Allows a student to join a class using a valid join code. Creates enrollment record automatically.

Path parameters

  • joinCode string Required

    The class join code

Responses

  • 201 application/json

    Successfully joined class

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

      Enrollment record linking students to classes

      Hide data attributes Show data attributes object
      • id string Required

        Unique identifier for the enrollment

      • classId string Required

        ID of the class

      • studentId string Required

        ID of the student

      • enrolledAt string(date)

        Date the student was enrolled

      • status string

        Enrollment status

        Values are active, dropped, or completed.

      • createdAt string(date-time)

        Timestamp when enrollment was created

      • updatedAt string(date-time)

        Timestamp when enrollment was last updated

  • 400 application/json

    Bad Request - Invalid or expired join code

    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)
  • 409 application/json

    Conflict - Student already enrolled in class

    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/join/{joinCode}
curl \
 --request POST 'http://localhost:8080/api/classes/join/{joinCode}' \
 --header "Authorization: Bearer $ACCESS_TOKEN"
Response examples (201)
{
  "success": true,
  "code": 200,
  "message": "string",
  "data": {
    "id": "550e8400-e29b-41d4-a716-446655440004",
    "classId": "550e8400-e29b-41d4-a716-446655440000",
    "studentId": "550e8400-e29b-41d4-a716-446655440002",
    "enrolledAt": "2024-01-15",
    "status": "active",
    "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 (409)
{
  "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"
}