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

Update an approval policy

Needs policies:write. Omitted fields are unchanged; an explicit null clears a nullable matcher. Enabling or disabling a policy is a patch of enabled. Bumps the version. Decisions already recorded on invocations keep the explanation they were made with.

PATCH/api/v2/approval-policies/{policyId}
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.

Path parameters
policyIdstringrequired

Public approval-policy id (apol_xxx).

Header parameters
X-Request-Idstring

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

max length 128
Request body
requiredapplication/json
namestring
min length 1 · max length 80
priorityinteger
min 0 · max 10000
enabledboolean
matchKindstring
Allowed:anyactioncustom
matchActionNamestring | null
min length 1 · max length 200
matchAgentIdstring | null
max length 60
matchUserIdstring | null
max length 200
matchTagsstring[] | null
max items 50
minAmountnumber | null
min 0
conditionsobject | null
conditionstring | null

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

min length 1 · max length 2000
effectstring
Allowed:require_approvalauto_approveauto_deny
requiredApprovalsinteger
min 1 · max 20
decidedBystring

Who decides: the team, or the end user a call was made for.

Allowed:teamend_user
acknowledgeBroadScopeboolean
Responses
200

A single approval policy.

successbooleanrequired
Allowed:true
dataApprovalPolicyrequired
Show properties
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
202

Accepted, not applied: the change loosens a guardrail, so a workspace admin has to approve it. Location is the request to poll.

successbooleanrequired
Allowed:true
signOffRequiredbooleanrequired
Allowed:true
dataSignOffRequestrequired

A governance change that loosens a guardrail, asked for by an API key, a CLI login or an MCP session, waiting for a workspace admin. Give signOffUrl to a person; poll pollUrl.

Show properties
objectstringrequired
Allowed:sign_off_request
idstringrequired
statusstringrequired

pending until a workspace admin decides. applied: approved and in effect. rejected, expired (after 24 hours), cancelled (withdrawn by the credential) and failed (approved but could not be applied, see error): nothing changed.

Allowed:pendingappliedrejectedexpiredcancelledfailed
operationstringrequired
Allowed:policy.createpolicy.updatepolicy.deletepolicy_file.applyimpact_limit.updateimpact_limit.archivebudget.putbudget.deleteenvironment.resumeaction.createaction.updateaction.importsecret.putsecret_store.createsecret_store.updatesecret_store_settings.updateoauth_app.put
environmentIdstring<uuid>required
resourceobject | nullrequired
Show properties
typestringrequired
idstringrequired
namestring
summarystringrequired
changesSignOffChange[]required
Show properties
Array of SignOffChange
fieldstringrequired
fromany | nullrequired

The value before. Never a secret value.

toany | nullrequired

The value after. Never a secret value.

directionstringrequired
Allowed:tighteninglooseningneutral
reasonstringrequired
diffstringrequired

The changes as plain text

signOffUrlstring<uri>required

The console page where a workspace admin approves or rejects it. Give this to a person.

pollUrlstringrequired
pollAfterSecondsintegerrequired
requestedByobjectrequired
Show properties
typestringrequired
Allowed:api_keyoauth_clientsystem
idstring | nullrequired
onBehalfOfstring | null

For a CLI login or an MCP session

createdAtstring<date-time>required
expiresAtstring<date-time>required
decidedAtstring<date-time> | nullrequired
decidedByobject | nullrequired
Show properties
typestringrequired
Allowed:user
idstringrequired
viastringrequired
Allowed:consoleemail_link
decisionNotestring | nullrequired
resultany | nullrequired

When applied, what the original request would have returned: the limit, budget, policy or action as it now is.

errorobject | nullrequired
Show properties
codestringrequired
messagestringrequired
400

Bad Request - Invalid input data

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.

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.

404

Not Found - Resource does not exist

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.

409

The request conflicts with current resource state or a concurrent decision.

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
Bodyapplication/json
Request
curl -X PATCH 'https://api.anlyon.com/api/v2/approval-policies/string' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "name": "string",
  "priority": 0,
  "enabled": true,
  "matchKind": "any",
  "matchActionName": "string",
  "matchAgentId": "string",
  "matchUserId": "string",
  "matchTags": [
    "string"
  ],
  "minAmount": 0,
  "conditions": {},
  "condition": "string",
  "effect": "require_approval",
  "requiredApprovals": 1,
  "decidedBy": "team",
  "acknowledgeBroadScope": true
}'
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?