POST /classes/{classId}/students/import

Imports students from a CSV file into a class.

Path parameters

  • classId string Required

    The class ID

multipart/form-data

Body Required

  • file string(binary) Required

    CSV file containing student data

Responses

  • 200 application/json

    Students imported successfully

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

      Detailed result of a CSV import including generated credentials

      Hide data attributes Show data attributes object
      • success boolean

        Whether the import was successful

      • studentsCreated integer

        Number of students successfully created and saved

      • message string | null

        Human-readable message

      • credentials array[object]

        List of generated credentials for created users

        Credentials generated for a newly created student

        Hide credentials attributes Show credentials attributes object
        • studentId string Required

          The user ID associated with the created student

        • username string Required

          Generated username/email for the student

        • password string Required

          Temporary password generated for the student

        • email string(email) | null

          Email address (same as username)

        • fullName string | null

          Full name of the student

      • errors array[string]

        List of errors or warnings encountered during import

  • 400 application/json

    Bad Request - Invalid file format

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

    Class not found

    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/{classId}/students/import
curl \
 --request POST 'https://api.huy-devops.site/api/classes/{classId}/students/import' \
 --header "Authorization: Bearer $ACCESS_TOKEN" \
 --header "Content-Type: multipart/form-data" \
 --form "file=@file"
Response examples (200)
{
  "code": 200,
  "data": {
    "errors": [],
    "message": "Students imported successfully",
    "success": true,
    "credentials": [
      {
        "email": "nguyen.van.a@example.com",
        "fullName": "Nguyen Van A",
        "password": "Abc123!@#",
        "username": "nguyen.van.a@example.com",
        "studentId": "user_001"
      }
    ],
    "studentsCreated": 1
  },
  "message": "Students imported successfully",
  "success": true
}
Response examples (400)
{
  "success": false,
  "code": 42,
  "errorCode": "string",
  "message": "string",
  "timestamp": "2026-05-04T09:42:00Z"
}
Response examples (404)
{
  "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"
}