Skip to main content
POST
/
assessment
/
retakeassessment
curl -X POST https://api.yourservice.com/api/v1/assessment/retakeassessment \
  -H "Content-Type: application/json" \
  -H "x-api-key: your_api_key_here"
{
  "success": true,
  "data": {
    "recordVerificationId": "ver_live_abc123",
    "retakeAttemptNumber": 2,
    "totalQuestions": 10,
    "questions": [
      {
        "questionId": "uuid-q-new-1",
        "question": "What is the virtual DOM in React?",
        "options": [
          "A copy of the real DOM kept in memory",
          "A browser extension",
          "A CSS framework",
          "A JavaScript bundler"
        ]
      }
    ]
  },
  "message": "Retake assessment generated successfully",
  "executionTime": "7900ms"
}

Overview

The previous questions are deleted and replaced with a new AI-generated set. The previous attempt result is preserved in the database for history. Only available when the student has at least one prior failed attempt.
Allow extra time — AI generation is involved. Same 90-second timeout applies as POST /assessment/generate.
Requires a valid session token via the x-api-key session middleware. No additional fields needed in the request body.

Retake Eligibility Rules

ConditionResult
Assessment is locked (passed)403 ASSESSMENT_LOCKED
No prior attempt exists400 NO_PRIOR_ATTEMPT
Last attempt was passed403 ASSESSMENT_PASSED
Last attempt was failedAllowed — new questions generated

Error Codes

CodeHTTPDescription
MISSING_VERIFICATION_ID400No recordVerificationId in session
ASSESSMENT_LOCKED403Already passed and locked
NO_PRIOR_ATTEMPT400No prior attempt — use generate for first attempt
ASSESSMENT_PASSED403Last attempt was a pass — retake not permitted
NO_DATA400No projects, experience, or certificates found
NO_SKILLS400No skills found for this session
GENERATION_FAILED500AI generation returned zero questions
INTERNAL_ERROR500Unexpected server error
curl -X POST https://api.yourservice.com/api/v1/assessment/retakeassessment \
  -H "Content-Type: application/json" \
  -H "x-api-key: your_api_key_here"
{
  "success": true,
  "data": {
    "recordVerificationId": "ver_live_abc123",
    "retakeAttemptNumber": 2,
    "totalQuestions": 10,
    "questions": [
      {
        "questionId": "uuid-q-new-1",
        "question": "What is the virtual DOM in React?",
        "options": [
          "A copy of the real DOM kept in memory",
          "A browser extension",
          "A CSS framework",
          "A JavaScript bundler"
        ]
      }
    ]
  },
  "message": "Retake assessment generated successfully",
  "executionTime": "7900ms"
}