Create a custom role
POST
/v1/roles
const url = 'https://api.varman.io/v1/roles';const options = { method: 'POST', headers: {'X-API-Key': '<X-API-Key>', 'Content-Type': 'application/json'}, body: '{"name":"Compliance Lead","permissions":{"control":["read","update"],"policy":["read","update"],"risk":["read"]},"obligations":{"compliance":true}}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}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.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”Media typeapplication/json
object
name
required
Name of the custom role
string
Example
Compliance Leadpermissions
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
falseExample
{ "compliance": true}Responses
Section titled “Responses”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