RAID API
  1. Courses
  • DiveRAID frontend public API
    • Search divers
      POST
    • Search instructors
      POST
    • Search dive centers
      POST
    • Search dive centers by country
      GET
  • DiveRAID rest API V1
    • Auth
      • Register a new user
      • Login and get a Sanctum token
      • Send password reset email
      • Reset password using token
      • Logout and revoke the current token
      • Resend email verification
      • Complete a two-factor login and get a Sanctum token
    • Profile
      • The user resource
      • Get authenticated user profile
      • Update profile
      • Register push token
      • Update password
      • Remove push token
      • Rotate exam unlock code
      • Delete account
      • Update dive center association
    • Diver
      • Shared diver resources
      • Courses
        • List active courses
          GET
        • Get exam result
          GET
        • Submit course exam
          POST
        • Sign skills (diver)
          POST
        • Get course detail
          GET
        • Submit module quiz
          POST
        • List expired courses
          GET
        • Get quiz result
          GET
        • Get skills progress
          GET
      • Free Learnings
        • List enrolled free learnings
        • Get free learning quiz result
        • List available free learning courses
        • Submit free learning module quiz
        • Get free learning detail
        • Enroll in a free learning course
      • Certifications
        • Get certification history
        • Get certification quiz result
        • Get certification exam result
        • Get certification skills
        • List diver certifications
      • Dive Logs
        • Delete dive log
        • Create dive log
        • Update dive log
        • List loggable courses
        • List dive logs (paginated)
        • Get dive log
      • Awards
        • List the recognition cards issued to the user
      • Documents
        • Upload own medical certificate or insurance
        • List own medical certificates and insurance
        • List diver documents
      • Forms
        • List diver forms
      • Medical
        • Get medical questionnaire structure
        • Submit medical questionnaire
      • Store
        • List courses available for purchase
        • Get order status
    • Professional
      • Students
        • List students
        • Get student progress
        • Sign student skills
        • Get student exam result
        • Get student quiz result
        • Get student skills progress
      • Certifications
        • Get certification history
        • Get certification quiz result
        • Get certification exam result
        • Get certification skills
        • List all professional certifications
        • List diver-level certifications
        • List examiner certifications
        • List professional certifications
        • List specialty certifications
        • List trainer certifications
      • Classroom
        • List classrooms
        • Get classroom progress (all students)
        • Get classroom student progress
        • Sign classroom student skills
        • Get classroom student exam result
        • Get classroom student quiz result
        • Get classroom student skills
      • Renewals
        • List renewal courses
        • Get renewal exam result
        • Submit renewal exam
        • Sign renewal skills
        • Renewal status
        • Get renewal progress
        • Submit renewal module quiz
        • Get renewal quiz result
        • Get renewal skills progress
      • Dive Logs
        • Get student dive log
        • Sign student dive log
        • List student dive logs for a course
    • Sync
      • Download full course data for offline use
      • Upload offline operations
      • Get sync status
    • Public
      • List all countries
      • Dive-log enum values with labels in the response language
      • Get country data
      • Get country divisions (states/provinces)
      • List time zone identifiers, optionally narrowed to one country
      • List, search, and radius-search publicly visible dive centres
      • Every publicly visible, geolocated dive centre as a map marker
      • Countries with at least one publicly visible dive centre
      • Full detail of one publicly visible dive centre
    • Library
      • List the RAID document library
      • List the current RAID standards
  • Schemas
    • Frontend API Schema
      • DiverSearch
    • SuccessResponse
    • DiverCertification
    • ValidationErrorResponse
    • TwoFactorChallengeResponse
    • TokenResponse
    • IssuedCertification
    • ErrorResponse
    • DiveLog
    • ExamResult
    • QuizResult
    • CourseLogDetail
    • CourseLog
    • UserProfile
    • SkillProgress
    • Certification
    • PaginatedDiveLogs
    • StoreItem
    • PaymentIntentResponse
    • OrderConfirmResponse
    • OrderStatusResponse
    • InstructorSearch
    • DiveCenterSearch
  1. Courses

Submit course exam

POST
https://test.diveraid.com/api/v1/diver/courses/{log_code}/exam
Diver / Courses
Maintainer:Not configured

Overview#

Submits answers for a course's final exam, scores it server-side and creates an Exam record. Served by CourseController::submitExam(). Scoring is server-side and covers the submitted questions: each key of answers must be a question of the log's exam pool for its course version, and no more than the course's exam_questions keys may be sent, otherwise 403. A question counts as correct when its selected answer is one of its correct answers. If a passing exam requires skills, SkillLog::buildSkillsTrace() is triggered as a side effect.
Controller: App\Http\Controllers\Api\V1\Diver\CourseController::submitExam()
Route name: api.v1.diver.courses.exam.submit

Authentication#

Type: Bearer Token
Header: Authorization: Bearer {token}

Request#

Method: POST
Path: /api/v1/diver/courses/{log_code}/exam
Content-Type: application/json

Path parameters#

ParameterTypeDescription
{log_code}string(32)Opaque course log code, owned by the authenticated diver

Body#

