Bearer Token
All authenticated endpoints require a valid JWT access token in theAuthorization header.
Token Types
The API issues two token types:| Token | Purpose | Lifetime |
|---|---|---|
| Access token | Authenticates API requests | Short-lived (configurable, typically 30 min) |
| Refresh token | Used to obtain a new access token | Long-lived (configurable, typically 7 days) |
Token Claims
Access tokens contain the following claims:| Claim | Type | Description |
|---|---|---|
sub | string | The user’s unique ID |
tenant_id | string | The tenant this user belongs to |
role | string | Legacy role enum (STUDENT, FACULTY, ADMIN, SUPER_ADMIN) |
role_id | string | The user’s dynamic role ID (used for permission checks) |
type | string | Always "access" for access tokens |
exp | number | Token expiration timestamp (Unix epoch) |
The
role claim is kept for backward compatibility. Authorization is now handled by the dynamic permission system via role_id. See Roles & Permissions for details.Authorization Model
The API uses a permission-based authorization system. Each role has a set of permissions organized by module and action:| Action | Description |
|---|---|
can_view | Read access (list, get) |
can_create | Create new resources |
can_edit | Update existing resources |
can_delete | Delete resources |
USER_MANAGEMENT, ROLE_MANAGEMENT, TENANT_MANAGEMENT, CASE_STUDIES, KNOWLEDGE_BASES, ASSESSMENTS, SESSIONS, FEEDBACK.
Console endpoints (/v1/console/*) require specific module permissions. User-facing endpoints (/v1/*) are available to any authenticated user.
Handling Token Expiry
When an access token expires, the API returns:- Catch any
401response wherecodeisTOKEN_EXPIRED - Call your refresh endpoint with the refresh token to get a new access token
- Retry the original request with the new access token
- If the refresh also fails, redirect the user to login
Auth Error Responses
Missing token — 401
Missing token — 401
No
Authorization header was provided.Malformed header — 401
Malformed header — 401
The header doesn’t follow the
Bearer <token> format.Invalid or malformed token — 401
Invalid or malformed token — 401
The token signature is invalid, the token is corrupted, or claims are missing.
Expired token — 401
Expired token — 401
The access token has expired. Use the refresh token to get a new one.
Insufficient permissions — 403
Insufficient permissions — 403
The user’s role does not have the required permission for this endpoint.