DiveLogController::store(), which delegates the creation to App\Actions\DiveLogs\CreateDiveLog, the same action the offline sync dive_log_create operation uses (see docs/api/sync/POST_upload.md). The dive's number and unit fields (depth_unit, weights_unit, pressure_unit, temperature_unit) are always server-computed, never taken from the request.App\Http\Controllers\Api\V1\Diver\DiveLogController::store()api.v1.diver.dive-logs.storeAuthorization: Bearer {token}POST/api/v1/diver/dive-logsapplication/json{
"dive_number": 1,
"date": "2026-09-17 09:30:00",
"dive_config": "open_circuit",
"dive_type": "boat",
"location": "Example Reef",
"country": "IT",
"dive_time": 40,
"max_depth": 18,
"average_depth": 10,
"is_free_diving": false,
"purpose_type": "fun_dive",
"gas": "nitrox",
"gas_mix": { "oxygen": 32, "nitrogen": 68, "helium": 0 },
"mod": 40,
"abt": 35,
"rnt": 0,
"tbt": 35,
"group_in": "C"
}| Field | Type | Required | Validation | Description |
|---|---|---|---|---|
dive_number | integer | Yes | required|integer | Validated but discarded. The controller computes number itself as $user->diveLogs()->count() + 1, then renumbers by date — see Notes |
date | string | Yes | required|string|date | Format "YYYY-MM-DD HH:MM:SS" (any format PHP strtotime() reads is accepted). An impossible calendar date or time (2026-02-30, 2026-13-01, 25:00) is rejected with 422 |
dive_config | string | Yes | required|string|enum | One of the values in the table below |
dive_type | string | Yes | required|string|enum | One of the values in the table below |
location | string | Yes | required|string | |
country | string | Yes | required|string | ISO 3166-1 alpha-2, resolved server-side to region/subregion. Returns 422 with "Invalid country code" if the code doesn't resolve — see Errors |
lat | number | No | nullable|numeric|between:-90,90|required_with:lon | Decimal degrees. Send together with lon. Returned as a number |
lon | number | No | nullable|numeric|between:-180,180|required_with:lat | Decimal degrees. Send together with lat. Returned as a number |
dive_time | integer | Yes | required|integer|min:5 | Minutes |
max_depth | number | Yes | required|numeric|min:1|max:660 | |
average_depth | number | Yes | required|numeric|min:1|lte:max_depth | |
is_free_diving | boolean | Yes | required|boolean | Gates an entire block of otherwise-required fields — see below. Must be true when dive_config is freediving and false for every other configuration; a mismatch is a 422 on is_free_diving |
purpose_type | string | Yes | required|string|enum | fun_dive or course_log. course_log makes log_code, skill_id and instructor_id required and scoped to the diver — see below |
weather / water / current / visibility | string | No | sometimes|nullable|string|enum | One of the values in the table below |
dive_condition_notes / wetsuit / buddy / verified_by / comments | string | No | sometimes|string|nullable | Passed through importString(): trimmed, and an empty result is stored as null |
weights | number | No | sometimes|numeric|nullable|min:0|max:100 | |
water_temperature | number | No | sometimes|numeric|nullable|min:-4|max:100 | |
weather_temperature | number | No | sometimes|numeric|nullable|min:-50|max:130 | |
sac_rate | number | No | sometimes|numeric|nullable |
"Open Circuit" is rejected with 422.| Field | Accepted values |
|---|---|
dive_config | freediving, open_circuit, semi_close_rebreather, close_circuit_rebreather, sidemount_oc, sidemount_ccr |
dive_type | pool, shore, boat, altitude, overhead |
purpose_type | fun_dive, course_log |
weather | sunny, cloudy, foggy, rainy, storm |
water | calm, choppy, heavy, rough, stormy |
current | no_current, light, moderate, strong |
visibility | poor, sufficient, good, excellent |
gas | air, nitrox, trimix, triox |
is_free_diving is false| Field | Validation | Description |
|---|---|---|
gas | required|string|enum | Values in the table above |
gas_mix | required|array:oxygen,nitrogen,helium | Only these three keys are accepted; any other key, o included, is a 422. An empty {} is rejected |
gas_mix.oxygen / gas_mix.nitrogen | required_with:gas_mix|numeric|min:0|max:100 | Required whenever gas_mix is sent |
gas_mix.helium | sometimes|numeric|min:0|max:100 | Optional; stored as 0 when omitted |
cylinder_count | sometimes|nullable|integer | |
bottom_cylinder_volume | sometimes|nullable|numeric | |
pressure_start | sometimes|nullable|numeric | |
pressure_end | sometimes|nullable|numeric|lte:pressure_start | |
tts | sometimes|integer|nullable|min:0|lte:dive_time | |
mod | sometimes|integer|nullable|min:0 | Maximum operating depth. No cross-check against max_depth: a dive may be logged deeper than its MOD |
end | sometimes|integer|nullable|min:0|lte:max_depth | Equivalent narcotic depth |
safety_stop / has_decompression | sometimes|boolean|nullable | Stored as false when omitted |
decompression_note | sometimes|string|nullable | Passed through importString() |
group_in / group_out | sometimes|nullable|string, one of A to Z | A single uppercase letter. Lowercase, several characters or digits are a 422; null is accepted. Passed through importString() |
abt | required|integer|min:0|lte:dive_time | |
rnt | required|integer|min:0|max:300 | |
tbt | required|integer|min:0 |
is_free_diving is true.gas_mix is sent and returned as {oxygen, nitrogen, helium}. Internally it is stored as {o, n, h}; the translation happens at the API boundary and is not visible to the client.purpose_type is course_log| Field | Validation | Description |
|---|---|---|
log_code | required|string, one of the diver's loggable course logs | A course log of the diver that is not expired, whose exam is passed and that still has skills left to log |
skill_id | required|integer, one of that course log's loggable skills | |
instructor_id | required|integer, the course log's instructor | A course log without an instructor can never be used for a course_log dive |
log_code of another diver, is a 422 on the offending field. These three rules were not captured live in this pass; they are covered by the test suite.App\Http\Requests\Api\V1\Diver\CreateDiveLogRequest, extends ApiFormRequest — full envelope 422.201 Createdmod (40) deeper than max_depth (18): accepted.{
"success": true,
"status": "success",
"message": "Dive log created successfully",
"data": {
"id": 671996,
"uuid": "5d02c670-1eaa-4b38-9b84-65fa611be6e1",
"number": 403,
"date": "2026-09-17 09:30:00",
"dive_type": "boat",
"purpose_type": "fun_dive",
"location": "Example Reef",
"country": "IT",
"lat": null,
"lon": null,
"dive_config": "open_circuit",
"gas": "nitrox",
"gas_mix": { "oxygen": 32, "nitrogen": 68, "helium": 0 },
"max_depth": 18,
"average_depth": 10,
"depth_unit": "meters",
"dive_time": 40,
"abt": 35,
"rnt": 0,
"tbt": 35,
"tts": 0,
"pressure_start": null,
"pressure_end": null,
"pressure_unit": "bar",
"water_temperature": null,
"weather_temperature": null,
"temperature_unit": "celsius",
"weather": null,
"water": null,
"current": null,
"visibility": null,
"weights": null,
"weights_unit": "kilogram",
"buddy": null,
"verified_by": null,
"wetsuit": null,
"sac_rate": null,
"safety_stop": false,
"has_decompression": false,
"decompression_note": null,
"mod": 40,
"end": null,
"group_in": "C",
"group_out": null,
"comments": null,
"log_code": null,
"course_id": null,
"skill_log_id": null,
"skill_id": null,
"instructor_id": null,
"is_signed": false,
"signed_at": null,
"cylinder_count": null,
"bottom_cylinder_volume": null,
"dive_condition_notes": null
}
}_resources.md → "Dive log".401 Unauthorized{
"success": false,
"status": "error",
"message": "Unauthenticated"
}422 Unprocessable Entity — validationgas_mix omitted while is_free_diving was false.{
"success": false,
"status": "error",
"message": "Validation failed",
"errors": {
"gas_mix": ["The gas mix field is required."]
}
}422 Unprocessable Entity — unknown enum value"gas": "helium" (not a gas type). Every enum field fails the same way, with The selected <field> is invalid.; before this check an unknown value ended in a 500.{
"success": false,
"status": "error",
"message": "Validation failed",
"errors": {
"gas": ["The selected gas is invalid."]
}
}422 Unprocessable Entity — group outside A-Z"group_in": "a".{
"success": false,
"status": "error",
"message": "Validation failed",
"errors": {
"group_in": ["The selected group in is invalid."]
}
}422 Unprocessable Entity — invalid country codeerror(..., 422), not the FormRequest — same full envelope shape, different origin. Not re-captured live in this pass (would require an intentionally malformed country value); documented from store()'s explicit catch block.{
"success": false,
"status": "error",
"message": "Invalid country code"
}DiveLog row, then calls DiveLog::reorder($user).dive_number is required by validation but its value is never used: the server computes the actual number from the diver's existing dive count and then renumbers every dive log by date, so the number in the response can change on the next create or delete. Clients should not rely on controlling this field.region and subregion are derived server-side from country via the country() helper and are not accepted directly.importString() (app/Helpers/HelperFunctions.php): the value is trimmed, and a value that is empty after trimming is stored as null.dive_log_create operation of POST /api/v1/sync/upload.is_free_diving must agree with dive_config. A mismatch is a 422 on is_free_diving with the message The is free diving field must be true when dive config is freediving and false otherwise. The same rule applies to the dive_log_create operation of POST /api/v1/sync/upload.GET /api/v1/diver/dive-logs/loggable-courses lists the log_code, instructor_id and skill_id values this endpoint accepts for a course_log dive.docs/api/diver/dive-logs/POST_create.mdcurl --location 'https://test.diveraid.com/api/v1/diver/dive-logs' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"dive_number": 0,
"date": "2019-08-24",
"dive_config": "freediving",
"dive_type": "pool",
"purpose_type": "fun_dive",
"location": "string",
"country": "string",
"lat": -90,
"lon": -180,
"max_depth": 0,
"average_depth": 0,
"depth_unit": "string",
"dive_time": 0,
"gas": "air",
"gas_mix": {
"oxygen": 0,
"nitrogen": 0,
"helium": 0
},
"pressure_start": 0,
"pressure_end": 0,
"pressure_unit": "string",
"water_temperature": 0,
"weather_temperature": 0,
"temperature_unit": "string",
"safety_stop": true,
"has_decompression": true,
"decompression_note": "string",
"buddy": "string",
"comments": "string",
"log_code": "string",
"skill_log_id": 0,
"skill_id": 0,
"instructor_id": 0,
"weather": "sunny",
"water": "calm",
"current": "no_current",
"visibility": "poor",
"group_in": "string",
"group_out": "string",
"is_free_diving": true
}'{
"status": "success",
"message": "string",
"data": {
"id": 0,
"uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f",
"number": 0,
"date": "2019-08-24",
"dive_type": "string",
"purpose_type": "string",
"location": "string",
"country": "string",
"lat": 0,
"lon": 0,
"dive_config": "string",
"gas": "string",
"gas_mix": {
"oxygen": 0,
"nitrogen": 0,
"helium": 0
},
"max_depth": 0,
"average_depth": 0,
"depth_unit": "string",
"dive_time": 0,
"abt": 0,
"rnt": 0,
"tbt": 0,
"tts": 0,
"pressure_start": 0,
"pressure_end": 0,
"pressure_unit": "string",
"water_temperature": 0,
"weather_temperature": 0,
"temperature_unit": "string",
"weather": "string",
"water": "string",
"current": "string",
"visibility": "string",
"weights": 0,
"weights_unit": "string",
"buddy": "string",
"verified_by": "string",
"wetsuit": "string",
"sac_rate": 0,
"safety_stop": true,
"has_decompression": true,
"decompression_note": "string",
"mod": 0,
"end": "2019-08-24T14:15:22.123Z",
"group_in": "string",
"group_out": "string",
"comments": "string",
"log_code": "string",
"course_id": 0,
"skill_log_id": 0,
"skill_id": 0,
"instructor_id": 0,
"is_signed": true,
"signed_at": "2019-08-24T14:15:22.123Z",
"cylinder_count": 0,
"bottom_cylinder_volume": 0,
"dive_condition_notes": "string"
}
}