> For the complete documentation index, see [llms.txt](https://fourohtwo.gitbook.io/fourohtwo-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://fourohtwo.gitbook.io/fourohtwo-docs/agents/spending-rules.md). Agents can also search and read this documentation through its [MCP server](https://fourohtwo.gitbook.io/fourohtwo-docs/~gitbook/mcp).

# Spending rules

Spending rules cap what an agent wallet can pay. Fourohtwo checks them on every paid call before the API is called, and the SDK and MCP server check them on other x402 APIs too.

## Link an agent

The agent wallet signs once to let your account manage it, so nobody can set rules on a wallet they don't control.

* **From code:** `AGENT_KEY=0x… npx fourohtwo delegate --owner <your wallet>`, then paste the address and signature on [fourohtwo.xyz/agents](https://fourohtwo.xyz/agents).
* **From a browser wallet:** switch your wallet to the agent account and press **Sign with browser wallet**.

## Rules

| Rule          | Effect                                                                                                                        |
| ------------- | ----------------------------------------------------------------------------------------------------------------------------- |
| Daily limit   | Total the agent can spend in a rolling 24 hours, USDG and USDC counted together in dollars.                                   |
| Max per call  | Refuses any API priced above this.                                                                                            |
| Daily per API | Total per API in a rolling 24 hours.                                                                                          |
| Allowed APIs  | If set, only these can be paid: Fourohtwo API names like `rug-check`, or hostnames of other x402 APIs like `api.example.com`. |
| Pause         | Refuses every paid call until you resume.                                                                                     |

A refused call returns `403` with `charged: false`. Nothing is signed or settled.

On Fourohtwo APIs the server enforces the rules, so they hold even if the agent's code is changed. On other x402 APIs the SDK and MCP server enforce them before signing.

The rules are public at `GET /api/agents/<agent>/policy` so any client can apply them.

## Spending history

Open an agent on [Agent spending rules](https://fourohtwo.xyz/agents) and choose **View history** to see its balance, what it spent in the last day, week and month, a chart of what it spent each day over the last 30 days, which APIs it uses most, and every call it paid for through Fourohtwo. **Download CSV** exports every call and payment for a spreadsheet or your accounts.

Payments the SDK or MCP server makes to other x402 APIs show up too, under **Elsewhere on x402**. Each one is checked on-chain before it's counted, and they count toward the agent's daily limit on Fourohtwo APIs.

## Alerts

Add a webhook in **Dashboard → Settings → Webhook** and Fourohtwo tells your server when:

* an agent has spent 80% of its 24h limit (`agent.limit_near`, at most once a day per agent)
* an agent's rules refuse a call because it is paused, the API isn't on its allowlist, or a limit would be passed (`agent.blocked`, at most every 6 hours per agent)

Both events carry the agent address, its label, the numbers involved and a link to its history. See [Webhooks](https://fourohtwo.gitbook.io/fourohtwo-docs/creators/webhooks.md) for signatures and retries.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://fourohtwo.gitbook.io/fourohtwo-docs/agents/spending-rules.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
