Call these from your backend with the app key or an M2M token. Each check is written to the app's decision log. The signed-in user's own checks and the gateway take the user's access token instead.
A resource is sent in one of three forms:
| Form | Meaning |
|---|---|
| "document" | The resource type. Only app-wide roles count |
| "document:42" | One instance. Roles held on it, directly or through relationships, count too |
| { "type": "document", "key": "42", "attributes": { "amount": 1200 } } | One instance with attributes for conditions. Sent attributes win over stored ones |
The action plus the resource type make the permission: edit on document is document:edit. With no resource, action is used as a custom permission slug.
Check one action#
Check#
Answers one question for one user. When the permission requires verification or approval, pass the proof in the same call.
/v1/auth/:app_id/authz/checkApp key or M2M tokencurl -X POST https://api.scute.io/v1/auth/$SCUTE_APP_ID/authz/check \ -H "Authorization: Bearer $SCUTE_APP_SECRET" \ -H "Content-Type: application/json" \ -d '{ "user_id": "0193f900-aaaa-bbbb-cccc-eeeeeeeeeeee", "action": "edit", "resource": "document:42" }'{ "decision": "allow", "allowed": true, "reason": "role_grant", "permission": "document:edit", "roles": ["editor"], "explanation": "alice@example.com can edit document 42 (Editor role)."}| Field | Meaning |
|---|---|
| decision | allow, allow_with_step_up, allow_with_approval or deny |
| allowed | true only for allow |
| reason | Why. See the table below |
| permission | The permission slug that was checked |
| roles | The roles that grant it. A resource role is written type#role |
| path | For a role held through relationships, the chain that gives it |
| conditions | The conditions that held, for a conditional grant |
| step_up | For allow_with_step_up: method, ttl, authorizes_action, and error and detail when a sent challenge was not usable |
| approval | For allow_with_approval: permission, resource, and error approval_not_usable when a sent approval was not usable |
| explanation | One sentence for logs and support |
| reason | decision |
|---|---|
| role_grant | allow: an app-wide role grants it |
| resource_role | allow: a role held on the instance grants it |
| derived_role | allow: a role on the instance, held through a relationship, grants it |
| verified | allow: the challenge sent with this call proved the step-up |
| verified_recently | allow: the user verified for this permission within its verification_ttl |
| approved | allow: the approval sent with this call was spent |
| verification_required | allow_with_step_up |
| approval_required | allow_with_approval |
| unknown_user | deny: no user with that ID in this app |
| unknown_permission | deny: the permission is not defined |
| permission_disabled | deny: the permission is turned off for everyone |
| condition_failed | deny: every grant that could apply has a condition that does not hold |
| no_role_grants_permission | deny: no role the user holds grants it |
| impersonating | deny: the permission is blocked while someone is signed in as the user |
Step up a check#
When the answer is allow_with_step_up, create a challenge for the user with purpose step_up and metadata.authorizes_action set to the permission in step_up.authorizes_action. When it is completed, repeat the check with its token:
curl -X POST https://api.scute.io/v1/auth/$SCUTE_APP_ID/authz/check \ -H "Authorization: Bearer $SCUTE_APP_SECRET" \ -H "Content-Type: application/json" \ -d '{ "user_id": "0193f900-aaaa-bbbb-cccc-eeeeeeeeeeee", "action": "refund", "resource": "invoice:881", "challenge": "ch_zN4kP2qX9wT5aB3xY9QkLm7RsT2uVw8E" }'{ "decision": "allow", "allowed": true, "reason": "verified", "permission": "invoice:refund", "roles": ["billing_admin"], "explanation": "alice@example.com can refund invoice 881 (Billing admin role), verified just now."}Check a batch#
Up to 100 checks in one call. The policy is read once and each user's roles are looked up once.
/v1/auth/:app_id/authz/check-batchApp key or M2M tokencurl -X POST https://api.scute.io/v1/auth/$SCUTE_APP_ID/authz/check-batch \ -H "Authorization: Bearer $SCUTE_APP_SECRET" \ -H "Content-Type: application/json" \ -d '{ "checks": [ { "user_id": "0193f900-aaaa-bbbb-cccc-eeeeeeeeeeee", "action": "read", "resource": "document:42" }, { "user_id": "0193f900-aaaa-bbbb-cccc-eeeeeeeeeeee", "action": "delete", "resource": "document:42" } ] }'{ "results": [ { "decision": "allow", "allowed": true, "reason": "role_grant", "permission": "document:read", "roles": ["viewer"], "explanation": "alice@example.com can read document 42 (Viewer role)." }, { "decision": "deny", "allowed": false, "reason": "no_role_grants_permission", "permission": "document:delete", "roles": [], "explanation": "alice@example.com can't delete document 42: no role they hold allows it." } ]}results is in the order of checks.
Errors#
| Status | error_code | When |
|---|---|---|
| 422 | invalid | action is missing, or checks is not a list of objects |
| 422 | batch_too_large | More than 100 checks |
| 422 | dry_run_required | agent was sent without dry_run. Agent checks here are dashboard dry runs |
| 403 | dry_run_not_allowed | dry_run: true was sent. Dry runs are for the dashboard |
| 403 | insufficient_scope | The M2M token lacks the read scope |
| 403 | app_not_in_scope | The M2M token's app is not in this app's workspace or a workspace above it |
| 404 | app_not_found | No app with that ID |
Filter a query#
Filter#
Answers "which rows of this type may the user act on" as a filter you apply to your own query, instead of checking rows one by one.
/v1/auth/:app_id/authz/filterApp key or M2M tokencurl -X POST https://api.scute.io/v1/auth/$SCUTE_APP_ID/authz/filter \ -H "Authorization: Bearer $SCUTE_APP_SECRET" \ -H "Content-Type: application/json" \ -d '{ "user_id": "0193f900-aaaa-bbbb-cccc-eeeeeeeeeeee", "action": "read", "resource_type": "document" }'{ "permission": "document:read", "filter": { "any": [ { "in": [{ "var": "resource.key" }, ["42", "43"]] }, { "lt": [{ "var": "resource.amount" }, 5000] } ] }}filter is one of:
- "all": every row. An app-wide role grants the permission without a condition.
- "none": no row. Also the answer for an unknown user, an unknown or disabled permission, or an unknown resource type.
- A condition tree over your own fields. resource.key is the row's key and resource.<field> its columns. User and context values are already filled in.
The answer can also carry step_up or approval when the permission requires them, and truncated: true when Scute stopped following relationships at its limit of 10,000 objects.
Read permissions#
List a user's permissions#
Everything the user can do in the app, and on one instance when resource is given.
/v1/auth/:app_id/authz/users/:user_id/permissionsApp key or M2M tokencurl "https://api.scute.io/v1/auth/$SCUTE_APP_ID/authz/users/0193f900-aaaa-bbbb-cccc-eeeeeeeeeeee/permissions?resource=document:42" \ -H "Authorization: Bearer $SCUTE_APP_SECRET"{ "roles": ["viewer"], "resource": "document:42", "resource_roles": ["owner"], "permissions": ["document:delete", "document:edit", "document:read", "invoice:refund"], "step_up": ["invoice:refund"], "conditional": [ { "permission": "invoice:approve", "when": ["resource.amount < 5000"] } ], "approval": [], "verified_until": { "invoice:refund": "2026-11-19T15:30:00.000Z" }, "user_id": "0193f900-aaaa-bbbb-cccc-eeeeeeeeeeee"}| Field | Meaning |
|---|---|
| roles | App roles the user holds now, default roles included |
| resource_roles | Roles held on the instance, directly or through relationships |
| permissions | Permissions granted now |
| step_up | Of those, the ones that require verification |
| approval | Of those, the ones that require approval |
| conditional | Grants whose condition depends on attributes Scute does not have yet, with the condition in words |
| verified_until | For step-up permissions the user verified recently, when that proof ends |
Returns 404 with error_code user_not_found for an unknown user.
List authorized users#
Who can do an action. With an instance, holders of a granting role on it are included.
/v1/auth/:app_id/authz/authorized-usersApp key or M2M tokencurl "https://api.scute.io/v1/auth/$SCUTE_APP_ID/authz/authorized-users?action=edit&resource=document:42" \ -H "Authorization: Bearer $SCUTE_APP_SECRET"{ "permission": "document:edit", "resource": "document:42", "everyone": false, "total": 2, "users": [ { "id": "0193f900-aaaa-bbbb-cccc-eeeeeeeeeeee", "email": "alice@example.com" }, { "id": "0193f900-1111-2222-3333-444444444444", "email": "bob@example.com" } ]}everyone is true when a default role grants the permission without a condition: every user of the app can. conditions lists the roles that grant it only under a condition. Returns 422 with error_code invalid when action is missing or limit and offset are not whole numbers.
The signed-in user's own checks#
These calls take the user's access token in X-Authorization and answer only about that user. They are off until the app turns on client_checks in policy settings, since the answers name roles and permissions. They never spend a challenge: settle step-ups on your backend.
Check as the user#
/v1/auth/:app_id/authz/me/checkAccess tokencurl -X POST https://api.scute.io/v1/auth/$SCUTE_APP_ID/authz/me/check \ -H "X-Authorization: Bearer $ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "action": "edit", "resource": "document:42" }'The response is a decision, as on check.
Check a batch as the user#
/v1/auth/:app_id/authz/me/check-batchAccess tokenTakes checks, up to 100 objects with action, resource and context. Returns results.
List the user's permissions#
/v1/auth/:app_id/authz/me/permissionsAccess tokenTakes an optional resource query parameter. Returns the same object as List a user's permissions.
| Status | error_code | When |
|---|---|---|
| 401 | authentication_required | No access token, or a token of another app |
| 403 | client_checks_disabled | The app has client_checks off |
| 422 | invalid | action is missing, or checks is not a list of objects |
| 422 | batch_too_large | More than 100 checks |
The user's own access requests (/v1/auth/:app_id/authz/me/requests and /me/reviews) are on Access requests.
Gateway enforcement#
One endpoint answers the auth subrequest of a proxy, so routes are enforced without app code. The app's route rules map a method and path to an action and resource. It is off until the app sets gateway: true in policy settings.
/v1/auth/:app_id/authz/gatewayAccess tokenThe endpoint accepts every method, and any path after /authz/gateway.
| Proxy | Configuration | Original request read from |
|---|---|---|
| Envoy ext_authz (HTTP) | path_prefix /v1/auth/<app_id>/authz/gateway | The method and the path after the prefix |
| Traefik ForwardAuth | address https://api.scute.io/v1/auth/<app_id>/authz/gateway | X-Forwarded-Method, X-Forwarded-Uri |
| NGINX auth_request | Proxy to https://api.scute.io/v1/auth/<app_id>/authz/gateway | X-Original-Method, X-Original-URI |
The user is the Scute session in Authorization: Bearer, X-Authorization, or the sc-access-token cookie.
| Status | Meaning |
|---|---|
| 200 | Allowed. Headers X-Scute-User-Id, X-Scute-Decision and X-Scute-Permission are set for the upstream |
| 401 | No valid session of this app (error_code authentication_required) |
| 403 | Not allowed. The body is the decision. Step-up and approval answers are refused too, since a proxy can't complete them |
| 403 | no_route: no rule matches. Returns 200 instead when the app sets gateway_unmatched to allow |
| 403 | gateway_disabled: the gateway is off for this app |
| 400 | invalid_path: the path has an encoded /, a . or .. segment, or invalid encoding |
Rules are matched in order and the first match wins.