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

