Skip to content
Anlyon
Esc
↑↓navigate↵open⌘Jpreview

List approval policies

Policies in the credential’s own environment, in evaluation order. Needs policies:read, or a console session. With ?actionName= only the policies that could govern that action are returned: the ones naming it plus the broad ones that also catch it. A credential is bound to one environment; an environmentId query that disagrees with it is refused.

GET/api/v2/approval-policies
Authorization
AuthorizationBearer token (Anlyon API key) · headerrequired

Workspace API key sent as Authorization: Bearer <key>.

or
better-auth.session_tokenAPI key · cookierequired

Browser session used by dashboard-only operations.

Query parameters
actionNamestring
max length 200
Header parameters
X-Request-Idstring

Optional caller correlation ID. Unsafe or oversized values are replaced.

max length 128
Responses
200

Approval policies in the workspace.

successbooleanrequired
Allowed:true
dataApprovalPolicy[]required
Show properties
Array of ApprovalPolicy
idstringrequired

Public policy id (apol_xxx).

environmentIdstring<uuid>required

The environment the policy governs. Policies never span environments.

namestringrequired
priorityintegerrequired

Lower runs first. Ties are broken by creation time, then by id, so the order is always deterministic.

enabledbooleanrequired
scopestringrequired

What the policy applies to, derived from match. Never inferred from the name.

Allowed:specific_actionall_actionscustom_requestsall_requests
needsScopeReviewbooleanrequired

True 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.

matchApprovalPolicyMatchrequired
Show properties
kindstringrequired
Allowed:anyactioncustom
actionNamestring | nullrequired
agentIdstring | nullrequired
userIdstring | nullrequired
tagsstring[] | nullrequired
minAmountnumber | nullrequired
conditionsobject | nullrequired
conditionstring | nullrequired

A 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().

effectstringrequired
Allowed:require_approvalauto_approveauto_deny
requiredApprovalsintegerrequired

Distinct approvers needed (N-of-M).

decidedBystringrequired

Who 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.

Allowed:teamend_user
versionintegerrequired

Bumps on each edit; recorded on approvals this policy governs.

scopeReviewedAtstring<date-time> | nullrequired
createdAtstring<date-time>required
updatedAtstring<date-time>required
managedByobject | null

Set when a policy file owns this policy. Console and API edits of it are refused; change the file.

Show properties
filestringrequired
keystringrequired
401

Unauthorized - Invalid or missing API key

successbooleanrequired
requestIdstringrequired

Correlation ID matching the X-Request-Id response header.

errorobjectrequired
Show properties
codestring
messagestring
detailsobject
fixErrorFix

How 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 properties
summarystringrequired

One sentence that says what to do.

commandstring

An 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.

403

Authenticated credential lacks the required scope or workspace access.

successbooleanrequired
requestIdstringrequired

Correlation ID matching the X-Request-Id response header.

errorobjectrequired
Show properties
codestring
messagestring
detailsobject
fixErrorFix

How 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 properties
summarystringrequired

One sentence that says what to do.

commandstring

An 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.

429

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).

successbooleanrequired
requestIdstringrequired

Correlation ID matching the X-Request-Id response header.

errorobjectrequired
Show properties
codestring
messagestring
detailsobject
fixErrorFix

How 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 properties
summarystringrequired

One sentence that says what to do.

commandstring

An 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.

Try it
Server
Authorization
Parameters
Request
curl -X GET 'https://api.anlyon.com/api/v2/approval-policies' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Accept: application/json'
Response
{
  "success": true,
  "data": [
    {
      "id": "string",
      "environmentId": "19f5cc2e-7657-437a-9268-83cd3d563563",
      "name": "string",
      "priority": 0,
      "enabled": true,
      "scope": "specific_action",
      "needsScopeReview": true,
      "match": {
        "kind": "any",
        "actionName": "string",
        "agentId": "string",
        "userId": "string",
        "tags": [
          "string"
        ],
        "minAmount": 0,
        "conditions": {},
        "condition": "string"
      },
      "effect": "require_approval",
      "requiredApprovals": 0,
      "decidedBy": "team",
      "version": 0,
      "scopeReviewedAt": "2019-08-24T14:15:22Z",
      "createdAt": "2019-08-24T14:15:22Z",
      "updatedAt": "2019-08-24T14:15:22Z",
      "managedBy": {
        "file": "string",
        "key": "string"
      }
    }
  ]
}

Was this page helpful?