API reference

Roles and permissions

Define an app's resources, permissions and roles, and assign roles to users.

These endpoints build the policy that checks evaluate. They take the app key (or a workspace key above the app). Slugs are lowercase. Each write moves the policy version by one and is kept in the version history.

Writes that create or change resources, relations, resource roles, permissions and roles need a plan with the authorization feature: without it they return 422 with error_code feature_not_available. Deletes and role assignments do not.

Common errors on this page:

Statuserror_codeWhen
404not_foundNo resource, role or permission with that slug
404user_not_foundNo user with that ID in the app
409in_useThe thing is still used. Repeat with force=true to remove what uses it too
422invalidA validation failed, including a slug that already exists. error lists the messages

Resources#

List resources#

GET/v1/apps/:app_id/authz/resourcesApp key
Requestbash
curl https://api.scute.io/v1/apps/$SCUTE_APP_ID/authz/resources \  -H "Authorization: Bearer $SCUTE_APP_SECRET"
Response 200json
{  "resources": [    {      "slug": "document",      "name": "Document",      "description": null,      "actions": ["delete", "edit", "read"],      "roles": [        {          "slug": "owner",          "name": "Owner",          "description": null,          "resource": "document",          "permissions": ["delete", "edit", "read"],          "granted_via": [{ "relation": "parent", "role": "owner" }]        }      ],      "relations": [{ "slug": "parent", "subject": "folder" }]    }  ]}

Get a resource#

GET/v1/apps/:app_id/authz/resources/:slugApp key

Returns one resource in the shape above.

Create a resource#

Creates the resource and one permission per action (document:read, document:edit).

POST/v1/apps/:app_id/authz/resourcesApp key
slugstringrequired
The resource type, like document.
namestringrequired
Display name.
descriptionstring
Free text.
actionsstring[]
The actions, like ["read", "edit"].
Requestbash
curl -X POST https://api.scute.io/v1/apps/$SCUTE_APP_ID/authz/resources \  -H "Authorization: Bearer $SCUTE_APP_SECRET" \  -H "Content-Type: application/json" \  -d '{ "slug": "document", "name": "Document", "actions": ["read", "edit", "delete"] }'

Returns 201 with the resource.

Update a resource#

actions replaces the list. Dropping an action deletes its permission; when a role grants it, send force: true and the grants go with it.

PATCH/v1/apps/:app_id/authz/resources/:slugApp key
namestring
Display name.
descriptionstring
Free text.
actionsstring[]
The full list of actions.
forceboolean
Drop actions that roles still grant.

Returns 200 with the resource, or 409 in_use.

Delete a resource#

DELETE/v1/apps/:app_id/authz/resources/:slugApp key
forceboolean
Query. Required when roles grant its permissions or instances of it exist. Those go too.

Returns 204, or 409 in_use.

Relations and resource roles#

A relation says what the other end of a link is ("a document's parent is a folder"). A resource role is a role held on one instance. granted_via derives it: holding role on the instance at the end of relation gives this role.

Create a relation#

POST/v1/apps/:app_id/authz/resources/:resource_slug/relationsApp key
slugstringrequired
The relation, like parent.
subjectstringrequired
The resource type at the other end, like folder.
Requestbash
curl -X POST https://api.scute.io/v1/apps/$SCUTE_APP_ID/authz/resources/document/relations \  -H "Authorization: Bearer $SCUTE_APP_SECRET" \  -H "Content-Type: application/json" \  -d '{ "slug": "parent", "subject": "folder" }'
Response 201json
{ "slug": "parent", "subject": "folder" }

Delete a relation#

DELETE/v1/apps/:app_id/authz/resources/:resource_slug/relations/:slugApp key

Takes force=true when relationships use it; they are deleted too. Returns 204, or 409 in_use.

Create a resource role#

