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 module quiz

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

Overview#

Submits answers for a module quiz, scores it server-side and creates a Quiz record. Served by CourseController::submitQuiz().
{module} is route-model-bound to App\Models\Courses\Module by its primary key; the controller then checks it belongs to the same course and course version as the course log (403 otherwise). Scoring is server-side and covers the submitted questions: each key of answers must be a question of the module's quiz pool (the same set the sync download draws from), and no more keys than the module's quiz_questions may be sent, otherwise 403. A question counts as correct when its selected answer is one of its correct answers. The client never sees which answers are correct.
Controller: App\Http\Controllers\Api\V1\Diver\CourseController::submitQuiz()
Route name: api.v1.diver.courses.quiz.submit

Authentication#

Type: Bearer Token
Header: Authorization: Bearer {token}
Additional middleware: none beyond the standard API auth; the lock checks below are business logic, not middleware.

Request#

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

Path parameters#

ParameterTypeDescription
{log_code}string(32)Opaque course log code, owned by the authenticated diver
{module}integerModule id, route-model-bound

Body#

{
  "answers": { "7121": 27632, "7129": 27664 },
  "start": "2026-09-17T12:00:00Z",
  "end": "2026-09-17T12:05:00Z"
}
FieldTypeRequiredValidationDescription
answersobjectYesrequired|array|min:1 (keys are question ids, values must each individually satisfy the rule below){questionId: answerId} map
answers.*integerYesrequired|integer|exists:answers,idEach value must be a real answer id; the key (question id) is checked against the module's quiz pool by the controller (403)
startstringYesrequired|dateClient-supplied attempt start time
endstringYesrequired|date|after:startClient-supplied attempt end time
Validated by App\Http\Requests\Api\V1\Diver\SubmitQuizRequest, which extends ApiFormRequest - the full envelope 422 shape applies (see below), not Laravel's default.
total is the module's quiz_questions, so an unanswered question counts as wrong. The stored questions are the submitted keys.

Example request#


Response 201 Created#

Illustrative values.
{
  "success": true,
  "status": "success",
  "message": "Quiz submitted successfully",
  "data": {
    "id": 1582846,
    "log_code": "a6b952760c2b672d2f45da6989b1a8c1",
    "module_id": 463,
    "total": 2,
    "correct": 1,
    "wrong": 1,
    "score": 50,
    "passed": true,
    "date": "2026-09-17",
    "start": "2026-09-17 12:00:00",
    "end": "2026-09-17 12:05:00",
    "questions": [
      {
        "id": 7121,
        "text": "How should oxygen equipment be cleaned after use?",
        "missing": false,
        "answers": [
          { "id": 27632, "text": "Wipe down with a soft damp cloth", "is_correct": true, "selected": true },
          { "id": 27633, "text": "Store without cleaning", "is_correct": false, "selected": false }
        ]
      },
      {
        "id": 7129,
        "text": "When should a cylinder be visually inspected?",
        "missing": false,
        "answers": [
          { "id": 27663, "text": "Once a year", "is_correct": true, "selected": false },
          { "id": 27664, "text": "Never", "is_correct": false, "selected": true }
        ]
      }
    ]
  }
}

Response fields#

Same QuizResultResource shape as GET_quiz_results.md - see _resources.md → "Quiz result". passed is correct >= module.quiz_minimum, not a percentage threshold.

Errors#

401 Unauthorized#

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

403 Forbidden - module/course log mismatch#

Returned when {module} does not belong to the same course and course version as {log_code}.
{
  "success": false,
  "status": "error",
  "message": "Forbidden"
}

403 Forbidden - answers outside the module quiz#

Returned when a key of answers is not a question of the module's quiz pool, or when more keys than the module's quiz_questions are sent. Nothing is written.
{
  "success": false,
  "status": "error",
  "message": "Forbidden"
}

403 Forbidden - quiz locked#

{
  "success": false,
  "status": "error",
  "message": "Quiz is locked. Contact your instructor."
}
Returned when log.admin_lock or log.quiz_lock is set.

403 Forbidden - repetition#

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

404 Not Found - course log not found#

Laravel's default 404 when {log_code} does not resolve to a course log owned by the authenticated user. Resolved manually in the controller body, so this is only reached once route-model binding for {module} has already succeeded.
{
  "message": "No query results for model [App\\Models\\CourseLog\\CourseLog]."
}

404 Not Found - module not found#

{module} is route-model-bound; this fires before the controller body runs at all, including before SubmitQuizRequest validation. Confirmed live: unlike the CourseLog 404 above, route-model binding's NotFoundHttpException includes the id that was looked up.
{
  "message": "No query results for model [App\\Models\\Courses\\Module] 999999999"
}

409 Conflict - attempt already submitted#

Returned when an attempt with the same start was already submitted for this log and module: the same attempt sent twice, for example a retry. Nothing is written and the log is not locked. 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."]
  }
}
Uses the full envelope (success, status present) because SubmitQuizRequest extends ApiFormRequest, unlike endpoints that call $request->validate() inline.

Notes#

Side effects: creates a Quiz row.
A second, undocumented-until-now lock path: every successful submission calls CourseLog::checkQuizResults($module) (app/Models/CourseLog/CourseLog.php:488-503), which counts this module's failed Quiz rows for the log and sets quiz_lock = true (without admin_lock and without an admin_lock_comment) once the count reaches option('max_failed_quiz_before_lock', 10). A diver can be locked out by repeated failures: the next attempt after the threshold hits the 403 Forbidden - quiz locked case already documented.
If the quiz is passed and the log has an assigned instructor and all module quizzes are now complete, a UserQuizCompleted mail is queued to the instructor (cc the dive center when it has an email). A failure to queue it is reported and does not affect the response.
start / end are entirely client-supplied and not cross-checked against server time - they are stored as given.

Source: docs/api/diver/courses/POST_quiz_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
Quiz 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//modules//quiz' \
--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",
        "module_id": 0,
        "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 course detail
Next
List expired courses
Built with