Guide
Authentication & API keys
Call the API with a workspace API key, a user token or a browser session. All three end up with the same roles and permissions.
Workspace API keys
API keys are for server-to-server integrations. A workspace owner or admin creates them in Settings → Integrations → API keys; the full key is shown once, only its hash is stored. Send it as a Bearer token to any /api/v1 endpoint:
curl "$AXOSIL_URL/api/v1/projects" \
-H "Authorization: Bearer axk_ro_…"| Role | Prefix | What the key may do |
|---|---|---|
| Read-only | axk_ro_ | Read everything in the workspace; any write answers 403 API_KEY_READ_ONLY |
| Manager | axk_mg_ | Read everything and make the changes a manager can |
| Admin | axk_ad_ | Full admin access, except managing API keys |
- A key acts across the whole workspace in the name of the admin who created it; audit log entries name the key.
- It stops working when it is revoked or expires, or when its creator is deactivated or is no longer an owner or admin (the API answers
401). - Each key may make 600 requests a minute, and the workspace's IP rules apply to it.
- The role is part of the key and cannot be changed: create a new key instead.
User tokens (mobile and custom clients)
Clients that act as a signed-in user, such as the mobile app, exchange email and password for a token with POST /api/v1/auth/mobile/login and send it as Authorization: Bearer <token>. Tokens last 7 days and are revoked when the user changes their password or is deactivated.
POST /api/v1/auth/mobile/login
Content-Type: application/json
{ "email": "user@company.com", "password": "••••••••" }{
"token": "eyJhbGciOiJIUzI1NiIs…",
"user": {
"id": "…", "email": "user@company.com", "name": "Jane Doe",
"role": "employee", "image": null,
"tenantId": "…", "tenantSlug": "my-company", "tenantName": "My Company"
}
}Unlike other endpoints, this one answers without the success envelope; errors are { "error": "…", "code": "…" }:
| Status | Code | What to do |
|---|---|---|
| 401 | MFA_REQUIRED | Two-factor is on: send { "mfaToken", "mfaCode" } with the returned mfaToken and an authenticator or recovery code |
| 409 | WORKSPACE_CHOICE | The credentials are valid in several workspaces: retry with tenantSlug from the returned workspaces list |
| 403 | MFA_SETUP_REQUIRED | The workspace requires two-factor: enrol on the web first |
| 403 | EMAIL_NOT_VERIFIED | Verify the email address first |
| 401 | — | Invalid email or password |
| 429 | RATE_LIMITED | Too many attempts; wait for Retry-After |
GET /api/v1/auth/mobile/me returns the current user and POST /api/v1/auth/mobile/logout revokes the token.
Browser sessions
The AxosilDesk web app signs users in with Auth.js (NextAuth v5) using JWT sessions stored in an HTTP-only cookie. Browser code on the same origin can call /api/v1 with that cookie. Prefer API keys or user tokens for anything else: the sign-in flow needs a CSRF token and can redirect to two-factor or workspace selection steps.
| Property | Value |
|---|---|
| Strategy | JWT |
| Cookie name | authjs.session-token (__Secure-authjs.session-token over HTTPS) |
| Max age | 24 hours; changing the password ends every earlier session |
| Token contents | user id, tenantId, tenantSlug, role, name, email |
Single sign-on
Both providers appear on the sign-in page only when their environment variables are set:
- Google —
GOOGLE_CLIENT_IDandGOOGLE_CLIENT_SECRET. - Microsoft Entra ID — an Azure app registration with
AZURE_AD_CLIENT_ID,AZURE_AD_CLIENT_SECRETandAZURE_AD_TENANT_ID.
Roles
Every user has one built-in role. Custom roles (Settings → Roles) can grant extra permissions on top. API keys act as an admin (read-only and admin keys) or a manager.
| Role | Access level | Typical capabilities |
|---|---|---|
tenant_owner | Full access | All operations including billing, settings and team management |
tenant_admin | Administrative | User management, settings, reports, approvals |
manager | Team management | Team data, timesheet and leave approvals, team reports |
employee | Self-service | Own data, time tracking, leave requests, projects |
viewer | Viewer | Limited access |
external_client | Client | External client access |
Desktop agent tokens
The desktop agent registers with the user's credentials and machine details and receives an agent token valid for 90 days. Registering again from the same machine, or signing out, revokes the previous token. Request and response shapes are in Desktop Agent API.