POST/v1/apps/:app_id/authz/resources/:resource_slug/rolesApp key
slugstringrequired
The role, like editor.
namestringrequired
Display name.
descriptionstring
Free text.
permissionsarray
This resource's actions (edit) or full slugs (document:edit). An entry can be an object with permission and a when condition.
granted_viaarray
Objects with relation (a relation of this resource) and role (a role on the type at its other end).
Requestbash
curl -X POST https://api.scute.io/v1/apps/$SCUTE_APP_ID/authz/resources/document/roles \  -H "Authorization: Bearer $SCUTE_APP_SECRET" \  -H "Content-Type: application/json" \  -d '{    "slug": "editor",    "name": "Editor",    "permissions": ["read", "edit"],    "granted_via": [{ "relation": "parent", "role": "owner" }]  }'
Response 201json
{  "slug": "editor",  "name": "Editor",  "description": null,  "resource": "document",  "permissions": ["edit", "read"],  "granted_via": [{ "relation": "parent", "role": "owner" }]}

conditions is added when a grant has one.

Update a resource role#

PATCH/v1/apps/:app_id/authz/resources/:resource_slug/roles/:slugApp key

Takes name, description, permissions and granted_via. permissions and granted_via replace the sets.

Delete a resource role#

DELETE/v1/apps/:app_id/authz/resources/:resource_slug/roles/:slugApp key

Takes force=true when users hold it on instances; those assignments are deleted too. Returns 204, or 409 role_in_use.

Permissions#

List permissions#

GET/v1/apps/:app_id/authz/permissionsApp key
Response 200json
{  "permissions": [    {      "slug": "invoice:refund",      "name": "Refund invoice",      "description": null,      "enabled": true,      "resource": "invoice",      "action": "refund",      "custom": false,      "requires_verification": true,      "verification_method": null,      "verification_ttl": 300,      "requires_approval": false,      "autonomous_allowed": false,      "blocked_while_impersonating": true,      "requester_only": false    }  ]}

Create a custom permission#

A permission not tied to a resource. Resource permissions come from a resource's actions.

POST/v1/apps/:app_id/authz/permissionsApp key
slugstringrequired
Lowercase letters, digits and _ - . :.
namestringrequired
Display name.
descriptionstring
Free text.
enabledboolean
Off denies everyone with reason permission_disabled.
requires_verificationboolean
Checks answer allow_with_step_up until the user verifies.
verification_methodstring
The method the step-up must use. Without it, any method.
verification_ttlinteger
Seconds a verification counts for this permission, 1 to 86400.
requires_approvalboolean
Checks answer allow_with_approval until an access request is approved.
autonomous_allowedboolean
An agent may use it without a user.
blocked_while_impersonatingboolean
Denied while someone is signed in as the user.
requester_onlyboolean
Kept to the user who filed the request.

Returns 201 with the permission.

Update a permission#

PATCH/v1/apps/:app_id/authz/permissions/:slugApp key

Takes the create fields except slug. Resource permissions can be updated too (for example to require verification).

Delete a permission#

DELETE/v1/apps/:app_id/authz/permissions/:slugApp key

Takes force=true when roles grant it. Returns 204, or 409 with not_deletable, owned_by_resource (remove the action from its resource instead) or in_use.

Roles#

List roles#

GET/v1/apps/:app_id/authz/rolesApp key
Response 200json
{  "roles": [    {      "slug": "billing_admin",      "name": "Billing admin",      "description": null,      "is_default": false,      "deletable": true,      "permissions": ["invoice:approve", "invoice:refund"],      "conditions": { "invoice:approve": { "lt": [{ "var": "resource.amount" }, 5000] } },      "holders": 3,      "idp_groups": { "saml": ["Finance"], "scim": null }    }  ]}

holders counts active assignments. idp_groups is described on Identity provider groups.

Create a role#

POST/v1/apps/:app_id/authz/rolesApp key
slugstringrequired
The role, like billing_admin.
namestringrequired
Display name.
descriptionstring
Free text.
is_defaultboolean
Every user of the app holds a default role.
positioninteger
Sort order in lists.
permissionsarray
Permission slugs. An entry can be an object with permission and a when condition.
Requestbash
curl -X POST https://api.scute.io/v1/apps/$SCUTE_APP_ID/authz/roles \  -H "Authorization: Bearer $SCUTE_APP_SECRET" \  -H "Content-Type: application/json" \  -d '{    "slug": "billing_admin",    "name": "Billing admin",    "permissions": [      "invoice:refund",      { "permission": "invoice:approve", "when": { "lt": [{ "var": "resource.amount" }, 5000] } }    ]  }'

