Users API
The Users API handles user registration, authentication, and profile management. All user data is stored in MongoDB with secure password hashing.User Model
TheUser model represents a user in the system:
Unique user identifier (UUID v4)
User’s email address (unique, used for login)
User’s full name
Organization name (defaults to “Default Organization”)
User role:
"user" or "admin" (defaults to “user”)Whether multi-factor authentication is enabled (defaults to
true)Timestamp when the user was created (ISO 8601 format)
Extended Fields (SSO)
For users who authenticate via SSO:SSO provider name (e.g., “zitadel”)
SSO subject identifier from OIDC
Array of role strings from SSO provider
Array of group strings from SSO provider
Profile picture URL from SSO provider
Timestamp of last login (ISO 8601 format)
Register User
Create a new user account with email and password.Request Body
User’s email address (must be unique)
User’s password (hashed with SHA-256 before storage)
User’s full name
Organization name (optional, defaults to “Default Organization”)
Response
Authentication token for API requests
Always “bearer”
Created user object
Response Example
Automatic Actions
When a user registers:- Email uniqueness is validated
- Password is hashed using SHA-256
- User record is created in MongoDB
- Access token is generated
- Audit log entry is created:
"register"action
Error Responses
Login User
Authenticate an existing user with email and password.Request Body
User’s email address
User’s password
Response
Same structure as registration - returnsAuthToken with user profile.
Automatic Actions
When a user logs in:- Email is looked up in database
- Password hash is verified
- Access token is generated
- Audit log entry is created:
"login"action
Error Responses
Get Current User
Retrieve the authenticated user’s profile.Response
Error Responses
Logout
Invalidate the current authentication token.Response
Automatic Actions
When a user logs out:- Token is removed from active tokens
- Audit log entry is created:
"logout"action
Password Security
Password hashing implementation:User Roles
User Role
Standard users can:- Access their own workspaces
- Launch and stop sessions
- View their own audit logs
- View their profile
Admin Role
Admins can:- All user permissions
- Create, update, and delete workspaces
- View all audit logs
- Manage policies
- View all users and organizations
Integration with Other APIs
The user context is used across all authenticated endpoints:- Workspaces: User ID tracks who launches workspaces
- Sessions: User email and ID are stored in session records
- Audit Logs: All actions are attributed to the authenticated user
- Organizations: Users belong to organizations