On this page6 sections
POST/api/roles/create-roleRolesPermission: roles.create
Create Role
Creates a new custom RBAC role in the active tenant. Enforces anti-escalation rules so actors cannot grant permissions they do not hold.
Authentication: Requires Authorization: Bearer <ACCESS_TOKEN> (Supabase JWT, OAuth2 M2M token, or integration token).
Request
Provide the following fields in the request payload.
IDstringoptional
ID parameter.
idstringoptional
id parameter.
namestringrequired
name parameter.
dataScopeenum('all' | 'own')optionaldefault: all
data Scope parameter.
scopedModulesstringoptionaldefault:
scoped Modules parameter.
permissionsarray<object>required
permissions parameter.
permissions[].moduleenum('dashboard' | 'product' | 'inventory' | 'invoice', ...)required
module parameter.
permissions[].actionenum('view' | 'create' | 'update' | 'delete', ...)required
action parameter.
Responses
Select a status code to inspect schema.
Created — Role created successfully.application/json
successenum('true')
Success (true).
messagestring
Message.
dataobject | null
Response payload or null.
POST/api/roles/create-role
curl -X POST "https://api.invoger.com/api/roles/create-role" \
-H "Authorization: Bearer <ACCESS_TOKEN>" \
-H "Content-Type: application/json" \
-d '{ "name": "Store Cashier", "dataScope": "own", "scopedModules": "invoice,inventory", "permissions": [ { "module": "invoice", "action": "create" }, { "module": "invoice", "action": "view" } ] }'Interactive playground
Response
application/json
{
"success": true,
"message": "Role created successfully",
"data": {
"id": "r2b3c4d5-e6f7-8a9b-0c1d-2e3f4a5b6c7d",
"name": "Store Cashier"
}
}