Update custom role
const url = 'http://localhost:3000/api/v1/organizations/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/roles/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0';const options = { method: 'PATCH', headers: {'X-API-Key': '<X-API-Key>', 'Content-Type': 'application/json'}, body: '{"name":"Senior Device Operator","description":"Can view and manage devices and deployments","permissions":["devices:read","devices:write","deployments:read","deployments:write"]}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request PATCH \ --url http://localhost:3000/api/v1/organizations/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/roles/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0 \ --header 'Content-Type: application/json' \ --header 'X-API-Key: <X-API-Key>' \ --data '{ "name": "Senior Device Operator", "description": "Can view and manage devices and deployments", "permissions": [ "devices:read", "devices:write", "deployments:read", "deployments:write" ] }'Updates an existing custom role. System roles cannot be modified.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Role UUID
Organization UUID
Header Parameters
Section titled “Header Parameters”UUID of the organization (tenant) the request acts in. It selects the tenant and grants nothing: the server checks membership or an open tenant switch. Not needed for global operations. A malformed value returns 400. API keys are fixed to their own organization; another organization returns 403. The x-organization-source header grants nothing.
Request Bodyrequired
Section titled “Request Bodyrequired”object
Role display name
Example
Senior Device OperatorRole description
Example
Can view and manage devices and deploymentsList of permission keys assigned to this role
Example
[ "devices:read", "devices:write", "deployments:read", "deployments:write"]Responses
Section titled “Responses”Role updated successfully
object
Unique role identifier
Role display name
Role description
List of permission keys assigned to this role
Whether this is a system-defined role (cannot be modified)
Organization ID (null for system roles)
When the role was created
When the role was last updated
Example
{ "id": "550e8400-e29b-41d4-a716-446655440000", "name": "Device Operator", "description": "Can view and manage devices but not deployments", "permissions": [ "devices:read", "devices:write", "deployments:read" ], "isSystem": false, "organizationId": "550e8400-e29b-41d4-a716-446655440001", "createdAt": "2024-01-15T10:30:00Z", "updatedAt": "2024-06-20T14:45:00Z"}Invalid input data or cannot modify system role
Unauthorized
Forbidden - Insufficient permissions
Role not found