Skip to main content
POST/pending-approvals/bulk

Decide Changes in Bulk

Approves or rejects a batch of pending changes in a single atomic attestation using a batch criterion predicate (by maker session, by criteria predicate, by time window, or by table scope).

Creates one approval attestation record (aat_<base62>) and transitions all matched pending change records (pch_<base62>) in the same transaction.

The operation is all-or-nothing: if the caller lacks authority over any matched change, the entire batch is rejected with K9O_BULK_APPROVAL_AUTHORITY_INSUFFICIENT (403) before any state transition.

Requires PROJECT_ADMIN or APPROVAL_VIEWER bulk-approval privilege.

A reason field is required when bulk-rejecting.

Parameters
projectSlug *path

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

It is unique within the org.

Request body
action *"approve" | "reject"

Whether to approve or reject every matching change.

criteria *object

A JSON predicate selecting which waiting changes to decide, in the same grammar as approval policies: {"<operator>": [arg, ...]}.

Paths such as change.table, change.operation, change.row.<field> and maker.id read each change.

A predicate the platform can't evaluate is refused with 400 K9O_INVALID_FIELD_VALUE.

reasonany

Why you decided.

Required to reject.

Surrounding whitespace is trimmed, and an empty string counts as no reason.

One of: string
or: null
Responses
HTTPK9O CodeDescription
200Success
401K9O_SESSION_EXPIREDThe caller's session token is expired or invalid; re-authenticate to continue.
403K9O_BULK_APPROVAL_AUTHORITY_INSUFFICIENTThe caller lacks authority over one or more of the pending changes matched by the bulk criteria; the entire batch is rejected with no partial application.
403K9O_RBAC_DENYA session is required to decide pending changes: a personal access token alone is refused with `context.reason` `session_required`, and a service, workload or extension token with `human_only`.
Response body (200)
data *object

The outcome of the bulk decision.

attestationId *string

An id for this batch (apr_...).

Each decided change's audit event names it.

action *"approve" | "reject"

The action that was applied.

affectedCount *integer

How many changes were decided: the length of affectedIds.

affectedIds *string[]

The ids of the changes that were decided (apr_...).

failed *object[]

The matching changes that could not be decided, each with its error.

Every matching change is in affectedIds or here.

id *string

The id of the change that was not decided (apr_...).

code *string

The error code that stopped it.

reason *string

A message explaining the error.

reason *any

The reason recorded on each decision.

Null when none was given.

One of: string
or: null
meta *any
TypeScript
// const k9o = new K9o({ orgSlug: 'playground', projectSlug: 'storefront', apiKey: 'k9o_…' })
const { data } = await k9o.approvals.bulk({})

Showing example in TypeScript

Request example
{
  "action": "approve",
  "reason": "string"
}
Response example (200)
{
  "data": {
    "attestationId": "string",
    "action": "approve",
    "affectedCount": 0,
    "affectedIds": [
      "string"
    ],
    "failed": [
      {
        "id": "string",
        "code": "string",
        "reason": "string"
      }
    ],
    "reason": "string"
  }
}

More in Policy & Approvals