# Policies

> What a policy is, the starter guardrails, and how to create, assign, and simulate a policy before you enable it.

- Human URL: https://conto.finance/docs/policies/overview
- Raw Markdown: https://conto.finance/docs/policies/overview.md
- Terminal view: https://conto.finance/ai/docs/policies/overview

Documentation group: Spending controls

The agent owner sets policies for each agent. Conto checks them before the agent pays.

Policy editing, bulk updates, simulation and rollback request bodies are limited to 1 MiB while streaming. Oversized input returns HTTP 413 before parsing or applying policy changes.

## What is a policy?

A policy is a set of rules that decides whether a payment can proceed. Every applicable policy must
pass, and the payment gets one of three outcomes:

| Outcome               | Condition                                                      |
| --------------------- | -------------------------------------------------------------- |
| **DENIED**            | Any check denies                                               |
| **REQUIRES_APPROVAL** | No denial, and at least one rule or workflow requires approval |
| **APPROVED**          | All checks pass                                                |

[How policies are evaluated](https://conto.finance/docs/policies/evaluation) covers scope, evaluation order, and how rules
combine. The [policy rule reference](https://conto.finance/docs/policies/advanced) lists every rule type.

## Starter guardrails for new organizations

New human organizations start with two active starter policies:

- **Starter guardrails**: `$25` maximum per transaction and `$100` maximum per day
- **Starter approval threshold**: payments above `$10` require explicit approval

The starter policies are ordinary assigned policies visible in the dashboard. Active starters are
linked to new agents automatically and combine with organization baselines and any policies assigned
to the agent or wallet. You can edit, deactivate, or delete them.

Approval requests go to the owner's email first. See
[Notification Channels](https://conto.finance/docs/integrations/notification-channels) to change where reviews are sent.

## Policy types

The policy type groups rules in the dashboard. The rules decide the outcome.

- [Spend limits](https://conto.finance/docs/policies/spend-limits): per-payment, daily, weekly, and monthly caps
- [Time windows](https://conto.finance/docs/policies/time-windows): allowed hours and days, and blackout periods
- [Counterparties](https://conto.finance/docs/policies/counterparties): recipient allowlists, blocklists, and trust rules
- [Policy rule reference](https://conto.finance/docs/policies/advanced): every rule type, including identity, category,
  geographic, contract, budget, x402, and MPP rules
- [Policy testing](https://conto.finance/docs/guides/policy-testing): build a policy that approves, holds, and denies test payments
- [Version history](https://conto.finance/docs/policies/versioning): view, compare, and restore earlier versions of a policy

## Creating policies

### Via dashboard

    Go to **Policies > Create policy**.

    | Field           | Description                                                                 |
    | --------------- | --------------------------------------------------------------------------- |
    | **Policy Name** | A label for the policy                                                      |
    | **Applies to**  | **Every agent**, **One team**, or **Specific agents**                       |
    | **Policy Type** | Chooses which rule fields the form shows                                    |
    | **Description** | Optional. What this policy does                                             |

Set the rule values for the chosen type.

    For **Specific agents**, choose them in the same form. To assign a policy to a wallet or card,
    use the API.

### Via API

```bash
curl -X POST https://conto.finance/api/policies \
  -H "Authorization: Bearer $CONTO_ORG_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Daily Spend Limit",
    "description": "Limits daily spending to $1000",
    "rules": [{ "ruleType": "DAILY_LIMIT", "operator": "LTE", "value": "1000", "action": "ALLOW" }],
    "policyType": "SPEND_LIMIT",
    "scope": "organization",
    "priority": 50,
    "isActive": true
  }'
```

In an [anonymous sandbox](https://conto.finance/docs/quickstart/agent-sandbox#configure-controls), use the sandbox setup key
as the bearer token for these policy routes and for agent-wallet spend limits. It works only on
that sandbox, only until a human claims it, and never lets the agent's SDK key change a policy.

Sandbox creation, agent registration, sandbox claim, and handoff completion accept request bodies up to 64 KiB (65,536 bytes). An
oversized request returns HTTP `413` before creating an agent, assigning starter policies, or changing sandbox ownership.

## Policy properties

| Property      | Type    | Description                                                                                                                     |
| ------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------- |
| `name`        | string  | Human-readable name                                                                                                             |
| `description` | string  | Detailed description                                                                                                            |
| `policyType`  | enum    | Type of policy                                                                                                                  |
| `scope`       | enum    | `organization` baseline, `team`, or `assigned` targets. When omitted, it is `organization` unless `agentIds` or `teamId` is set |
| `teamId`      | string  | The team whose agents the policy governs. Required with `team` scope                                                            |
| `agentIds`    | array   | Agents to assign the policy to when it is created. Only valid with `assigned` scope                                             |
| `priority`    | number  | Evaluation order (0-100), not override precedence                                                                               |
| `isActive`    | boolean | Whether policy is enforced                                                                                                      |
| `rules`       | array   | Specific rules for this policy                                                                                                  |

## Assigning policies

Assign a policy to specific agents, wallets, or cards. Only policies with `scope: "assigned"` can be
assigned. Organization policies apply automatically, and team policies apply to every agent in the
team.

## Organization, team and agent policies

Every policy that reaches an agent applies, and every rule must pass. Organization policies cover every
agent. Team policies cover the agents in one team. Policies assigned to an agent cover that agent.
A team or agent policy can only add limits to the organization's.

An agent belongs to at most one team. Its payments record the team's slug as their department, so a
department budget matches the team whatever label the agent sends.

```bash
curl -X POST https://conto.finance/api/policies \
  -H "Authorization: Bearer $CONTO_ORG_API_KEY" \
  -d '{
    "name": "Marketing limits",
    "policyType": "SPEND_LIMIT",
    "scope": "team",
    "teamId": "cmm5c0tea000l49h7dmsuc11p",
    "rules": [{ "ruleType": "MAX_AMOUNT", "operator": "LTE", "value": "200", "action": "ALLOW" }]
  }'
```

People with the Manager role can manage a team. A team manager can add and tighten their team's
policies and assign policies to their team's agents. A change of theirs that loosens a rule, such
as raising a limit or turning a policy off, waits for an Owner or Admin to approve it.

In the dashboard, open **Policies → By agent** to compare configured limits and see which
organization, team, and agent policies apply. Select agents to assign a reusable policy or move them
to a team. Owners and Admins can use **Manage teams** to create teams, set cost centers, and choose
team managers. Moving or removing an agent can wait for governance approval if it removes team rules.

When creating a policy, choose **One team** and select the team. A team manager can create policies
only for teams they manage. Configure purchase reviewers separately in **Policies → Approvers**;
being a team manager does not automatically make someone a purchase reviewer.

The [Teams API](https://conto.finance/api-docs) remains available. Team limits apply to each agent
in the team. For one limit that several agents draw on, create a [shared budget](https://conto.finance/docs/sdk/shared-budgets) and add the team. A team covers each agent on it, and an agent that leaves the team stops being covered. The controls view shows simple
configured limits, not remaining funds; wallet, card, conditional, and other policies can add restrictions.

### Assign to agent

```bash
curl -X POST https://conto.finance/api/agents/{agentId}/policies \
  -H "Authorization: Bearer $CONTO_ORG_API_KEY" \
  -d '{
    "policyId": "cmm5c0pol000l49h7dmsuc11p"
  }'
```

## Recommended setup

Keep the starter guardrails ($25 per payment, $100 per day, review above $10) until the agent has a
track record. Then raise limits by giving each agent its own policies, in this order. Create each
policy with `"scope": "assigned"` and the agent's ID, or assign it on the agent's **Policies**
tab. The starter policies still apply until you edit or unassign them, because every applicable
policy must pass. The numbers below are an example for a payments agent and a separate API agent.

1. **Cap spend.** `MAX_AMOUNT` 50 and `DAILY_LIMIT` 200 deny any payment over $50 and any payment
   that would take the day's spend over $200. See [Spend limits](https://conto.finance/docs/policies/spend-limits).
2. **Send the middle band to review.** `REQUIRE_APPROVAL_ABOVE` 25 holds payments from $25 to $50 on
   the **Needs decision** tab of **Inbox** for a person to review. The agent gets
   `REQUIRES_APPROVAL` and can poll or use webhooks to check status. Keep the threshold below
   `MAX_AMOUNT`: smaller payments go through, the middle band waits for review, and larger payments
   are denied. See [Approval workflows](https://conto.finance/docs/guides/approval-workflows).
3. **Limit recipients.** `ALLOWED_COUNTERPARTIES` pays only the addresses you list. To allow every
   recipient except known bad ones, use `BLOCKED_COUNTERPARTIES` instead. To also deny payees whose
   network score drops below 0.5, add `TRUST_SCORE` `GTE` 0.5. It still allows new payees. See
   [Counterparty policies](https://conto.finance/docs/policies/counterparties).
4. **Limit hours.** `TIME_WINDOW` 09:00 to 18:00 and `DAY_OF_WEEK` Mon to Fri deny overnight and
   weekend payments. Set a `timezone` on each rule over the API, or it runs in UTC. Add
   `BLACKOUT_PERIOD` for holidays and maintenance windows. See [Time windows](https://conto.finance/docs/policies/time-windows).
5. **Give x402 spend its own agent.** If the agent pays for APIs with
   [x402](https://conto.finance/docs/guides/x402-api-payments), assign x402 rules only to a separate API agent, because they
   apply to every payment of the agents they cover. `X402_MAX_PER_REQUEST` 0.10 and
   `X402_MAX_PER_SERVICE` `{"maxAmount": 20}` cap each call at $0.10 and each service at $20 over a
   rolling 24 hours. `X402_ALLOWED_SERVICES` pays only the domains you list. See
   [x402 protocol rules](https://conto.finance/docs/policies/advanced#x402-protocol-rules).
6. **Email owners about serious alerts.** Conto raises alerts in **Inbox**
   automatically, including policy violations and [x402 anomalies](https://conto.finance/docs/sdk/machine-spend#anomaly-alerts).
   In **Inbox**, select **Configure alerts**, turn on **Email owners about high-severity
   alerts**, and set **Severity to email** to **High and critical** or **Critical only**. Lower
   severities stay in the dashboard.
7. **Verify before you go live.** Call `GET /api/sdk/setup` with the agent's SDK key and check that
   the payment-control summary reflects the policies you assigned. Then
   [test allow, review, and deny](https://conto.finance/docs/guides/policy-testing).

## Denial explanations

When a payment is denied, the response includes a plain-language reason that can be shown to an
operator or end user:

```json
{
  "status": "DENIED",
  "reasons": ["This payment exceeds a configured spending limit."]
}
```

Reasons come from a fixed set, such as `No usable wallet is linked to this agent.` or
`This payee needs review before payments to it can proceed automatically.` They never include rule
values or policy names. See [payment reasons](https://conto.finance/docs/sdk/error-handling#payment-reasons).

An authorized operator can review the configured controls in the dashboard's policy and wallet
views. Dashboard alerts for a denied payment show the full evaluation reason.

## Test a policy before you enable it

When creating or editing a policy, expand **Try before saving**. It uses the rules currently in
the form, including unsaved changes.

1. Enter sample payments with amounts, recipients, categories, and spend so far. Choose
   **Test payments** to see which these rules would allow, block, or hold for approval.
2. Choose **Check recent payments** to compare the rules with your last 100 payments. The result
   shows how many would change from allowed to blocked or held.
3. Review the results, then save the policy when you are ready to apply it. Testing saves nothing
   and affects no payment. Other assigned policies still apply to actual payments.

Historical checks leave out rules that need live context, such as spend so far, velocity, and
time-of-day windows. The result identifies skipped rule types.

### Replay recent payments through the API

`POST /api/policies/simulate` replays a candidate policy against your real recent transactions and
reports what it would have decided. It creates no policy, runs no approval, and moves no money. Use
it to see which currently allowed payments a new limit would block before you turn it on.

```bash
curl -X POST https://conto.finance/api/policies/simulate \
  -H "Authorization: Bearer $CONTO_ORG_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "candidatePolicy": {
      "name": "Cap vendor payments",
      "policyType": "SPEND_LIMIT",
      "rules": [{ "ruleType": "MAX_AMOUNT", "operator": "LTE", "value": "500", "action": "ALLOW" }]
    },
    "sampleSize": 200
  }'
```

The response returns a per-transaction `wouldBe` decision (`ALLOW`, `DENY`, `REQUIRE_APPROVAL`) and a
`summary` with `newlyBlocked` and `newlyAllowed` counts.

The simulation evaluates the rule types a single historical transaction fully determines (amount,
category, counterparty, agent identity, x402/MPP service). Rule types whose decision depends on
state that is not on a payment row (cumulative daily/weekly/monthly limits, velocity, live trust
scores, geography, and time-of-day windows) are not replayed and are listed under
`summary.contextDependentRuleTypes`.

## Verify a sandbox control

Use the same agent and explicitly selected wallet for an allowed request, a denied request, and
an optional human-review request. The [test report](https://conto.finance/docs/cli/commands#save-a-controlled-payment-test-report)
combines their persisted outcomes and numeric spending limits without executing another payment.
New sandbox SDK keys can read the required audit evidence; existing keys remain unchanged.
