These endpoints work on the app's policy as a whole. They take the app key (or a workspace key above the app). Writes are kept in the version history as one row each.
Compiled policy#
Get the compiled policy#
The policy as the engine uses it: permissions with their flags, roles with their grants and conditions, resources with roles, relations and derivations, and route rules.
/v1/apps/:app_id/authz/policyApp keycurl https://api.scute.io/v1/apps/$SCUTE_APP_ID/authz/policy \ -H "Authorization: Bearer $SCUTE_APP_SECRET"{ "app_id": "0193f8aa-2222-7333-8444-555555555555", "version": 14, "permissions": { "document:read": { "id": "0193f8ab-0000-7000-8000-000000000001", "enabled": true, "resource": "document", "action": "read", "requires_verification": false, "verification_method": null, "verification_ttl": null, "requires_approval": false, "autonomous_allowed": false } }, "roles": { "viewer": { "id": "0193f8ab-0000-7000-8000-000000000002", "name": "Viewer", "default": true, "permissions": ["document:read"], "conditions": {} } }, "resources": { "document": { "id": "0193f8ab-0000-7000-8000-000000000003", "roles": {}, "relations": {}, "derivations": [] } }, "routes": []}Get a signed snapshot#
The compiled policy as a signed JWS, for decisions made locally by an SDK or an edge function. It is signed with the app's keys; verify it with the JWKS at the jwks path. The token is valid for one hour.
/v1/apps/:app_id/authz/snapshotApp keyThe response carries an ETag of the policy version. Send it back in If-None-Match and an unchanged policy answers 304.
curl https://api.scute.io/v1/apps/$SCUTE_APP_ID/authz/snapshot \ -H "Authorization: Bearer $SCUTE_APP_SECRET"{ "version": 14, "token": "eyJhbGciOiJSUzI1NiIsImtpZCI6...", "expires_at": "2026-11-19T15:30:00Z", "jwks": "/v1/auth/app_3mxZRrzWxhPZ08dXvqq6/jwks"}Returns 409 with error_code keys_missing when the app has no signing keys yet.
Route rules#
Route rules map a request to an action and resource for gateway enforcement.
List route rules#
/v1/apps/:app_id/authz/routesApp key{ "routes": [ { "method": "GET", "path": "/documents/:id", "action": "read", "resource_type": "document", "key_param": "id" }, { "method": "*", "path": "/admin/*", "action": "admin.access" } ]}Replace route rules#
Replaces the whole list. The order is the match order: the first match wins. Needs a plan with the authorization feature.
/v1/apps/:app_id/authz/routesApp keycurl -X PUT https://api.scute.io/v1/apps/$SCUTE_APP_ID/authz/routes \ -H "Authorization: Bearer $SCUTE_APP_SECRET" \ -H "Content-Type: application/json" \ -d '{ "routes": [ { "method": "GET", "path": "/documents/:id", "action": "read", "resource_type": "document", "key_param": "id" } ] }'Returns 200 with routes, or 422 invalid.
Policy as code#
Export the policy document#
The policy as a document you can keep in git.
/v1/apps/:app_id/authz/policy/documentApp key{ "scute_policy": 1, "resources": { "document": { "name": "Document", "actions": ["edit", "read"], "relations": { "parent": "folder" }, "roles": { "editor": { "name": "Editor", "permissions": ["edit", "read"], "granted_via": [{ "relation": "parent", "role": "owner" }] } } } }, "permissions": { "invoice:refund": { "requires_verification": true, "verification_ttl": 300 }, "billing.export": { "custom": true, "name": "Export billing" } }, "roles": { "viewer": { "name": "Viewer", "default": true, "permissions": ["document:read"] } }, "routes": []}permissions lists only custom permissions and settings that differ from the defaults.
Import a policy document#
Applies a document to the app. It is a dry run by default: the answer lists the changes without making them.
/v1/apps/:app_id/authz/policy/importApp keycurl -X POST https://api.scute.io/v1/apps/$SCUTE_APP_ID/authz/policy/import \ -H "Authorization: Bearer $SCUTE_APP_SECRET" \ -H "Content-Type: application/json" \ -d @policy.json{ "dry_run": true, "prune": false, "changes": [ { "op": "create", "kind": "role", "key": "auditor" } ], "applied": false}An invalid document returns 422 with error_code invalid_document. Needs a plan with the authorization feature.
Promote from another app#
Copies another app's policy into this one, for example from a development app to production. The key must reach both apps. Same dry_run and prune as import, and the same response.
/v1/apps/:app_id/authz/policy/promoteApp keyReturns 404 app_not_found when the source app does not exist or the key can't reach it, and 422 invalid when it is the same app.
Versions#
List versions#
Newest first, without the documents.
/v1/apps/:app_id/authz/policy/versionsApp key{ "current": 14, "versions": [ { "version": 14, "from_version": 13, "created_at": "2026-11-18T10:02:11.000Z", "updated_at": "2026-11-18T10:02:11.000Z", "actor": "alice@example.com", "changes": [{ "op": "update", "kind": "role", "key": "editor" }], "changes_total": 1 } ], "next": 13}A row covers from_version to version: one write can move the version more than once.
Get a version#
/v1/apps/:app_id/authz/policy/versions/:versionApp keyReturns the version's fields plus document, the policy document at that version. 404 version_not_found when no document is kept for it.
Compare versions#
/v1/apps/:app_id/authz/policy/versions/diffApp key{ "from": 12, "to": 14, "changes": [ { "op": "create", "kind": "role", "key": "auditor" } ]}Settings#
Get settings#
/v1/apps/:app_id/authz/settingsApp key{ "log_allow_rate": 0.1, "log_retention_days": 30, "client_checks": false, "access_requests": false, "gateway": false, "gateway_unmatched": "deny", "impersonation": false, "impersonation_max_minutes": 60, "impersonation_protected_roles": [], "session_trust": false, "session_trust_minutes": 15, "export_event": "app.authz.decisions"}Update settings#
Send only the fields to change.
/v1/apps/:app_id/authz/settingsApp keycurl -X PATCH https://api.scute.io/v1/apps/$SCUTE_APP_ID/authz/settings \ -H "Authorization: Bearer $SCUTE_APP_SECRET" \ -H "Content-Type: application/json" \ -d '{ "client_checks": true, "access_requests": true }'Returns 200 with all settings. A value out of range returns 422 invalid.
Decision log#
List decisions#
End-user decisions, newest first.
/v1/apps/:app_id/authz/decisionsApp keycurl "https://api.scute.io/v1/apps/$SCUTE_APP_ID/authz/decisions?decision=deny&limit=20" \ -H "Authorization: Bearer $SCUTE_APP_SECRET"{ "decisions": [ { "id": "0193f9a0-1111-7222-8333-444444444444", "at": "2026-11-19T14:02:11.120Z", "kind": "end_user", "user_id": "0193f900-aaaa-bbbb-cccc-eeeeeeeeeeee", "permission": "document:delete", "resource": "document:42", "decision": "deny", "reason": "no_role_grants_permission", "roles": [], "policy_version": 14, "latency_ms": 1.204, "explanation": "alice@example.com can't delete document 42: no role they hold allows it.", "person": { "id": "0193f900-aaaa-bbbb-cccc-eeeeeeeeeeee", "email": "alice@example.com" }, "seq": 5821, "row_hash": "9f2c..." } ], "next": "0193f9a0-1111-7222-8333-444444444444"}Rows are hash-chained: seq and row_hash let you check the log was not changed.
Verify the decision log#
Checks that the app's decision log chain is intact. Keep the returned head somewhere else to compare later.
/v1/apps/:app_id/authz/decisions/verifyApp key{ "ok": true, "chain": "app:0193f8aa-2222-7333-8444-555555555555", "checked": 5821, "head": { "seq": 5821, "row_hash": "9f2c...", "at": "2026-11-19T14:02:11.120000Z" }}A broken chain answers ok: false with first_break: id, seq, at and reason (changed or missing_or_moved).
Suggestions and backtests#
Nothing here changes the policy.
Get suggestions#
Proposed changes drawn from the decision log, such as a grant nobody used. Each carries a change you can backtest.
/v1/apps/:app_id/authz/policy/suggestionsApp key{ "suggestions": [ { "kind": "unused_grant", "title": "Billing admin can invoice:approve, and nobody holding it did in 30 days", "evidence": { "role": "billing_admin", "permission": "invoice:approve", "holders": 3 }, "change": [{ "op": "revoke", "role": "billing_admin", "permission": "invoice:approve" }] } ]}Backtest a change#
Replays recent decisions under the current policy and under the changed one, and reports the ones whose outcome differs. Roles are today's. Request context is not logged, so conditions that read it are judged without it.
/v1/apps/:app_id/authz/policy/backtestApp keycurl -X POST https://api.scute.io/v1/apps/$SCUTE_APP_ID/authz/policy/backtest \ -H "Authorization: Bearer $SCUTE_APP_SECRET" \ -H "Content-Type: application/json" \ -d '{ "change": [{ "op": "set", "permission": "invoice:refund", "requires_verification": true }] }'The answer has days, checked, changed, summary (counts per before -> after, where an outcome is allow, verify, approve or deny), people_affected, up to 50 examples and allow_sample_rate. An invalid change returns 422 invalid.