RAID API
  1. Auth
  • 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
        POST
      • Login and get a Sanctum token
        POST
      • Send password reset email
        POST
      • Reset password using token
        POST
      • Logout and revoke the current token
        POST
      • Resend email verification
        POST
      • Complete a two-factor login and get a Sanctum token
        POST
    • 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
      • 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. Auth

Login and get a Sanctum token

POST
https://test.diveraid.com/api/v1/auth/login
V1 Auth
Maintainer:rivalex

Overview#

Authenticates a user with email and password and returns a Sanctum personal access token. The token is sent on every subsequent call in the Authorization: Bearer {token} header.
For an account with two-factor authentication enabled, the password alone does not yield a token: the endpoint answers 200 with a challenge_token instead, and the token is issued by POST /api/v1/auth/two-factor-challenge once the second factor is supplied. See the two-factor response below.
The endpoint is stateless by design: it does not call Auth::attempt() and never starts a session. Credentials are checked directly against the user provider of the api guard.
Controller: App\Http\Controllers\Api\V1\Auth\AuthController::login()
Route name: api.v1.auth.login

Authentication#

Type: None. Public endpoint.
Additional middleware: throttle:auth — 10 requests per minute per IP address.

Request#

Method: POST
Path: /api/v1/auth/login
Content-Type: application/json

Body#

{
  "email": "diver@example.com",
  "password": "SecurePass123!",
  "device_name": "Alex's iPhone"
}
FieldTypeRequiredValidationDescription
emailstringYesrequired|email:rfcRegistered email address
passwordstringYesrequired|stringAccount password
device_namestringNosometimes|string|max:255Label for this token, shown to the user on their devices screen
Validated by App\Http\Requests\Api\V1\Auth\LoginRequest.
When device_name is omitted or blank, the server derives a label from the User-Agent header as {platform} - {browser}, falling back to Unknown for either part, and to Mobile device when neither can be determined. Supplying a meaningful device_name is strongly recommended: it is what the account holder sees when deciding which device to revoke.

Example request#


Response 200 OK#

Two shapes, told apart by data.two_factor: present and true for an account with two-factor authentication, absent for every other account.

Without two-factor authentication#

{
  "success": true,
  "status": "success",
  "message": "OK",
  "data": {
    "token": "1|raid_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
    "token_type": "Bearer",
    "expires_in": 7775999
  }
}

Response fields#

FieldTypeNullableAlways presentDescription
data.tokenstringNoYesOpaque personal access token. Send it verbatim as Authorization: Bearer {token}
data.token_typestringNoYesAlways Bearer
data.expires_inintegerNoYesSeconds until expiry. 90 days, so approximately 7776000. Treat it as approximate: it is computed at response time and truncates to the second
This is the shape for every account whose two-factor authentication is off or was started but never confirmed. It carries no two_factor key.

200 OK — two-factor challenge#

{
  "success": true,
  "status": "success",
  "message": "OK",
  "data": {
    "two_factor": true,
    "challenge_token": "Zx9kQ2mV7bT4nW1cR8yH5pL0dJ3sF6uAeG2tB9vKq4XoM7iNzC5wY1rD8hE3jP6a",
    "expires_in": 300
  }
}
FieldTypeNullableAlways presentDescription
data.two_factorbooleanNoYesAlways true in this shape. Absent in the shape above
data.challenge_tokenstringNoYesOpaque, single use. Not a bearer token. Send it to POST /api/v1/auth/two-factor-challenge
data.expires_inintegerNoYesSeconds the challenge stays valid: 300
data.token——NoNot present: no token is issued by this response
No token is created by this response. The device_name sent here is kept with the challenge and names the token issued when the challenge is redeemed.

Errors#

401 Unauthorized — wrong credentials#

{
  "success": false,
  "status": "error",
  "message": "Invalid credentials"
}
The same message is returned for an unknown email and for a wrong password, deliberately: the endpoint does not reveal whether an address is registered.

422 Unprocessable Entity — validation#

{
  "success": false,
  "status": "error",
  "message": "Validation failed",
  "errors": {
    "email": ["The email field must be a valid email address."],
    "password": ["The password field is required."]
  }
}

429 Too Many Requests#

{
  "success": false,
  "status": "error",
  "message": "Too many requests"
}
Retry-After header present. The throttle:auth limiter allows 10 requests per minute per IP address, shared across register, login, password/forgot and password/reset, counting successful and failed attempts alike.

Notes#

Tokens are Sanctum personal access tokens, not JWTs. They are opaque strings of the form {id}|raid_{random}, carry no readable payload, and are stored server-side, which is what makes individual revocation possible.
Tokens live 90 days and do not rotate. There is no refresh endpoint: when a token expires the user logs in again.
Every login issues a new independent token. Logging in from a second device does not invalidate the first.
Tokens are issued with the * ability.
Branch on data.two_factor === true. The key is absent, not false, for accounts without two-factor authentication. Accounts that started enabling it but never confirmed it are not challenged.
Every token held by an account with two-factor authentication was revoked once when this release shipped, because those tokens were obtained without the second factor. Such accounts must log in again.
A password reset revokes every token on the account. A password change from the profile endpoint revokes every token except the one making the request.
The account holder can see and revoke individual tokens from their privacy screen in the web application.

Source: docs/api/auth/POST_login.md

Request

Body Params application/jsonRequired

Examples

Responses

🟢200
application/json
Login successful
Bodyapplication/json

🟠401
🟠422
🟠429
Request Request Example
Shell
JavaScript
Java
Swift
curl --location 'https://test.diveraid.com/api/v1/auth/login' \
--header 'Content-Type: application/json' \
--data '{
    "email": "{{user_email}}",
    "password": "{{user_password}}",
    "device_name": "User'\''s iPhone"
}'
Response Response Example
200 - Example 1
{
    "status": "success",
    "message": "string",
    "data": {
        "token": "string",
        "token_type": "Bearer",
        "expires_in": 0
    }
}
Modified at 2026-10-07 16:01:35
Previous
Register a new user
Next
Send password reset email
Built with