Trillet AI logo

Create Role

Create a new role with specific permissions for your workspace.

POSThttps://api.trillet.ai/v1/api/roles-and-permissions/roles

Headers

x-api-keystringrequired

API key used for authenticating requests to the API.

x-workspace-idstringrequired

Workspace identifier for the API.

Request Body

namestringrequired

Name of the role (e.g., "Agent Manager", "Viewer").

descriptionstring

Description of the role and its intended use.

permissionsarray of stringsrequired

Array of permission ID strings to assign to this role. Always required — pass an empty array [] if no permissions are needed. Each item must be a plain string (e.g., "agent_view"), not an object. Use the List Permissions endpoint to retrieve available permission IDs.

userIdsarray

Array of user IDs to assign this role to.

Response Fields

_idstring

Unique identifier for the created role.

namestring

Name of the role.

descriptionstring

Description of the role.

permissionsarray

Array of permission objects assigned to the role.

workspaceIdstring

Workspace ID associated with the role.

createdAtstring

Timestamp when the role was created.

With permissions
{
  "name": "Manager",
  "description": "Full access to agents and call history",
  "permissions": [
    "agent_view",
    "agent_create",
    "agent_edit",
    "call_history_view"
  ]
}
Minimal (no permissions)
{
  "name": "Viewer",
  "description": "Read-only role",
  "permissions": []
}
{
  "_id": "665a1b2c3d4e5f6a7b8c9d0e",
  "name": "Manager",
  "description": "Full access to agents and call history",
  "permissions": [
    { "key": "agent_view", "category": "agents" },
    { "key": "agent_create", "category": "agents" },
    { "key": "agent_edit", "category": "agents" },
    { "key": "call_history_view", "category": "calls" }
  ],
  "workspaceId": "664a1b2c3d4e5f6a7b8c9d0e",
  "createdAt": "2024-06-01T09:00:00.000Z"
}