Update a custom role
curl --request PATCH \
--url https://api.trycomp.ai/v1/roles/{roleId} \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"name": "Compliance Manager",
"permissions": {
"control": [
"read",
"update",
"delete"
],
"policy": [
"read",
"update",
"delete"
],
"risk": [
"read",
"update"
]
},
"obligations": {
"compliance": true
}
}
'const options = {
method: 'PATCH',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Compliance Manager',
permissions: {
control: ['read', 'update', 'delete'],
policy: ['read', 'update', 'delete'],
risk: ['read', 'update']
},
obligations: {compliance: true}
})
};
fetch('https://api.trycomp.ai/v1/roles/{roleId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.trycomp.ai/v1/roles/{roleId}"
payload = {
"name": "Compliance Manager",
"permissions": {
"control": ["read", "update", "delete"],
"policy": ["read", "update", "delete"],
"risk": ["read", "update"]
},
"obligations": { "compliance": True }
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text){
"id": "<string>",
"name": "<string>",
"permissions": {},
"isBuiltIn": true,
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
}Roles
Update a custom role | Comp AI API
Update a custom role in Comp AI. Create custom roles and resolve permission sets for organization-level access control.
PATCH
/
v1
/
roles
/
{roleId}
Update a custom role
curl --request PATCH \
--url https://api.trycomp.ai/v1/roles/{roleId} \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"name": "Compliance Manager",
"permissions": {
"control": [
"read",
"update",
"delete"
],
"policy": [
"read",
"update",
"delete"
],
"risk": [
"read",
"update"
]
},
"obligations": {
"compliance": true
}
}
'const options = {
method: 'PATCH',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Compliance Manager',
permissions: {
control: ['read', 'update', 'delete'],
policy: ['read', 'update', 'delete'],
risk: ['read', 'update']
},
obligations: {compliance: true}
})
};
fetch('https://api.trycomp.ai/v1/roles/{roleId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.trycomp.ai/v1/roles/{roleId}"
payload = {
"name": "Compliance Manager",
"permissions": {
"control": ["read", "update", "delete"],
"policy": ["read", "update", "delete"],
"risk": ["read", "update"]
},
"obligations": { "compliance": True }
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text){
"id": "<string>",
"name": "<string>",
"permissions": {},
"isBuiltIn": true,
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
}Authorizations
API key for authentication
Path Parameters
Role ID
Example:
"rol_abc123"
Body
application/json
New name for the custom role
Required string length:
2 - 50Example:
"Compliance Manager"
Updated permissions for the role. Keys are resource names, values are arrays of allowed actions.
Example:
{ "control": ["read", "update", "delete"], "policy": ["read", "update", "delete"], "risk": ["read", "update"] }
Updated obligations for the role.
Show child attributes
Show child attributes
Example:
{ "compliance": true }
Was this page helpful?

