Trillet AI logo

Update Role

Update an existing role's name, description, permissions, or assigned users.

PUThttps://api.trillet.ai/v1/api/roles-and-permissions/roles/{roleId}

Requires the role:edit permission in the workspace.

Headers

x-workspace-idstringrequired

Workspace identifier for the API.

Path Parameters

roleIdstringrequired

The unique identifier of the role to update.

Request Body

namestring

Updated name for the role.

descriptionstring

Updated description for the role. Must not be empty.

permissionsarray of strings

The complete new set of permission keys, in category:action form (e.g., "agent:view"). This replaces the role's permissions; it is not merged with them. At least one key is required when the field is sent. Use List Permissions for the available keys.

userIdsarray of stringsrequired

User IDs to assign this role to, in addition to the users who already hold it. Send [] to assign no one new.

For the built-in system roles (owner, admin, editor, viewer), only userIds is applied. The name, description and permissions of a system role can't be changed.

Response

_idstring

Unique identifier for the role.

namestring

Updated name of the role.

descriptionstring

Updated description of the role.

permissionsobject

Permissions grouped by category, as in Create Role.

{
  "name": "Senior Manager",
  "description": "Manages agents and reviews call history",
  "permissions": [
    "agent:view",
    "agent:create",
    "agent:edit",
    "agent:delete",
    "call_history:view"
  ],
  "userIds": []
}
{
  "_id": "a4a4a4a4a4a4a4a4a4a4a4a4",
  "workspaceId": "a1a1a1a1a1a1a1a1a1a1a1a1",
  "name": "Senior Manager",
  "description": "Manages agents and reviews call history",
  "permissions": {
    "agent": ["agent:view", "agent:create", "agent:edit", "agent:delete"],
    "call_history": ["call_history:view"]
  },
  "isSystem": false,
  "createdAt": "2024-06-01T09:00:00.000Z",
  "updatedAt": "2024-06-02T10:30:00.000Z",
  "__v": 0
}

Last updated on