{
  "answers": { "1482": 5900, "1581": 6250 },
  "start": "2026-09-17T13:00:00Z",
  "end": "2026-09-17T13:20:00Z"
}
FieldTypeRequiredValidationDescription
answersobjectYesrequired|array|min:1{questionId: answerId} map. The keys are the answered questions, checked against the exam pool (403)
answers.*integerYesrequired|integer|exists:answers,idEach value must be a real answer id
startstringYesrequired|dateClient-supplied attempt start time
endstringYesrequired|date|after:startClient-supplied attempt end time
Validated by App\Http\Requests\Api\V1\Diver\SubmitExamRequest, extends ApiFormRequest - full envelope 422.
The controller re-derives the eligible question pool (course questions plus questions_source, status = true, type_id in [2, 3], exclusivity rules, the log's course version) and requires every submitted question to belong to it and the number of submitted questions not to exceed exam_questions, or returns 403. total is the course's exam_questions, so an unanswered question counts as wrong.

Example request#


Response 201 Created#

Captured live: a real 30-question exam, all answered correctly.
{
  "success": true,
  "status": "success",
  "message": "Exam submitted successfully",
  "data": {
    "id": 243016,
    "log_code": "6db0d750407400cd094a2e8665ed3469",
    "total": 30,
    "correct": 30,
    "wrong": 0,
    "score": 100,
    "passed": true,
    "date": "2026-09-17",
    "start": "2026-09-17 13:00:00",
    "end": "2026-09-17 13:20:00",
    "questions": [
      {
        "id": 1482,
        "text": "Why do you need to analyze your gas before diving?",
        "missing": false,
        "answers": [
          { "id": 5897, "text": "To ensure you have your correct mix", "is_correct": false, "selected": false },
          { "id": 5900, "text": "Both A and B are correct", "is_correct": true, "selected": true }
        ]
      }
    ]
  }
}

Response fields#

Same ExamResultResource shape as GET_exam_results.md - see _resources.md → "Exam result". passed is correct >= course.exam_minimum.

Errors#

401 Unauthorized#

{
  "success": false,
  "status": "error",
  "message": "Unauthenticated"
}

403 Forbidden - exam not available#

Captured live, against a course log with exam_enable = false.
{
  "success": false,
  "status": "error",
  "message": "Exam is not available."
}
Returned when log.admin_lock is set, or log.exam_enable is false - the default state until an instructor or prerequisite step enables it.

403 Forbidden - repetition#

{
  "success": false,
  "status": "error",
  "message": "Exam is not available for a repetition."
}
Returned when the course log is a repetition of a course already certified. A repetition requires no exam and shares its log code with the certified attempt, so nothing is written.

403 Forbidden - question set mismatch#

Returned when a submitted question is not in the eligible exam pool for the course (an id outside the pool, or from the wrong course_version), or when more than exam_questions questions are submitted.
{
  "success": false,
  "status": "error",
  "message": "Forbidden"
}

404 Not Found#

Laravel's default 404 when {log_code} does not resolve to a course log owned by the authenticated user.
{
  "message": "No query results for model [App\\Models\\CourseLog\\CourseLog]."
}

409 Conflict - attempt already submitted#

Returned when an attempt with the same start was already submitted for this log: the same attempt sent twice, for example a retry. Nothing is written and the log is not locked (exam_enable and admin_lock are unchanged). Another attempt, with a different start, is always accepted: there is no limit on the number of attempts.
{
  "success": false,
  "status": "error",
  "message": "Attempt already submitted."
}

422 Unprocessable Entity - validation#

Captured live, empty body.
{
  "success": false,
  "status": "error",
  "message": "Validation failed",
  "errors": {
    "answers": ["The answers field is required."],
    "start": ["The start field is required."],
    "end": ["The end field is required."]
  }
}

Notes#

Side effects: creates an Exam row. If passed and the course needs skills, calls SkillLog::buildSkillsTrace($log) - this builds the skill log entries the diver then works through via POST /api/v1/diver/courses/{log_code}/skills/sign.
start / end are client-supplied and not cross-checked against server time.

Source: docs/api/diver/courses/POST_exam_submit.md

Request

Authorization
JWT Bearer
Add the parameter
Authorization
to Headers
Example:
Authorization: ********************
or
Path Params

Body Params application/jsonRequired

Examples

Responses

🟢201
application/json
Exam submitted
Bodyapplication/json

🟠401
🟠403
🟠404
🟠409
🟠422
Request Request Example
Shell
JavaScript
Java
Swift
curl --location 'https://test.diveraid.com/api/v1/diver/courses//exam' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
    "answers": {
        "property1": 0,
        "property2": 0
    },
    "start": "2019-08-24T14:15:22.123Z",
    "end": "2019-08-24T14:15:22.123Z"
}'
Response Response Example
201 - Example 1
{
    "status": "success",
    "message": "string",
    "data": {
        "id": 0,
        "log_code": "string",
        "total": 0,
        "correct": 0,
        "wrong": 0,
        "score": 0,
        "passed": true,
        "date": "2019-08-24",
        "start": "2019-08-24T14:15:22.123Z",
        "end": "2019-08-24T14:15:22.123Z",
        "questions": [
            {
                "id": 0,
                "text": "string",
                "missing": true,
                "answers": [
                    {
                        "id": 0,
                        "text": "string",
                        "is_correct": true,
                        "selected": true
                    }
                ]
            }
        ]
    }
}
Modified at 2026-12-04 08:05:13
Previous
Get exam result
Next
Sign skills (diver)
Built with