Skip to main content
GET/approval-policies

List Approval Policies

Lists the project's approval policies (apo_...), oldest first.

Each policy applies to one collection and one write operation, and carries a predicate and an action: auto_approve lets a matching write skip review, queue sends it for approval.

When a write needs review, the matching policies are checked oldest first and the first match decides.

Any member with read access to the project can list them.

The list isn't paginated.

Parameters
projectSlug *path

The project's slug: the path segment after @.

It is unique within the org.

Responses
HTTPK9O CodeDescription
200Success
401K9O_SESSION_EXPIREDThe caller's session token is expired or invalid; re-authenticate to continue.
403K9O_ACCESS_DENIEDThe caller does not hold the minimum required role to list approval policies for this project.
Response body (200)
data *object[]

The project's approval policies, oldest first.

id *string

The policy id (apo_...).

collection *string

The collection whose writes the policy applies to.

operation *"insert" | "update" | "delete"

The kind of write the policy applies to.

predicate *object

The condition, as a JSON predicate: {"<operator>": [arg, ...]}, nested as deep as you need.

Operators: eq, neq, gt, gte, lt, lte, in, contains, and, or, not.

A string that starts with maker. or change. reads a value from the write being checked:

  • maker.id, maker.account_type, maker.roles, maker.groups
  • change.table, change.operation, change.row.<field>, change.fields_modified, change.magnitude

Any other value is a literal.

action *"auto_approve" | "queue"

What happens to a matching write: auto_approve applies it with no checker, queue holds it for a checker.

Policies for the same collection and operation are tried oldest first, and the first whose predicate matches decides.

authoredBy *string

The id of the user who created the policy (usr_...).

createdAt *string <date-time>

When the policy was created.

meta *any
TypeScript
// const k9o = new K9o({ orgSlug: 'playground', projectSlug: 'storefront', apiKey: 'k9o_…' })
const { data } = await k9o.approvalPolicies.list()

Showing example in TypeScript

Response example (200)
{
  "data": [
    {
      "id": "string",
      "collection": "string",
      "operation": "insert",
      "action": "auto_approve",
      "authoredBy": "string",
      "createdAt": "string"
    }
  ]
}

More in Policy & Approvals