# Owner spending limits

> Caps, the auto-approve threshold, pause, and the audit log are enforced for the human owner. An agent cannot raise a limit or clear a pause. The agent API and the MCP server exist in code and stay disabled unless `AIPAY_AGENT_API_ENABLED` is `true` on an authenticated sandbox or production deployment. Production keeps that flag off. Read `GET /api/readiness`: `capabilities.agentApi` and `checks.agentApiEnabled` are the live answer. Payments (`AIPAY_PAYMENTS_MODE`), funding (`AIPAY_FUNDING_ENABLED`), and transfers (`AIPAY_TRANSFERS_ENABLED`) are separate flags and stay off in the no-money pilot. A page that describes a tool is not a claim that the tool is enabled.

Human-readable HTML: [https://aipaysyou.com/docs/spending-limits](https://aipaysyou.com/docs/spending-limits).

## Where the owner sets policy

While `capabilities.agentApi` is true, the signed-in owner opens the pilot dashboard and creates an API key. The token is shown once. The same panel edits:

- per-task maximum
- per-day cap
- per-month cap (rolling 30 days)
- total cap
- auto-approve threshold
- pause switch

Empty or omitted caps use the modest defaults below. The owner can mark a single cap unlimited. Currency for these keys is EUR. Amounts are minor units in storage and euros in the form (two decimal places).

| Limit | Default |
| --- | --- |
| Per task | EUR 50.00 |
| Per day | EUR 200.00 |
| Per month | EUR 500.00 |
| Total | EUR 1000.00 |
| Auto-approve threshold | EUR 20.00 |
| Requests per minute | 30 |

## What each check does

`preview_task` does not spend and does not need to pass the caps.

`publish_task`, and an approval above the threshold, call the policy:

- **Pause.** `paused: true` refuses the call. The REST error is `403 agent_paused` ("The owner paused this agent."). The owner turns the pause off by saving the policy again. Revoking a key also pauses it.
- **Per-task, daily, monthly, or total cap.** A reward that would pass the cap is blocked (`403 spend_blocked`). The amount is not counted as committed.
- **Auto-approve threshold.** A reward above the threshold is queued for the owner instead of published or approved. The owner sees the queued action in the dashboard and approves or rejects it. At or under the threshold, the action may proceed without that extra approval. The threshold does not bypass a cap or a pause.
- **Rate limit.** More than the key's requests-per-minute returns `429`.

`PUT /api/v1/spending-policy`, and any task body that includes policy fields such as `per_task_max_minor`, `paused`, or `requests_per_minute`, returns `403 policy_forbidden`. Agents cannot change spending policy.

## Audit log

Every key creation, policy update, revocation, allowed spend, queued action, block, and refusal is appended to the owner audit log. The dashboard shows the latest events as actor (`user` or `agent`), action, and outcome (`ALLOWED`, `QUEUED`, `BLOCKED`, or `REFUSED`). The stored reason explains the decision. The log is visible to the owning human, not to other tenants.

Pausing a key, lowering a cap, and rejecting a queued action are owner actions. They do not move money. Stripe funding and transfers remain behind their own flags and are off in this pilot.
