API reference

Authorization

The authorization model for an app's end users, and which endpoint to call for each job.

Every app has its own authorization policy for its users. Scute denies by default: a user can do something only when a role they hold grants the permission for it. Nothing from another app ever applies.

Model#

PartWhat it isExample
ResourceA type of object in your app, with a list of actionsdocument with read, edit
Permission<resource>:<action>, created from a resource's actions, or a custom slugdocument:edit, billing.export
RoleA set of permissions. A default role is held by every user of the appeditor
Role assignmentA user holds a role, optionally until expires_atalice holds editor until 2026-12-31
InstanceOne object of a resource type, written type:keydocument:42
Resource roleA role held on one instancedocument#owner
RelationA link between two resource typesa document has a parent that is a folder
RelationshipA relation between two instancesfolder:7 is the parent of document:42

A role grant can carry a condition on user.*, resource.* and context.* attributes. The grant counts only when the condition holds.

A permission can also require proof:

  • requires_verification: the check answers allow_with_step_up until the user completes a challenge. Send the completed challenge's token as challenge on the next check.
  • requires_approval: the check answers allow_with_approval until a reviewer approves an access request. Send the request id as approval.

Decisions#

Every check returns one of four values in decision:

decisionallowedMeaning
allowtrueGo ahead
allow_with_step_upfalseAllowed after the user verifies. step_up says how
allow_with_approvalfalseAllowed after a reviewer approves. approval says what to request
denyfalseNot allowed. reason and explanation say why

Test allowed, not decision !== "deny": an answer that still needs a step-up or an approval is not an allow.

Which call to use#

JobEndpointPage
Ask whether a user may do one thingPOST /v1/auth/:app_id/authz/checkChecks
Ask up to 100 questions at oncePOST /v1/auth/:app_id/authz/check-batchChecks
Filter a list query to the rows a user may seePOST /v1/auth/:app_id/authz/filterChecks
List everything a user may doGET /v1/auth/:app_id/authz/users/:user_id/permissionsChecks
Enforce at a proxy (Envoy, Traefik, NGINX)/v1/auth/:app_id/authz/gatewayChecks
Define resources, permissions and roles/v1/apps/:app_id/authz/...Roles and permissions
Export, import, version and audit the policy/v1/apps/:app_id/authz/policy/...Policy
Sync your objects and how they relate/v1/apps/:app_id/authz/instances, relationshipsObjects and relationships
File and decide access requests/v1/apps/:app_id/authz/requestsAccess requests
Embed admin screens in your appPOST /v1/apps/:app_id/authz/element-tokensElement tokens
Give roles from SAML or SCIM groups/v1/apps/:app_id/authz/idpIdentity provider groups

Credentials#

CredentialHeaderEndpoints
App keyAuthorization: Bearer scapp_...All server endpoints. A workspace key of the app's workspace, or of a workspace above it, works too
M2M tokenX-Authorization: Bearer scm2m_...Checks, filter, permissions, authorized users, objects and relationships. Reads take the token's read scope, writes take write. The check, check-batch and filter calls take read
Access tokenX-Authorization: Bearer <access token>The signed-in user's own /authz/me/* calls and the gateway

A token without the scope a call needs gets 403 with error_code insufficient_scope. See Authentication and Errors.

Plan

Writes that define policy (resources, relations, resource roles, permissions, roles, routes, import and promote) need a plan with the authorization feature. Without it they return 422 with error_code feature_not_available and feature rbac. Reads, deletes, settings and role assignments stay available.