Get an approval policy
Needs policies:read. A policy in another environment is reported as not found.
/api/v2/approval-policies/{policyId}AuthorizationBearer token (Anlyon API key) · headerrequiredWorkspace API key sent as Authorization: Bearer <key>.
better-auth.session_tokenAPI key · cookierequiredBrowser session used by dashboard-only operations.
policyIdstringrequiredPublic approval-policy id (apol_xxx).
X-Request-IdstringOptional caller correlation ID. Unsafe or oversized values are replaced.
A single approval policy.
successbooleanrequiredtruedataApprovalPolicyrequiredShow propertiesHide properties
idstringrequiredPublic policy id (apol_xxx).
environmentIdstring<uuid>requiredThe environment the policy governs. Policies never span environments.
namestringrequiredpriorityintegerrequiredLower runs first. Ties are broken by creation time, then by id, so the order is always deterministic.
enabledbooleanrequiredscopestringrequiredWhat the policy applies to, derived from match. Never inferred from the name.
specific_actionall_actionscustom_requestsall_requestsneedsScopeReviewbooleanrequiredTrue on a broad policy nobody has confirmed the scope of. Every policy created before explicit targeting is in this state, because the old form sent no action selector. Preserved as it was, and flagged.
matchApprovalPolicyMatchrequiredShow propertiesHide properties
kindstringrequiredanyactioncustomactionNamestring | nullrequiredagentIdstring | nullrequireduserIdstring | nullrequiredtagsstring[] | nullrequiredminAmountnumber | nullrequiredconditionsobject | nullrequiredconditionstring | nullrequiredA CEL expression (https://cel.dev) that must also hold, over input, agent.id, user.id, tags, action.name and kind. Checked against the target action's input schema when saved. An evaluation error (for example a missing field) requires approval rather than skipping the policy; guard optional fields with has().
effectstringrequiredrequire_approvalauto_approveauto_denyrequiredApprovalsintegerrequiredDistinct approvers needed (N-of-M).
decidedBystringrequiredWho decides an approval this policy requires. team: the console, Slack or a key with approvals:decide. end_user: the end user a call was made for, in your app (one decision, whatever requiredApprovals says). A call with no end user is always decided by the team.
teamend_userversionintegerrequiredBumps on each edit; recorded on approvals this policy governs.
scopeReviewedAtstring<date-time> | nullrequiredcreatedAtstring<date-time>requiredupdatedAtstring<date-time>requiredmanagedByobject | nullSet when a policy file owns this policy. Console and API edits of it are refused; change the file.
Show propertiesHide properties
filestringrequiredkeystringrequiredUnauthorized - Invalid or missing API key
successbooleanrequiredrequestIdstringrequiredCorrelation ID matching the X-Request-Id response header.
errorobjectrequiredShow propertiesHide properties
codestringmessagestringdetailsobjectfixErrorFixHow to get past this error, for a person or an agent. Present on refusals with a known next step, such as a missing scope or role, a plan or billing limit, a halted environment, or a missing secret, connected account, OAuth app or end-user header. Absent when there is no fix to give. Kept in production responses, unlike details.
Show propertiesHide properties
summarystringrequiredOne sentence that says what to do.
commandstringAn exact anlyon CLI command that fixes it. Absent when no command does.
urlstring<uri>An absolute console link where a person fixes it.
docsstring<uri>A docs page that explains it.
Authenticated credential lacks the required scope or workspace access.
successbooleanrequiredrequestIdstringrequiredCorrelation ID matching the X-Request-Id response header.
errorobjectrequiredShow propertiesHide properties
codestringmessagestringdetailsobjectfixErrorFixHow to get past this error, for a person or an agent. Present on refusals with a known next step, such as a missing scope or role, a plan or billing limit, a halted environment, or a missing secret, connected account, OAuth app or end-user header. Absent when there is no fix to give. Kept in production responses, unlike details.
Show propertiesHide properties
summarystringrequiredOne sentence that says what to do.
commandstringAn exact anlyon CLI command that fixes it. Absent when no command does.
urlstring<uri>An absolute console link where a person fixes it.
docsstring<uri>A docs page that explains it.
Not Found - Resource does not exist
successbooleanrequiredrequestIdstringrequiredCorrelation ID matching the X-Request-Id response header.
errorobjectrequiredShow propertiesHide properties
codestringmessagestringdetailsobjectfixErrorFixHow to get past this error, for a person or an agent. Present on refusals with a known next step, such as a missing scope or role, a plan or billing limit, a halted environment, or a missing secret, connected account, OAuth app or end-user header. Absent when there is no fix to give. Kept in production responses, unlike details.
Show propertiesHide properties
summarystringrequiredOne sentence that says what to do.
commandstringAn exact anlyon CLI command that fixes it. Absent when no command does.
urlstring<uri>An absolute console link where a person fixes it.
docsstring<uri>A docs page that explains it.
Too Many Requests - Rate limit exceeded. A workspace's API requests are limited per minute and per UTC clock hour by plan; Retry-After says when to try again, and an hourly refusal names the limit and when the count resets. Successful responses carry the same limits in X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset (the minute) and X-RateLimit-Limit-Hour, X-RateLimit-Remaining-Hour, X-RateLimit-Reset-Hour (the hour).
successbooleanrequiredrequestIdstringrequiredCorrelation ID matching the X-Request-Id response header.
errorobjectrequiredShow propertiesHide properties
codestringmessagestringdetailsobjectfixErrorFixHow to get past this error, for a person or an agent. Present on refusals with a known next step, such as a missing scope or role, a plan or billing limit, a halted environment, or a missing secret, connected account, OAuth app or end-user header. Absent when there is no fix to give. Kept in production responses, unlike details.
Show propertiesHide properties
summarystringrequiredOne sentence that says what to do.
commandstringAn exact anlyon CLI command that fixes it. Absent when no command does.
urlstring<uri>An absolute console link where a person fixes it.
docsstring<uri>A docs page that explains it.

