Create Role
Create a new role with specific permissions for your workspace.
Headers
x-api-keystringrequiredAPI key used for authenticating requests to the API.
x-workspace-idstringrequiredWorkspace identifier for the API.
Request Body
namestringrequiredName of the role (e.g., "Agent Manager", "Viewer").
descriptionstringDescription of the role and its intended use.
permissionsarray of stringsrequiredArray 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.
userIdsarrayArray of user IDs to assign this role to.
Response Fields
_idstringUnique identifier for the created role.
namestringName of the role.
descriptionstringDescription of the role.
permissionsarrayArray of permission objects assigned to the role.
workspaceIdstringWorkspace ID associated with the role.
createdAtstringTimestamp when the role was created.
{
"name": "Manager",
"description": "Full access to agents and call history",
"permissions": [
"agent_view",
"agent_create",
"agent_edit",
"call_history_view"
]
}{
"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"
}