Skip to main content

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.

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.

Roles

List all roles

GET /rbac/roles Returns all roles, both system-defined and custom.
roles
object[]
Array of role objects.
cURL
curl -X GET https://your-termix-host/rbac/roles \
  -H "Authorization: Bearer <token>"
{
  "roles": [
    {
      "id": 1,
      "name": "admin",
      "displayName": "Administrator",
      "isSystem": true
    },
    {
      "id": 3,
      "name": "devops",
      "displayName": "DevOps Team",
      "description": "Access to production servers",
      "isSystem": false
    }
  ]
}

Create a role

POST /rbac/roles
Requires admin privileges.
name
string
required
Unique machine-readable name. Only lowercase letters, numbers, underscores, and hyphens are allowed.
displayName
string
required
Human-readable display name shown in the UI.
description
string
Optional description of the role’s purpose.
success
boolean
Always true on success.
roleId
number
ID of the newly created role.
message
string
Confirmation message.
StatusMeaning
400name or displayName missing, or name contains invalid characters.
401Authentication required.
403Admin privileges required.
409A role with this name already exists.
500Database error.
cURL
curl -X POST https://your-termix-host/rbac/roles \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{"name": "devops", "displayName": "DevOps Team", "description": "Access to production servers"}'

Update a role

PUT /rbac/roles/:id
Requires admin privileges.
id
number
required
Role ID.
displayName
string
New display name.
description
string
New description. Pass empty string to clear.
StatusMeaning
400Invalid role ID, or neither displayName nor description provided.
401Authentication required.
403Admin privileges required.
404Role not found.
500Database error.
cURL
curl -X PUT https://your-termix-host/rbac/roles/3 \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{"displayName": "DevOps Engineers"}'

Delete a role

DELETE /rbac/roles/:id
Requires admin privileges. System roles (isSystem: true) cannot be deleted.
Deletes the role and removes all user-role and host-access grants associated with it. Permission caches for affected users are invalidated.
id
number
required
Role ID.
StatusMeaning
400Invalid role ID.
401Authentication required.
403Admin privileges required, or the role is a system role.
404Role not found.
500Database error.
cURL
curl -X DELETE https://your-termix-host/rbac/roles/3 \
  -H "Authorization: Bearer <token>"

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.
userId
string
required
The target user’s ID.
roles
object[]
Array of assigned role objects with id, roleId, roleName, roleDisplayName, description, isSystem, and grantedAt.
StatusMeaning
401Authentication required.
403Access denied — cannot view another user’s roles without admin privileges.
500Database error.
cURL
curl -X GET https://your-termix-host/rbac/users/user_abc123/roles \
  -H "Authorization: Bearer <token>"

Assign a role to a user

POST /rbac/users/:userId/roles
Requires admin privileges. System roles cannot be manually assigned.
userId
string
required
The target user’s ID.
roleId
number
required
ID of the role to assign.
When a role is assigned, shared credentials are automatically provisioned for all hosts that have been shared with that role.
StatusMeaning
400roleId is not a number.
401Authentication required.
403Admin privileges required, or the role is a system role.
404User or role not found.
409The user already has this role.
500Database error.
cURL
curl -X POST https://your-termix-host/rbac/users/user_abc123/roles \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{"roleId": 3}'

Remove a role from a user

DELETE /rbac/users/:userId/roles/:roleId
Requires admin privileges. System roles cannot be removed.
userId
string
required
The target user’s ID.
roleId
number
required
The role ID to remove.
StatusMeaning
400Invalid role ID.
401Authentication required.
403Admin privileges required, or the role is a system role.
404Role not found.
500Database error.
cURL
curl -X DELETE https://your-termix-host/rbac/users/user_abc123/roles/3 \
  -H "Authorization: Bearer <token>"

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.
id
number
required
Host ID.
accessList
object[]
StatusMeaning
400Invalid host ID.
401Authentication required.
403The authenticated user does not own the host.
500Database error.
cURL
curl -X GET https://your-termix-host/rbac/host/5/access \
  -H "Authorization: Bearer <token>"

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.
id
number
required
Host ID.
targetType
string
default:"user"
Who to share with. Either "user" or "role".
targetUserId
string
Required when targetType is "user". The user’s ID.
targetRoleId
number
Required when targetType is "role". The role’s ID.
durationHours
number
Optional. If set, the access grant expires after this many hours.
permissionLevel
string
default:"view"
Permission level. Currently only "view" is supported.
success
boolean
Always true on success.
message
string
Confirmation message.
expiresAt
string
ISO 8601 expiry timestamp, or null for permanent grants.
StatusMeaning
400Invalid targetType, missing targetUserId/targetRoleId, or host has no credential assigned.
401Authentication required.
403The authenticated user does not own the host.
404Target user or role not found.
500Database error.
cURL
curl -X POST https://your-termix-host/rbac/host/5/share \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "targetType": "user",
    "targetUserId": "user_abc123",
    "durationHours": 24
  }'

Revoke host access

DELETE /rbac/host/:id/access/:accessId Removes an access grant. Only the host owner can revoke grants.
id
number
required
Host ID.
accessId
number
required
Access grant ID (from the access list).
StatusMeaning
400Invalid host ID or access ID.
401Authentication required.
403The authenticated user does not own the host.
500Database error.
cURL
curl -X DELETE https://your-termix-host/rbac/host/5/access/12 \
  -H "Authorization: Bearer <token>"

List shared hosts

GET /rbac/shared-hosts Returns all hosts shared with the authenticated user that have not yet expired.
sharedHosts
object[]
cURL
curl -X GET https://your-termix-host/rbac/shared-hosts \
  -H "Authorization: Bearer <token>"

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.
id
number
required
Snippet ID.
accessList
object[]
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.
id
number
required
Snippet ID.
targetType
string
default:"user"
"user" or "role".
targetUserId
string
Required when targetType is "user".
targetRoleId
number
Required when targetType is "role".
durationHours
number
Optional expiry in hours.
StatusMeaning
400Invalid targetType or missing target identifier.
401Authentication required.
403The authenticated user does not own the snippet.
404Target user or role not found.
500Database error.
cURL
curl -X POST https://your-termix-host/rbac/snippet/42/share \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{"targetType": "role", "targetRoleId": 3}'

Revoke snippet access

DELETE /rbac/snippet/:id/access/:accessId
id
number
required
Snippet ID.
accessId
number
required
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.
sharedSnippets
object[]
cURL
curl -X GET https://your-termix-host/rbac/shared-snippets \
  -H "Authorization: Bearer <token>"

Build docs developers (and LLMs) love