Overview
The Authentication API provides endpoints for user login, registration, 2FA management, and session handling. All authenticated endpoints require a valid JWT token set via cookies.Authentication Flow
SnailyCAD uses JWT-based authentication with access and refresh tokens stored in HTTP-only cookies:snaily-cad-access-token- Short-lived access tokensnaily-cad-refresh-token- Long-lived refresh token
Login
Request Body
The user’s username (case-insensitive)
The user’s password
Two-factor authentication code (required if 2FA is enabled)
Response
The authenticated user’s ID
Indicates if the user needs to change their temporary password
Error Responses
404- User not found400- Invalid credentials, whitelist pending/declined, or user banned400- 2FA code required or invalid
Register
Request Body
Username (alphanumeric, underscores, and periods only)
Password (minimum 8 characters)
Registration code if required by the CAD
Steam ID for linking Steam account
Discord ID for linking Discord account
Response
The newly created user’s ID
Whether the user is the CAD owner
User’s whitelist status:
ACCEPTED, PENDING, or DECLINEDGet Current User
Query Parameters
Include the user’s currently active LEO/EMS-FD unit
Response
User ID
Username
User rank:
OWNER, ADMIN, USER, etc.Array of permission strings
CAD configuration and settings
Active officer or deputy (if
includeActiveUnit=true)Update User Settings
Request Body
New username
Enable dark theme
Preferred language locale (e.g.,
en, de, fr)Status view mode preference
Table actions alignment preference
Sound notification settings
Logout
Response
Returnstrue on success.
Change Password
Request Body
Current password (not required for OAuth users)
New password (minimum 8 characters)
Confirmation of new password (must match)
Two-Factor Authentication
Enable 2FA
Request Body
User’s current password for verification
Response
Data URI of QR code for authenticator apps
Secret key for manual entry
Verify 2FA Code
Request Body
6-digit code from authenticator app
Disable 2FA
Request Body
User’s current password for verification
Delete Account
Response
Returnstrue on success.
Error Responses
400- Cannot delete owner account