# Automate approvals

Stop asking people for the approvals they always give. An auto_approve clause on an approval rule approves matching requests by a rule you can see, within a limit, with spot checks, pauses itself when the pattern breaks, and can be found for you from your own approvals.

*Available on Pro, Growth and Enterprise.*

Use an `auto_approve` clause to stop asking for the approvals people always give. When Dana approves every small Northside invoice forty times a month, a clause on that rule approves them for her, within a weekly limit, with one in twenty still sent to her as a spot check. Every automatic approval traces to the clause a person turned on.

A clause never applies where a person is always required, and it pauses itself when someone denies a request it would have covered.

**Before you begin:** have an approval rule that people answer today (see [step-up approval](https://provenanceauth.com/docs/mandate/guides/step-up-approval.md)). Export the account key.

```bash
export PROVENANCE_API=https://sandbox-api.provenanceauth.com
export PROVENANCE_KEY=prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5
```

1. **A rule asks for approval**: require: { approval: true }
2. **A clause holds**: its conditions, its limit, no spot check, no guard
3. **Approved by the rule**: decided_via: rule, on the receipt and the ledger

## 1. Put the payees in a list

"Always approve small invoices from these payees" works best with a list, so adding a payee later is one list edit, not a policy change.

**curl**

```bash
curl -s -X PATCH $PROVENANCE_API/v1/account/policies/lists/auto_payees \
  -H "Authorization: Bearer $PROVENANCE_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "kind": "allow", "entries": ["Northside"] }'
```

**Node**

```ts
const list = await fetch(`${process.env.PROVENANCE_API}/v1/account/policies/lists/auto_payees`, {
  method: "PATCH",
  headers: { Authorization: `Bearer ${process.env.PROVENANCE_KEY}`, "Content-Type": "application/json" },
  body: JSON.stringify({ kind: "allow", entries: ["Northside"] }),
}).then((r) => r.json());
```

**Python**

```python
list_ = httpx.patch(f"{api}/v1/account/policies/lists/auto_payees", headers={"Authorization": f"Bearer {key}"}, json={"kind": "allow", "entries": ["Northside"]}).json()
```

```json
{ "id": "01M6AB4N7C3QK2W8R5T1Y6H9DZ", "object": "policy_list", "name": "auto_payees", "kind": "allow", "count": 1, "updated_at": "2026-10-31T15:00:00.000Z" }
```

## 2. Add a clause to the rule

Put `auto_approve` on the rule's `require`, beside `approval: true`. Each clause has its own conditions, all of which must hold.

**curl**

```bash
curl -s -X PUT $PROVENANCE_API/v1/mandate/policies \
  -H "Authorization: Bearer $PROVENANCE_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "note": "automate Northside invoices",
    "document": { "rules": [{
      "id": "invoices",
      "when": [{ "fact": "action_type", "op": "eq", "value": "pay_invoice" }],
      "require": {
        "approval": true,
        "auto_approve": [{
          "id": "northside-small",
          "label": "Northside invoices under 500",
          "when": [
            { "fact": "counterparty", "op": "in_list", "value": "auto_payees" },
            { "fact": "transaction_amount", "op": "lte", "value": 500 }
          ],
          "limit": { "window": "week", "max_amount": 2000 },
          "sample_rate": 20
        }]
      }
    }] }
  }'
```

**Node**

```ts
const clause = {
  id: "northside-small",
  label: "Northside invoices under 500",
  when: [
    { fact: "counterparty", op: "in_list", value: "auto_payees" },
    { fact: "transaction_amount", op: "lte", value: 500 },
  ],
  limit: { window: "week", max_amount: 2000 },
  sample_rate: 20,
};
const version = await fetch(`${process.env.PROVENANCE_API}/v1/mandate/policies`, {
  method: "PUT",
  headers: { Authorization: `Bearer ${process.env.PROVENANCE_KEY}`, "Content-Type": "application/json" },
  body: JSON.stringify({
    note: "automate Northside invoices",
    document: { rules: [{ id: "invoices", when: [{ fact: "action_type", op: "eq", value: "pay_invoice" }], require: { approval: true, auto_approve: [clause] } }] },
  }),
}).then((r) => r.json());
```

**Python**

```python
clause = {
    "id": "northside-small",
    "label": "Northside invoices under 500",
    "when": [
        {"fact": "counterparty", "op": "in_list", "value": "auto_payees"},
        {"fact": "transaction_amount", "op": "lte", "value": 500},
    ],
    "limit": {"window": "week", "max_amount": 2000},
    "sample_rate": 20,
}
version = httpx.put(f"{api}/v1/mandate/policies", headers={"Authorization": f"Bearer {key}"}, json={
    "note": "automate Northside invoices",
    "document": {"rules": [{"id": "invoices", "when": [{"fact": "action_type", "op": "eq", "value": "pay_invoice"}], "require": {"approval": True, "auto_approve": [clause]}}]},
}).json()
```

```json
{ "object": "policy_version", "domain": "intent", "version": 7, "active": true, "note": "automate Northside invoices", "created_at": "2026-10-31T15:00:05.000Z" }
```

- `id` (string, required): Unique in the policy. Pause state and counts follow the id across policy versions.
- `label` (string, required): The words receipts and the agent show: "Approved automatically by your rule 'Northside invoices under 500'".
- `when` (array, required): Ordinary policy conditions (facts, `in_list`, velocity), all of which must hold.
- `limit` (object): `{ window, max_count?, max_amount? }`, counted per clause over the current UTC day, week (from Monday) or month. Past it, requests go to a person.
- `sample_rate` (integer): 1 in N (2–100) still goes to a person as a spot check, chosen from the token id, so a replay gets the same answer.
- `expires_at` (string): When the clause stops applying. Left out, it's 90 days from the save; at most 365. The console asks for a review a week before.

A rule holds up to 5 clauses; the first whose conditions hold decides.

## 3. Watch the next invoice

The next small Northside invoice is approved without a person. Verify answers `valid`, with the approval and the clause:

```json
{
  "object": "mandate_assessment",
  "valid": true,
  "policy_version": 7,
  "approval_id": "appr_01M6AUTO3D4P9X2K7M5Q8W1Z3A",
  "approved_at": "2026-10-31T15:02:11.204Z",
  "auto_approval": {
    "rule_id": "rul_01JD9XBMB0REGYGCEB8ANG0ZKC",
    "clause_id": "northside-small",
    "label": "Northside invoices under 500",
    "policy_version": 7,
    "decided_via": "rule",
    "message": "Approved automatically by your rule 'Northside invoices under 500'"
  }
}
```

The approval is recorded as `approved` with `decided_via: "rule"`. The decision's ledger row and its receipt carry `auto_approval`, and the `mandate.approval.approved` webhook says `decided_via: "rule"`. The console's Decisions page marks it **Automatic**, and `GET /v1/mandate/assessments?automatic=true` lists them.

An invoice over the clause's amount doesn't match it, so a person decides it.

## 4. Know when a person still decides

Some requests always go to a person, and the clause can't be saved where one is required.

| Saved on a rule that… | `auto_approve_not_allowed` guard |
| --- | --- |
| needs a biometric | `biometric` |
| needs a hardware tier | `hardware` |
| needs a passkey of a minimum age | `passkey_age` |
| needs more than one approver | `approvers` |
| is decided by a policy webhook | `webhook` |
| routes to an outside approver | `outside_approver` |
| doesn't ask for approval | `no_approval` |

At run time a clause that holds still sends the request to a person when any of these is true. Verify answers `approval_pending` with `auto_approval.guard` and the reason in `message`.

| `guard` | When |
| --- | --- |
| `new_counterparty` | Your account has never paid this counterparty before |
| `takeover_risk` | The agent's [takeover](https://provenanceauth.com/docs/mandate/guides/protect-agents-from-takeover.md) risk is elevated or high |
| `purpose_outside` | The action is outside the purpose a subagent was given |
| `network_report` | A merchant reported the agent in the last 24 hours |
| `external_risk` | Your [risk providers](https://provenanceauth.com/docs/mandate/guides/use-your-risk-providers.md) flagged the counterparty, or the rule matched on their verdict |
| `external_risk_unavailable` | Your risk providers didn't answer |
| `deal_counterparty` | The request is part of a deal with another company |

A request sent to an approver outside your company (`approver_link_id`) is never automated. A fact that can't be read sends the request to a person; it never approves on a missing answer.

## 5. Let it pause itself

A clause pauses itself when:

| Trigger | `pause_reason` |
| --- | --- |
| A person denies a request the clause would have covered (a spot check, one over the limit, or a guarded one) | `denied` |
| A person asks for changes on one | `changes_requested` |
| The clause reaches its limit three windows in a row | `limit_streak` |
| A merchant reports an action it approved | `network_report` |

Owners and admins get an email and a console task, and requests go to people until someone turns the clause back on. List the clauses and their state:

**curl**

```bash
curl -s $PROVENANCE_API/v1/mandate/policies/auto_approve -H "Authorization: Bearer $PROVENANCE_KEY"
```

**Node**

```ts
const clauses = await fetch(`${process.env.PROVENANCE_API}/v1/mandate/policies/auto_approve`, {
  headers: { Authorization: `Bearer ${process.env.PROVENANCE_KEY}` },
}).then((r) => r.json());
```

**Python**

```python
clauses = httpx.get(f"{api}/v1/mandate/policies/auto_approve", headers={"Authorization": f"Bearer {key}"}).json()
```

```json
{
  "object": "list",
  "data": [{
    "object": "auto_approve_clause",
    "id": "northside-small",
    "rule_id": "rul_01JD9XBMB0REGYGCEB8ANG0ZKC",
    "label": "Northside invoices under 500",
    "status": "active",
    "paused_at": null,
    "pause_reason": null,
    "usage": { "window": "week", "window_start": "2026-10-26T00:00:00.000Z", "count": 0, "amount": 0, "max_count": null, "max_amount": 2000 },
    "last_30_days": { "approved": 0, "approved_amount": 0, "sampled": 0, "over_limit": 0, "guarded": 0 }
  }],
  "has_more": false
}
```

A paused clause has `status: "paused"`, the `pause_reason` and a `pause_detail` naming the request that paused it, such as `appr_01M6AUTO9X2K7M5Q8W1Z3A4B`.

Turn it back on when you've checked:

**curl**

```bash
curl -s -X POST $PROVENANCE_API/v1/mandate/policies/auto_approve/northside-small/resume \
  -H "Authorization: Bearer $PROVENANCE_KEY"
```

**Node**

```ts
const clause = await fetch(`${process.env.PROVENANCE_API}/v1/mandate/policies/auto_approve/northside-small/resume`, {
  method: "POST",
  headers: { Authorization: `Bearer ${process.env.PROVENANCE_KEY}` },
}).then((r) => r.json());
```

**Python**

```python
clause = httpx.post(f"{api}/v1/mandate/policies/auto_approve/northside-small/resume", headers={"Authorization": f"Bearer {key}"}).json()
```

Resuming clears the limit streak and is ledgered. In live mode a developer's resume is held for an owner or admin.

## 6. Find what to automate

Two things show you which approvals to automate: the approval load and suggestions. See where approvals pile up with [`GET /v1/mandate/approvals/insights`](https://provenanceauth.com/docs/api/policies.md#get-v1-mandate-approvals-insights): per rule and per approver, approvals a week, the median wait, the share approved as asked, and decisions made in under 3 seconds, the sign people approve without reading.

**curl**

```bash
curl -s "$PROVENANCE_API/v1/mandate/approvals/insights?window=30d" -H "Authorization: Bearer $PROVENANCE_KEY"
```

**Node**

```ts
const load = await fetch(`${process.env.PROVENANCE_API}/v1/mandate/approvals/insights?window=30d`, {
  headers: { Authorization: `Bearer ${process.env.PROVENANCE_KEY}` },
}).then((r) => r.json());
```

**Python**

```python
load = httpx.get(f"{api}/v1/mandate/approvals/insights", params={"window": "30d"}, headers={"Authorization": f"Bearer {key}"}).json()
```

```json
{ "object": "approval_insights", "window_days": 30 }
```

Every night Provenance reads your last 90 days of approvals and groups them by rule, action type, counterparty and agent. A group with at least 20 approvals across two weeks or more, none of them declined, becomes a suggestion.

A suggestion proposes those facts, an amount cap at the largest amount rounded up, a weekly limit at the busiest week rounded up, and one in twenty as a spot check. Each comes with its backtest, the clause replayed over those 90 days. A suggestion looks like this:

```json
{
  "object": "policy_suggestion",
  "id": "psg_01M6SUGG3D4P9X2K7M5Q8W1Z3A",
  "status": "open",
  "rule_id": "rul_01JD9XBMB0REGYGCEB8ANG0ZKC",
  "clause": { "id": "auto-invoices-pay-invoice-northside", "label": "Northside pay invoice up to 500", "limit": { "window": "week", "max_amount": 2000 }, "sample_rate": 20 },
  "backtest": { "approvals": 44, "would_skip": 41, "skip_rate": 0.932, "hours_saved": 3.1, "would_have_allowed_denied": 0, "summary": "Would have skipped 41 of 44 approvals (93%) in 90 days, about 3.1 hours of waiting; would have allowed 0 requests a person denied." }
}
```

List them with [`GET /v1/mandate/policies/suggestions`](https://provenanceauth.com/docs/api/policies.md#get-v1-mandate-policies-suggestions), and try one first: `POST /v1/mandate/policies/suggestions/:id/apply` with `"mode": "shadow"` runs it as your [shadow policy](https://provenanceauth.com/docs/concepts/policies.md) for 7 days, so verifies record what it would have approved and nothing is approved. `"mode": "enforce"` turns it on. Dismissed suggestions stay away for 90 days.

In the console, an approved request has **Always approve this?**: a clause pre-filled from that request, with its backtest, that you can edit before trying it in shadow or turning it on. People who approve but don't edit policy can propose one; an owner or admin approves the change.

Owners and admins also get a weekly email with each clause's approvals, totals and spot checks.

## 7. Remove the clause

To stop a clause for good, publish the policy without it. When you're done testing, return the sandbox account to the default policy with [`DELETE /v1/mandate/policies`](https://provenanceauth.com/docs/api/policies.md#delete-v1-mandate-policies):

**curl**

```bash
curl -s -X DELETE $PROVENANCE_API/v1/mandate/policies \
  -H "Authorization: Bearer $PROVENANCE_KEY"
```

**Node**

```ts
await prov.mandate.policies.reset();
```

**Python**

```python
prov.mandate.policies.reset()
```

## Errors you might see

| Code | What to do |
| --- | --- |
| `auto_approve_not_allowed` | The clause sits where a person is required. `error.param` names the clause and `details[].guard` the guard: move it to a rule that asks one person in your company |
| `policy_invalid` | A clause field is malformed, two clauses share an id, or `expires_at` is past or more than 365 days out |
| `plan_required` | Clauses are on Pro and above |
| `resource_missing` | No clause or suggestion with that id on your account |

## See also

- [Policies](https://provenanceauth.com/docs/concepts/policies.md)
- [Step-up approval](https://provenanceauth.com/docs/mandate/guides/step-up-approval.md)
- [Route approvals](https://provenanceauth.com/docs/mandate/guides/route-approvals.md)
- [Decision ledger](https://provenanceauth.com/docs/mandate/concepts/decision-ledger.md)
