POST /api/v1/cats/{id}/finish-attempt/{attempt}

Submits a completed CAT attempt with all student responses. This finalizes the attempt. AI auto-marking for UNSTRUCTURED questions will run when the attempt is graded.

Path parameters

  • attempt string Required

    Attempt ID to submit

  • id Required

    CAT ID (not used in logic but required for route)

application/json

Body Required

Student responses and submission data

  • attempt object Required
    Hide attempt attributes Show attempt attributes object
    • attemptStartTime string(date-time)
    • attemptExpectedEndTime string(date-time)
    • attemptActualEndTime string(date-time)
  • choices array[object] Required
    Hide choices attributes Show choices attributes object
    • questionId string Required
    • response string
    • selectedOptions array[string]

Responses

  • 200 application/json

    CAT attempt submitted successfully

  • 400

    Invalid submission data or attempt already submitted

  • 404

    Attempt not found

POST /api/v1/cats/{id}/finish-attempt/{attempt}
curl \
 --request POST 'http://localhost:3500/api/v1/cats/123e4567-e89b-12d3-a456-426614174000/finish-attempt/789e0123-e89b-12d3-a456-426614174002' \
 --header "Content-Type: application/json" \
 --data '{"attempt":{"attemptStartTime":"2025-05-04T09:42:00Z","attemptExpectedEndTime":"2025-05-04T09:42:00Z","attemptActualEndTime":"2025-05-04T09:42:00Z"},"choices":[{"questionId":"string","response":"string","selectedOptions":["string"]}]}'
Request examples
{
  "attempt": {
    "attemptStartTime": "2025-05-04T09:42:00Z",
    "attemptExpectedEndTime": "2025-05-04T09:42:00Z",
    "attemptActualEndTime": "2025-05-04T09:42:00Z"
  },
  "choices": [
    {
      "questionId": "string",
      "response": "string",
      "selectedOptions": [
        "string"
      ]
    }
  ]
}
Response examples (200)
{
  "result": {
    "status": "COMPLETED",
    "attemptId": "789e0123-e89b-12d3-a456-426614174002",
    "percentage": 83.33,
    "totalMarks": 30,
    "scoredMarks": 25,
    "submittedAt": "2025-10-15T10:45:00.000Z"
  },
  "message": "CAT attempt submitted successfully"
}