Assign Roles to Taxonomy
Assign one or more roles to a taxonomy for RBAC filtering.
Endpoint
POST /v1/workspaces/{workspaceId}/taxonomy/{taxonomyId}/rolesRequest
curl -X POST \
'https://api.sharely.ai/v1/workspaces/{workspaceId}/taxonomy/{taxonomyId}/roles' \
-H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
-H 'Content-Type: application/json' \
-H 'organizationid: your-organization-id' \
-d '{
"roleIds": ["role-uuid-1", "role-uuid-2"]
}'Body Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
roleIds | array of UUIDs | Yes | Array of role UUIDs to assign |
Important
Must use roleId (UUID), not customerRoleId. If you only have customerRoleId, look it up first using the Get Role by Customer Role ID endpoint.
Response
{
"success": true,
"assignedCount": 2
}Example
// First, look up roles by customerRoleId
const physicianRole = await fetch(
'https://api.sharely.ai/v1/workspaces/' + workspaceId + '/role/by-customer-role-id/physician',
{ method: 'GET', headers }
).then(r => r.json());
// Then assign using the roleId (UUID)
await fetch(
'https://api.sharely.ai/v1/workspaces/' + workspaceId + '/taxonomy/' + taxonomyId + '/roles',
{
method: 'POST',
headers,
body: JSON.stringify({
roleIds: [physicianRole.id]
})
}
);