RAID API
  1. Sync
  • 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 exam result
        • Submit course exam
        • Sign skills (diver)
        • Get course detail
        • Submit module quiz
        • List expired courses
        • Get quiz result
        • Get skills progress
      • 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
        GET
      • Upload offline operations
        POST
      • Get sync status
        GET
    • 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. Sync

Upload offline operations

POST
https://test.diveraid.com/api/v1/sync/upload
Sync
Maintainer:Not configured

Overview#

Uploads a batch of operations collected while the device was offline. Each operation is processed in the order of its offline_at, and is idempotent by offline_id: an operation already processed successfully is answered from the cache without running again. A failed operation does not stop the rest of the batch, and the request answers 200 whatever the outcome of the single operations.
Operation types: quiz_submit, exam_submit, dive_log_create and skills_sign are processed.
The dive_log_create operation is validated with the same rule set as POST /api/v1/diver/dive-logs (CreateDiveLogRequest::rulesFor()) and creates the row through the same action as that endpoint.
Controller: App\Http\Controllers\Api\V1\Sync\SyncController::upload()
Route name: api.v1.sync.upload

Authentication#

Type: Bearer Token (Sanctum)
Header: Authorization: Bearer {token}

Request#

Method: POST
Path: /api/v1/sync/upload
Content-Type: application/json

Body#

{
  "operations": [
    {
      "type": "dive_log_create",
      "offline_id": "d1f0c8a2-0001",
      "offline_at": "2026-09-17T10:00:01+00:00",
      "data": {
        "date": "2026-09-17 09:00:00",
        "dive_config": "open_circuit",
        "dive_type": "shore",
        "location": "Example Sync Site",
        "country": "IT",
        "dive_time": 45,
        "max_depth": 18,
        "average_depth": 12,
        "is_free_diving": false,
        "purpose_type": "fun_dive",
        "dive_number": 1,
        "gas": "nitrox",
        "gas_mix": { "oxygen": 32, "nitrogen": 68, "helium": 0 },
        "abt": 40,
        "rnt": 5,
        "tbt": 45
      }
    },
    {
      "type": "skills_sign",
      "offline_id": "d1f0c8a2-0002",
      "offline_at": "2026-09-17T10:00:02+00:00",
      "data": {
        "log_code": "9d3f6a1b2c4e4f7a8b0c1d2e3f4a5b6c",
        "signatures": [
          { "skill_log_id": 930001, "skills": { "5001": true, "5002": false } }
        ]
      }
    },
    {
      "type": "quiz_submit",
      "offline_id": "d1f0c8a2-0003",
      "offline_at": "2026-09-17T10:00:03+00:00",
      "data": {
        "log_code": "9d3f6a1b2c4e4f7a8b0c1d2e3f4a5b6c",
        "module_id": 9101,
        "answers": { "7121": 27632 }
      }
    },
    {
      "type": "exam_submit",
      "offline_id": "d1f0c8a2-0004",
      "offline_at": "2026-09-17T10:00:04+00:00",
      "data": {
        "log_code": "9d3f6a1b2c4e4f7a8b0c1d2e3f4a5b6c",
        "answers": { "7001": 9001 }
      }
    }
  ]
}
Validated by App\Http\Requests\Api\V1\Sync\SyncUploadRequest.
FieldTypeRequiredValidationDescription
operationsarrayYesrequired|array|min:1List of offline operations
operations[].typestringYesrequired|string|in:quiz_submit,exam_submit,dive_log_create,skills_signOperation type
operations[].offline_idstringYesrequired|string|max:100Client-generated unique id, the idempotency key
operations[].offline_atdatetimeYesrequired|dateWhen the operation was performed offline. Sets the processing order
operations[].dataobjectYesrequired|arrayOperation payload, see below

Operation data payloads#

