POST /api/v1/exam/{id}/new-attempt

Create a new exam attempt for the authenticated student. Validates that the exam is within the allowed time window and the student has not exceeded the maximum number of attempts.

Path parameters

  • id string Required

    UUID of the exam to attempt

Responses

  • 201 application/json

    Exam attempt created successfully

  • 400 application/json

    Cannot start attempt - reasons include: exam not yet started, exam already ended, maximum attempts reached, or student already has an active attempt

  • 401

    Unauthorized - Student authentication required

  • 404

    Exam not found

POST /api/v1/exam/{id}/new-attempt
curl \
 --request POST 'https://api.echoplain.social/api/v1/exam/123e4567-e89b-12d3-a456-426614174000/new-attempt'
Response examples (201)
{
  "attempt": {
    "id": "attempt-123",
    "examId": "123e4567-e89b-12d3-a456-426614174000",
    "status": "IN_PROGRESS",
    "expiresAt": "2025-11-20T11:15:00Z",
    "startedAt": "2025-11-20T09:15:00Z",
    "studentId": "student-456"
  },
  "message": "Exam attempt created"
}
Response examples (400)
{
  "error": "Bad Request",
  "message": "Exam has not started yet",
  "statusCode": 400
}
{
  "error": "Bad Request",
  "message": "Exam has already ended",
  "statusCode": 400
}
{
  "error": "Bad Request",
  "message": "Maximum number of attempts reached",
  "statusCode": 400
}