Returns 201 with the role. An unknown permission slug returns 422 invalid.

A condition is JSON: all, any and not combine; eq, ne, lt, lte, gt, gte, in, contains and starts_with compare two operands; exists tests that an attribute is set. An operand is a literal or { "var": "user.x" }, resource.x or context.x. A condition that reads a missing attribute never holds.

Update a role#

PATCH/v1/apps/:app_id/authz/roles/:slugApp key

Takes name, description, is_default, position and permissions. permissions replaces the set.

Delete a role#

DELETE/v1/apps/:app_id/authz/roles/:slugApp key
reassign_tostring
Query. The role its holders move to. Required when anyone holds it. A holder who already has the target keeps the longer of the two expiries.

Returns 204, or 409 with role_in_use, not_deletable or invalid_reassign.

Role assignments#

Assign a role to a user#

POST/v1/apps/:app_id/authz/users/:user_id/rolesApp key
user_idstringrequired
Path. The user's ID in the app.
rolestringrequired
The role slug.
expires_atstring
ISO 8601 time in the future. Without it the assignment does not expire. Sending it again on an existing assignment replaces the expiry.
Requestbash
curl -X POST https://api.scute.io/v1/apps/$SCUTE_APP_ID/authz/users/0193f900-aaaa-bbbb-cccc-eeeeeeeeeeee/roles \  -H "Authorization: Bearer $SCUTE_APP_SECRET" \  -H "Content-Type: application/json" \  -d '{ "role": "billing_admin", "expires_at": "2026-12-31T00:00:00Z" }'
Response 201json
{  "role": "billing_admin",  "expires_at": "2026-12-31T00:00:00.000Z",  "source": "manual",  "active": true}

A role given by SAML or SCIM returns 409 managed_by_idp: change it in the identity provider. A past expires_at returns 422 invalid.

Revoke a role from a user#

DELETE/v1/apps/:app_id/authz/users/:user_id/roles/:roleApp key

Returns 204. 404 not_found when the user does not hold it, 409 managed_by_idp for a role from the identity provider.

List a user's roles#

GET/v1/apps/:app_id/authz/users/:user_id/rolesApp key
Response 200json
{  "user_id": "0193f900-aaaa-bbbb-cccc-eeeeeeeeeeee",  "roles": [    { "role": "billing_admin", "expires_at": null, "source": "manual", "active": true }  ],  "default_roles": ["member"],  "resource_roles": [    { "role": "owner", "resource": "document:42", "expires_at": null, "active": true }  ]}

source is manual, or the identity provider (saml, scim) that gave the role.

List users with their roles#

GET/v1/apps/:app_id/authz/usersApp key
qstring
Query. Searches email, name and phone.
rolestring
Query. Keeps the holders of one role (everyone, for a default role).
pageinteger
Query. Default 1.
limitinteger
Query. Default 25, at most 200.
Response 200json
{  "default_roles": ["member"],  "users": [    {      "id": "0193f900-aaaa-bbbb-cccc-eeeeeeeeeeee",      "email": "alice@example.com",      "name": "Alice",      "phone": null,      "status": "active",      "attributes": { "tenant_id": "acme" },      "roles": [{ "role": "billing_admin", "expires_at": null, "source": "manual", "active": true }],      "resource_roles": 1    }  ],  "total": 1,  "current_page": 1,  "total_pages": 1,  "next_page": null}

attributes are what conditions read as user.*. resource_roles counts the active roles the user holds on instances.

List a role's holders#

GET/v1/apps/:app_id/authz/roles/:slug/usersApp key

Takes q, page, limit, and include_ended=true to include expired assignments. Returns role, everyone (true for a default role), and users, each with a grant object (or null for a default role held without an explicit assignment), plus the paging fields above.