The content of data is not validated by the request. Each operation reads what it needs from it.
dive_log_create
The same body as POST /api/v1/diver/dive-logs, validated with the same rules. See docs/api/diver/dive-logs/POST_create.md for the field table, the accepted enum values, the group letters A-Z, the gas_mix keys and the course_log rules. A payload that the create endpoint would refuse is refused here too, with the field errors in the result's errors. safety_stop and has_decompression default to false when omitted, as on the create endpoint. lat and lon are accepted under the same pairing and range rules as on the create endpoint (both or neither, lat -90 to 90, lon -180 to 180). is_free_diving must agree with dive_config, as on the create endpoint.
skills_sign
FieldDescription
log_codeCourse log code of the caller. An unknown code, or one that belongs to another user, gives Course log not found
signaturesArray of {skill_log_id, skills}, where skills is a map {skill id: bool} that replaces the stored user_skills wholesale
quiz_submit
Refused, in order, when the module is unknown or not of the log's course and course version (Module not found), when the log is locked by admin_lock or quiz_lock (Quiz is locked), when an attempt with the same start was already submitted for the module (Quiz already submitted; without start only offline_id idempotency applies), and when answers is empty, holds more questions than the module's quiz_questions or a question outside the module's quiz pool (Invalid answers). Scored like POST /api/v1/diver/courses/{log_code}/modules/{module}/quiz: total is the module's quiz_questions and the quiz passes when the correct answers reach its quiz_minimum. The quiz row is dated with the operation's offline_at; the failed-attempt lock and the completion mail to the instructor apply as on the REST endpoint.
FieldDescription
log_codeCourse log code
module_idModule id, from GET /api/v1/sync/download
answersMap {question id: answer id}
start, endOptional timestamps
exam_submit
A log the server holds locked (admin_lock) needs proof of the instructor's unlock: unlock_code (the value scanned from the instructor's QR code) and unlocked_at (when the app checked it), see GET /api/v1/sync/download. In order: a missing or non-string unlock_code gives Unlock code required; a log without instructor, or a code the server does not recompute for the instructor, gives Invalid unlock code; an unlocked_at that is missing, not a date-time or later than the operation's offline_at gives Invalid unlock time. On a match the exam is accepted and, in the same transaction, the log is unlocked (exam_enable true, admin_lock false, admin_lock_comment cleared) and the event is written to the activity log. A log that is not locked ignores both fields. A log with admin_lock false and exam_enable false, whose exam the instructor never enabled, is refused with Exam is not available. Any refusal (same attempt sent twice, invalid answers, not enabled, unlock proof) leaves the log unchanged. Scored like POST /api/v1/diver/courses/{log_code}/exam: every submitted question must be in the log's exam pool for its course version and answers holds at most the course's exam_questions questions, total is the course's exam_questions, and the exam passes when the correct answers reach the course's exam_minimum. The exam row is dated with the operation's offline_at.
FieldDescription
log_codeCourse log code
answersMap {question id: answer id}
unlock_codeString. Required when the log is locked by the server: the instructor's unlock code the app scanned
unlocked_atDate-time. Required when the log is locked by the server: when the app checked the code, not later than offline_at
start, endOptional timestamps
Result data: {id, score, passed}. A question id outside the pool, more questions than the course's exam_questions, or an empty answers, gives Invalid answers. An attempt with the same start already submitted for the log (the same attempt sent twice) gives Exam already submitted; without start only offline_id idempotency applies.

Example request#


Response 200 OK#

Example with one operation of each type of the body above. The request answers 200 even when operations fail: look at status in each result.
{
  "success": true,
  "status": "success",
  "message": "OK",
  "data": {
    "processed": 4,
    "results": [
      {
        "offline_id": "d1f0c8a2-0001",
        "type": "dive_log_create",
        "status": "success",
        "data": { "id": 930101 }
      },
      {
        "offline_id": "d1f0c8a2-0002",
        "type": "skills_sign",
        "status": "success",
        "data": { "log_code": "9d3f6a1b2c4e4f7a8b0c1d2e3f4a5b6c", "signed": 1 }
      },
      {
        "offline_id": "d1f0c8a2-0003",
        "type": "quiz_submit",
        "status": "success",
        "data": { "id": 1582901, "score": 100, "passed": true }
      },
      {
        "offline_id": "d1f0c8a2-0004",
        "type": "exam_submit",
        "status": "success",
        "data": { "id": 930201, "score": 80, "passed": true }
      }
    ]
  }
}

Result fields#

FieldTypeNullableAlways presentDescription
data.processedintegerNoYesNumber of results, equal to the number of operations sent
data.resultsarrayNoYesOne result per operation, in processing order (offline_at), not in the order sent
data.results[].offline_idstringNoYesThe client id, echoed back
data.results[].typestringNoYesOperation type
data.results[].statusstringNoYessuccess or error
data.results[].dataobjectNoOn success{id} for dive_log_create, {log_code, signed} for skills_sign, {id, score, passed} for quiz_submit and exam_submit. signed counts the signatures submitted, not the ones applied
data.results[].errorstringNoOn errorMessage, see below
data.results[].errorsobjectNoOnly on a dive_log_create that failed validationField errors, keyed by field name with an array of messages, the map the create endpoint returns

