# Decide Changes in Bulk

`POST /pending-approvals/bulk` · Core · Policy & Approvals

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

| Name | In | Required | Description |
|---|---|---|---|
| `projectSlug` | path | yes | The project's slug: the path segment after `@`. It is unique within the org. Example: `"storefront"`. |

## Request body

| Field | Type | Required | Description |
|---|---|---|---|
| `action` | enum ("approve", "reject") | yes | Whether to approve or reject every matching change. |
| `criteria` | object | yes | 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`. |
| `reason` | object | no | Why you decided. Required to reject. Surrounding whitespace is trimmed, and an empty string counts as no reason. |
| _one of_ | | |  |
| _or_ | | |  |

## Responses

- **200**: Success

| Field | Type | Required | Description |
|---|---|---|---|
| `data` | object | yes | The outcome of the bulk decision. |
| `data.attestationId` | string | yes | An id for this batch (`apr_...`). Each decided change's audit event names it. |
| `data.action` | enum ("approve", "reject") | yes | The action that was applied. |
| `data.affectedCount` | integer | yes | How many changes were decided: the length of `affectedIds`. |
| `data.affectedIds` | array of string | yes | The ids of the changes that were decided (`apr_...`). |
| `data.failed` | array of object | yes | The matching changes that could not be decided, each with its error. Every matching change is in `affectedIds` or here. |
| `data.failed.[]id` | string | yes | The id of the change that was not decided (`apr_...`). |
| `data.failed.[]code` | string | yes | The error code that stopped it. |
| `data.failed.[]reason` | string | yes | A message explaining the error. |
| `data.reason` | object | yes | The reason recorded on each decision. Null when none was given. |
| _one of_ | | |  |
| _or_ | | |  |
| `meta` | object | yes |  |


## Errors

| HTTP | Code | When |
|---|---|---|
| 401 | `K9O_SESSION_EXPIRED` | The caller's session token is expired or invalid; re-authenticate to continue. |
| 403 | `K9O_BULK_APPROVAL_AUTHORITY_INSUFFICIENT` | The 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. |
| 403 | `K9O_RBAC_DENY` | A 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`. |

## Code samples

### cURL

```bash
curl -X POST 'https://<org>.api-<region>.k9o.io/@storefront/pending-approvals/bulk' \
  -H 'Authorization: Bearer $K9O_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{}'
```

### fetch

```javascript
const res = await fetch('https://<org>.api-<region>.k9o.io/@storefront/pending-approvals/bulk', {
  method: 'POST',
  headers: {
    'Authorization': `Bearer ${process.env.K9O_TOKEN}`,
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({}),
});
const { data, meta } = await res.json();
```

### k9o CLI

```bash
k9o approvals bulk --action approve|reject --criteria '<json>'
```

### @k9o/core

```typescript
// const k9o = new K9o({ orgSlug: 'playground', projectSlug: 'storefront', apiKey: 'k9o_…' })
const { data } = await k9o.approvals.bulk({})
```

### k9o

```python
# k9o = create_client(org_slug="playground", project_slug="storefront", api_key="k9o_…")
response = k9o.approvals.bulk({})
```

### sdk-go

```go
// ctx := context.Background()
// client, _ := k9o.NewClient(k9o.ClientOpts{OrgSlug: "playground", ProjectSlug: "storefront", APIKey: "k9o_…"})
data, _, kerr := client.Approvals.Bulk(ctx, map[string]any{})
```

### k9o

```rust
// let k9o = Client::new(ClientOpts { org_slug: "playground".into(), project_slug: "storefront".into(), api_key: "k9o_…".into() })?;
let resp = k9o.approvals.bulk(json!({})).await?
```

### dev.k9o:core

```java
// K9o k9o = K9o.createClient(K9o.Opts.builder().orgSlug("playground").projectSlug("storefront").apiKey("k9o_…").build());
var response = k9o.approvals().bulk(Map.of())
```

### K9o.Core

```c#
// var k9o = K9oClient.Create(new K9oOptions { OrgSlug = "playground", ProjectSlug = "storefront", ApiKey = "k9o_…" });
var response = await k9o.Approvals.BulkAsync(new Dictionary<string, object> {  })
```

### k9o

```ruby
# k9o = K9o.create_client(org_slug: "playground", project_slug: "storefront", api_key: "k9o_…")
response = k9o.approvals.bulk({  })
```

### k9o/sdk

```php
// $k9o = K9oClient::create(['org_slug' => 'playground', 'project_slug' => 'storefront', 'api_key' => 'k9o_…']);
$response = $k9o->approvals->bulk([])
```


Canonical page: https://docs.kilimanjaro.dev/api-playground/core/decide-changes-in-bulk
