Skip to main content
All authenticated endpoints require a valid JWT token obtained from the login endpoint. Tokens are signed with HS256 and expire after 8 hours.

Login

Obtain a token by submitting valid credentials.
POST /api/auth/login

Request body

email
string
required
A valid email address for the account.
password
string
required
The account password.

Response

token
string
required
Signed JWT to use on subsequent requests.
user
object
required
Tokens expire after 8 hours. After expiry, the client must log in again to obtain a new token.
curl --request POST \
  --url https://your-domain.com/api/auth/login \
  --header 'Content-Type: application/json' \
  --data '{
    "email": "[email protected]",
    "password": "s3cur3p@ss"
  }'

Using the token

Pass the token as a Bearer token in the Authorization header on every authenticated request.
curl --request GET \
  --url https://your-domain.com/api/auth/me \
  --header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...'

Get current user

Returns the profile of the authenticated user.
GET /api/auth/me
Requires: Authorization: Bearer <token>

Response

user
object
required
curl --request GET \
  --url https://your-domain.com/api/auth/me \
  --header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...'

Get assigned vehicle (technician only)

Returns the active vehicle assignment for the authenticated technician, including vehicle details and maintenance status.
GET /api/technician/assigned-vehicle
Requires: Authorization: Bearer <token> with role technician

Response

assignment
object
required
vehicle
object
required
Full vehicle record including fleet information, inspection history, and maintenance records.
maintenanceStatus
object
required
Computed maintenance status for the vehicle based on current mileage and maintenance history.
curl --request GET \
  --url https://your-domain.com/api/technician/assigned-vehicle \
  --header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...'

Error codes

StatusMessageDescription
401Missing tokenThe Authorization header was not provided or does not contain a Bearer token.
401Invalid tokenThe token is malformed, has been tampered with, or has expired.
401Credenciales invalidasThe email or password supplied to POST /api/auth/login is incorrect.
403ForbiddenThe authenticated user’s role does not have permission to access the requested endpoint.

Build docs developers (and LLMs) love