error values#

errorMeaning
Validation faileddive_log_create payload refused by the create rules; the detail is in errors
Invalid country codedive_log_create with a country that does not resolve
Course log not foundskills_sign, quiz_submit, exam_submit with a log_code that is unknown or not the caller's
Unlock code requiredexam_submit on a log locked by the server without a string unlock_code
Invalid unlock codeexam_submit on a locked log without instructor, or with a code that does not match the instructor's
Invalid unlock timeexam_submit on a locked log with a missing, unparseable or later-than-offline_at unlocked_at
Exam is not availableexam_submit on a log whose exam the instructor never enabled (admin_lock false and exam_enable false)
Quiz is lockedquiz_submit on a log with admin_lock or quiz_lock
Quiz is not available for a repetitionquiz_submit on a log that is a repetition of an already certified course; nothing is written
Exam is not available for a repetitionexam_submit on a log that is a repetition of an already certified course; nothing is written
Skills are not available for a repetitionskills_sign on a log that is a repetition of an already certified course; nothing is written
Invalid answersexam_submit or quiz_submit with no answers, more answers than the exam or quiz asks, or a question id outside the pool
Exam already submittedexam_submit when an attempt with the same start was already submitted (the same attempt sent twice)
Module not foundquiz_submit with a module that is unknown or not of the log's course and course version
Quiz already submittedquiz_submit when an attempt with the same start was already submitted (the same attempt sent twice)
The operation could not be processedAn unexpected failure while processing the operation. The cause is logged on the server and never returned.

Errors#

401 Unauthorized#

{
  "success": false,
  "status": "error",
  "message": "Unauthenticated"
}
message is Token expired or Invalid token when a bearer token was sent but is expired or unknown.

422 Unprocessable Entity - malformed batch#

A batch that fails the top-level rules (operations missing or empty, an unknown type, a missing offline_id, offline_at or data) is refused as a whole, before any operation runs. Emitted by ApiFormRequest::failedValidation(). Captured live with an empty body.
{
  "success": false,
  "status": "error",
  "message": "Validation failed",
  "errors": {
    "operations": ["The operations field is required."]
  }
}

429 Too Many Requests#

The route sits behind the API rate limiter; the live responses carried x-ratelimit-limit: 120. The body is the standard envelope with message: "Too many requests" and a Retry-After header.

Idempotency#

Each successful operation is cached under the key offline_processed:{user_id}:{offline_id} for 30 days. If the same offline_id is sent again, the cached result is returned and the operation does not run again.
Use a stable, globally unique offline_id per operation, for example a UUID generated on the device.
The cache is the only record: there is no table behind it. If the entry is lost, the same offline_id runs again.
Only successful operations are cached. A failed operation can be corrected and resent with the same offline_id.

Notes#

Operations are processed in ascending offline_at. The results array follows that order.
Operations run in offline_at order.
skills_sign writes user_skills, user_ip (the literal offline) and end (the processing time) on each matched skill log, and updated_at moves with them. A skill_log_id that does not exist or belongs to another log_code is skipped without error, and still counts in signed.
dive_log_create runs the same action as POST /api/v1/diver/dive-logs, including the reordering of the diver's dive numbers.
A failed operation does not stop the following ones.

Source: docs/api/sync/POST_upload.md

Request

Authorization
JWT Bearer
Add the parameter
Authorization
to Headers
Example:
Authorization: ********************
or
Body Params application/jsonRequired

Examples

Responses

🟢200
application/json
Success
Bodyapplication/json

🟠401
🟠422
🟠429
Request Request Example
Shell
JavaScript
Java
Swift
curl --location 'https://test.diveraid.com/api/v1/sync/upload' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
    "operations": [
        {
            "type": "quiz_submit",
            "offline_id": "string",
            "offline_at": "2019-08-24T14:15:22.123Z",
            "data": {}
        }
    ]
}'
Response Response Example
200 - Example 1
{
    "status": "success",
    "message": "string",
    "data": {
        "processed": 0,
        "results": [
            {
                "offline_id": "string",
                "type": "string",
                "status": "success",
                "data": {},
                "error": "string",
                "errors": {
                    "property1": [
                        "string"
                    ],
                    "property2": [
                        "string"
                    ]
                }
            }
        ]
    }
}
Modified at 2026-10-23 10:02:54
Previous
Download full course data for offline use
Next
Get sync status
Built with