Update a custom role
const url = 'https://api.emite.cr/v1/tenants/me/roles/example';const options = { method: 'PATCH', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"name":"Office Manager","description":"example","scopes":["example"]}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request PATCH \ --url https://api.emite.cr/v1/tenants/me/roles/example \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "name": "Office Manager", "description": "example", "scopes": [ "example" ] }'Slug is IMMUTABLE — the column is referenced from tenant_users.role and renaming would orphan existing members. Recreate the role with a new slug and re-assign members if you need to rename.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Custom role slug.
Request Bodyrequired
Section titled “Request Bodyrequired”object
New name for the role, up to 80 characters. Omit it to keep the current one.
Example
Office ManagerNew description, up to 400 characters. Omit it to keep the current one.
Replaces the whole scope list, under the same rules as at creation. The members who hold the role get the new permissions on their next request.
Responses
Section titled “Responses”The role after the update.
object
Identifier of the role definition.
Stable identifier of the role: the value a member's role takes and the :slug of /v1/tenants/me/roles/:slug. It never changes.
The name people see for the role.
What the role is for; null when no description was given.
The permission scopes the role grants, from the catalog of GET /v1/permissions/roles.
When the role was created.
When the role was last changed.
How many active members hold the role now. While it is above 0 the role cannot be deleted (409 CUSTOM_ROLE_IN_USE).
Example
{ "slug": "office_manager", "name": "Office Manager", "description": "Manages day-to-day operations.", "scopes": [ "invoices:read", "invoices:export", "reports:read", "reports:export" ], "memberCount": 2}Missing or invalid JWT.
Custom role management is JWT-only and requires roles:read / roles:manage.
CUSTOM_ROLE_NOT_FOUND.