Skip to content

Create a custom role

POST
/v1/roles
curl --request POST \
--url https://api.varman.io/v1/roles \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <X-API-Key>' \
--data '{ "name": "Compliance Lead", "permissions": { "control": [ "read", "update" ], "policy": [ "read", "update" ], "risk": [ "read" ] }, "obligations": { "compliance": true } }'

Create a custom role in Varman. Create custom roles and resolve permission sets for organization-level access control.

Media typeapplication/json
object
name
required

Name of the custom role

string
>= 2 characters <= 50 characters

Example

Compliance Lead
permissions
required

Permissions for the role. Keys are resource names, values are arrays of allowed actions.

object

Example

{
"control": [
"read",
"update"
],
"policy": [
"read",
"update"
],
"risk": [
"read"
]
}
obligations

Obligations for the role. Boolean flags for requirements like compliance.

object
compliance

Whether the role must complete compliance tasks.

boolean

Example

false

Example

{
"compliance": true
}

Role created successfully

Media typeapplication/json
object
id
string
name
string
permissions
object
key
additional properties
Array<string>
isBuiltIn
boolean
createdAt
string format: date-time
updatedAt
string format: date-time

Example

{
"id": "rol_abc123",
"name": "compliance-lead",
"isBuiltIn": false
}

Invalid role data or role already exists

Unauthorized

Forbidden - cannot grant permissions you do not have