Skip to content

Auth API

Handles user authentication including initial setup, login, and application setup status.

Setup

Initial setup

POST
/v1/auth/setup

Creates the initial administrator user. Can only be called once when no users exist.

Request Body

application/json
JSON
{
  
"email": "[email protected]",
  
"password": "securepassword123",
  
"first_name": "Admin",
  
"last_name": "User"
}

Responses

Admin user created and logged in successfully.

application/json
JSON
{
  
"accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
  
"user": {
  
  
"id": "clx1y2z3a0000b4d2",
  
  
"first_name": "Jane",
  
  
"last_name": "Doe",
  
  
"email": "[email protected]",
  
  
"role": {
  
  
  
"id": "clx1y2z3a0000b4d2",
  
  
  
"slug": "predefined_super_admin",
  
  
  
"name": "Super Admin",
  
  
  
"policies": [
  
  
  
  
{
  
  
  
  
  
"action": "read",
  
  
  
  
  
"subject": "archive",
  
  
  
  
  
"conditions": {
  
  
  
  
  
}
  
  
  
  
}
  
  
  
],
  
  
  
"createdAt": "string",
  
  
  
"updatedAt": "string"
  
  
},
  
  
"createdAt": "string"
  
}
}

Playground

Body

Samples

Powered by VitePress OpenAPI

Login

Login

POST
/v1/auth/login

Authenticates a user with email and password and returns a JWT access token.

Request Body

application/json
JSON
{
  
"email": "[email protected]",
  
"password": "securepassword123"
}

Responses

Authentication successful.

application/json
JSON
{
  
"accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
  
"user": {
  
  
"id": "clx1y2z3a0000b4d2",
  
  
"first_name": "Jane",
  
  
"last_name": "Doe",
  
  
"email": "[email protected]",
  
  
"role": {
  
  
  
"id": "clx1y2z3a0000b4d2",
  
  
  
"slug": "predefined_super_admin",
  
  
  
"name": "Super Admin",
  
  
  
"policies": [
  
  
  
  
{
  
  
  
  
  
"action": "read",
  
  
  
  
  
"subject": "archive",
  
  
  
  
  
"conditions": {
  
  
  
  
  
}
  
  
  
  
}
  
  
  
],
  
  
  
"createdAt": "string",
  
  
  
"updatedAt": "string"
  
  
},
  
  
"createdAt": "string"
  
}
}

Playground

Body

Samples

Powered by VitePress OpenAPI

Check Setup Status

Check setup status

GET
/v1/auth/status

Returns whether the application has been set up (i.e., whether an admin user exists).

Responses

Setup status returned.

application/json
JSON
{
  
"needsSetup": false
}

Playground

Samples

Powered by VitePress OpenAPI