> ## Documentation Index
> Fetch the complete documentation index at: https://docs.payzor.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Policy Engine

> Hard limits, allowed categories, and human-in-the-loop approvals, evaluated before every single money movement.

# Policy Engine

The Policy Engine is the reason an agent can be trusted with a wallet. Before **any** payment or transfer executes, Payzor evaluates the agent's policy. If the answer is no, nothing moves and the agent receives a structured rejection it can read and react to.

## The rules

| Rule                        | Scope            | Effect                                                                                                                                   |
| --------------------------- | ---------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
| `maxSingleTransaction`      | hard limit       | Blocks any transaction above the cap.                                                                                                    |
| Workspace per-tx max        | hard limit       | Owner-level ceiling applied on top of the agent's own cap (the lower of the two wins).                                                   |
| `allowedCategories`         | hard limit       | Spending is tagged with categories (`data_apis`, `compute`, `agent_transfer`, `shop`, `services`). Anything outside the list is blocked. |
| Daily caps                  | hard limit       | Agent daily limit and owner-level workspace daily volume cap.                                                                            |
| `requireHumanApprovalAbove` | **human review** | Above this threshold the payment does *not* execute; it waits for a human.                                                               |

The distinction matters:

* **Hard limits** → rejected immediately, deterministic, no human involved.
* **Human review** → paused as a *pending approval*, human notified in real time.

## Human-in-the-loop (HITL)

When a payment exceeds the review threshold:

```json theme={null}
{
  "success": false,
  "pendingApproval": true,
  "reason": "Monto $200 supera umbral de aprobación humana ($30 USDC)"
}
```

At the same moment:

1. A pending approval record is created (with expiry).
2. A webhook `approval.required` fires to every registered endpoint.
3. The console shows the approval queue.

A human then grants or rejects:

```bash theme={null}
curl -X POST https://your-payzor-host/approvals/apr_xxx/grant \
  -H "Authorization: Bearer <console_jwt>"
```

Only then does the money move. Rejections are logged like any blocked payment.

## Pre-authorized spending

Some flows should not re-ask a human for every charge, but must never bypass limits. That's what `preAuthorized` means in Payzor:

> When an agent's human accepts a [PayLink](/concepts/paylinks) budget, charges drawn against that budget skip *only* the human-review rule. Every hard limit still applies.

One approval, many charges, zero ambiguity about who said yes.

## Reading a policy

```bash theme={null}
curl https://your-payzor-host/balance -H "Authorization: Bearer pz_sk_..."
```

returns the active policy alongside the balance, so agents can self-check before attempting a payment.
