Skip to main content

Register

Creates a new user account in the DriveX system. The password is automatically hashed using BCrypt before storage.

Endpoint

POST /api/auth/register

Request Body

username
string
required
The desired username for the new account
email
string
required
The user’s email address (must be unique)
password_hash
string
required
The user’s password in plain text (will be hashed automatically)
firstname
string
The user’s first name
lastname
string
The user’s last name
phone_number
string
The user’s phone number
role
string
The user’s role in the system
is_active
boolean
Whether the user account should be active (defaults to system settings)
profileImage
string
URL or path to the user’s profile image

Response

Success Response (200 OK)

Returns the created user object with the hashed password.
id
long
Unique identifier for the newly created user
username
string
The user’s username
email
string
The user’s email address
password_hash
string
The hashed password (BCrypt)
firstname
string
The user’s first name
lastname
string
The user’s last name
phone_number
string
The user’s phone number
role
string
The user’s role in the system
is_active
boolean
Whether the user account is active
created_at
timestamp
When the user account was created
updated_at
timestamp
When the user account was last updated
profileImage
string
URL or path to the user’s profile image

Error Responses

409 Conflict

Returned when the email address is already registered in the system.
"Email ya registrado"

Example

Request

curl -X POST http://localhost:8080/api/auth/register \
  -H "Content-Type: application/json" \
  -d '{
    "username": "johndoe",
    "email": "[email protected]",
    "password_hash": "mySecurePassword123",
    "firstname": "John",
    "lastname": "Doe",
    "phone_number": "+1234567890",
    "role": "user",
    "is_active": true
  }'

Response (200 OK)

{
  "id": 1,
  "username": "johndoe",
  "email": "[email protected]",
  "password_hash": "$2a$10$abcdefghijklmnopqrstuv",
  "firstname": "John",
  "lastname": "Doe",
  "phone_number": "+1234567890",
  "role": "user",
  "is_active": true,
  "created_at": "2026-03-01T10:30:00Z",
  "updated_at": "2026-03-01T10:30:00Z",
  "profileImage": null
}

Response (409 Conflict)

"Email ya registrado"

Build docs developers (and LLMs) love