The RBAC API provides role-based access control for Termix resources. You can create custom roles, assign them to users, and share individual hosts and snippets with specific users or roles. All endpoints require JWT authentication. Role creation, update, deletion, and user-role assignments additionally require admin privileges.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/Termix-SSH/Termix/llms.txt
Use this file to discover all available pages before exploring further.
Roles
List all roles
GET /rbac/roles
Returns all roles, both system-defined and custom.
Array of role objects.
Example request
Example request
cURL
Example response (200)
Example response (200)
Create a role
POST /rbac/roles
Requires admin privileges.
Unique machine-readable name. Only lowercase letters, numbers, underscores, and hyphens are allowed.
Human-readable display name shown in the UI.
Optional description of the role’s purpose.
Always
true on success.ID of the newly created role.
Confirmation message.
Error responses
Error responses
| Status | Meaning |
|---|---|
| 400 | name or displayName missing, or name contains invalid characters. |
| 401 | Authentication required. |
| 403 | Admin privileges required. |
| 409 | A role with this name already exists. |
| 500 | Database error. |
Example request
Example request
cURL
Update a role
PUT /rbac/roles/:id
Requires admin privileges.
Role ID.
New display name.
New description. Pass empty string to clear.
Error responses
Error responses
| Status | Meaning |
|---|---|
| 400 | Invalid role ID, or neither displayName nor description provided. |
| 401 | Authentication required. |
| 403 | Admin privileges required. |
| 404 | Role not found. |
| 500 | Database error. |
Example request
Example request
cURL
Delete a role
DELETE /rbac/roles/:id
Requires admin privileges. System roles (
isSystem: true) cannot be deleted.Role ID.
Error responses
Error responses
| Status | Meaning |
|---|---|
| 400 | Invalid role ID. |
| 401 | Authentication required. |
| 403 | Admin privileges required, or the role is a system role. |
| 404 | Role not found. |
| 500 | Database error. |
Example request
Example request
cURL
User-role assignments
Get a user’s roles
GET /rbac/users/:userId/roles
Users can query their own roles. Querying another user’s roles requires admin privileges.
The target user’s ID.
Array of assigned role objects with
id, roleId, roleName, roleDisplayName, description, isSystem, and grantedAt.Error responses
Error responses
| Status | Meaning |
|---|---|
| 401 | Authentication required. |
| 403 | Access denied — cannot view another user’s roles without admin privileges. |
| 500 | Database error. |
Example request
Example request
cURL
Assign a role to a user
POST /rbac/users/:userId/roles
Requires admin privileges. System roles cannot be manually assigned.
The target user’s ID.
ID of the role to assign.
Error responses
Error responses
| Status | Meaning |
|---|---|
| 400 | roleId is not a number. |
| 401 | Authentication required. |
| 403 | Admin privileges required, or the role is a system role. |
| 404 | User or role not found. |
| 409 | The user already has this role. |
| 500 | Database error. |
Example request
Example request
cURL
Remove a role from a user
DELETE /rbac/users/:userId/roles/:roleId
Requires admin privileges. System roles cannot be removed.
The target user’s ID.
The role ID to remove.
Error responses
Error responses
| Status | Meaning |
|---|---|
| 400 | Invalid role ID. |
| 401 | Authentication required. |
| 403 | Admin privileges required, or the role is a system role. |
| 404 | Role not found. |
| 500 | Database error. |
Example request
Example request
cURL
Host access
Get host access list
GET /rbac/host/:id/access
Returns all users and roles that have been granted access to the specified host. Only the host owner can call this endpoint.
Host ID.
Error responses
Error responses
| Status | Meaning |
|---|---|
| 400 | Invalid host ID. |
| 401 | Authentication required. |
| 403 | The authenticated user does not own the host. |
| 500 | Database error. |
Example request
Example request
cURL
Share a host
POST /rbac/host/:id/share
Grants access to a host for a specific user or role. The host must have a credential assigned before it can be shared.
Host ID.
Who to share with. Either
"user" or "role".Required when
targetType is "user". The user’s ID.Required when
targetType is "role". The role’s ID.Optional. If set, the access grant expires after this many hours.
Permission level. Currently only
"view" is supported.Always
true on success.Confirmation message.
ISO 8601 expiry timestamp, or
null for permanent grants.Error responses
Error responses
| Status | Meaning |
|---|---|
| 400 | Invalid targetType, missing targetUserId/targetRoleId, or host has no credential assigned. |
| 401 | Authentication required. |
| 403 | The authenticated user does not own the host. |
| 404 | Target user or role not found. |
| 500 | Database error. |
Example request
Example request
cURL
Revoke host access
DELETE /rbac/host/:id/access/:accessId
Removes an access grant. Only the host owner can revoke grants.
Host ID.
Access grant ID (from the access list).
Error responses
Error responses
| Status | Meaning |
|---|---|
| 400 | Invalid host ID or access ID. |
| 401 | Authentication required. |
| 403 | The authenticated user does not own the host. |
| 500 | Database error. |
Example request
Example request
cURL
List shared hosts
GET /rbac/shared-hosts
Returns all hosts shared with the authenticated user that have not yet expired.
Example request
Example request
cURL
Snippet access
Get snippet access list
GET /rbac/snippet/:id/access
Returns all users and roles with access to a snippet. Only the snippet owner can call this endpoint.
Snippet ID.
Same structure as the host access list, but without
permissionLevel (snippets always grant "view").Share a snippet
POST /rbac/snippet/:id/share
Grants access to a snippet for a user or role.
Snippet ID.
"user" or "role".Required when
targetType is "user".Required when
targetType is "role".Optional expiry in hours.
Error responses
Error responses
| Status | Meaning |
|---|---|
| 400 | Invalid targetType or missing target identifier. |
| 401 | Authentication required. |
| 403 | The authenticated user does not own the snippet. |
| 404 | Target user or role not found. |
| 500 | Database error. |
Example request
Example request
cURL
Revoke snippet access
DELETE /rbac/snippet/:id/access/:accessId
Snippet ID.
Access grant ID.
List shared snippets
GET /rbac/shared-snippets
Returns snippets shared with the authenticated user (both directly and via role membership) that have not expired.
Example request
Example request
cURL