# A dollar ceiling nothing on the account can cross.

> Set a hard monthly USD cap on your Dizo account, refills included. At the cap, calls return 402 monthly_cap_reached and nothing more is spent.

Set `monthly_cap_usd` once. Every key, agent and refill sits underneath it. When the month reaches the cap, billable calls stop with `402 monthly_cap_reached`.

## Highlights
- **Hard USD ceiling.** One dollar amount per calendar month for the whole account, set with `PUT /v1/billing/limits`.
- **Refills included.** Auto-refill never exceeds the cap. A refill that would cross it is skipped.
- **Clear stop signal.** At the cap, billable calls return `402 monthly_cap_reached`. Free endpoints keep working.
- **Alerts as it fills.** Email and webhook alerts at 50%, 80% and 100%, sent to the `alert_emails` you choose.
- **Lock it.** Set `locked: true` and no API key can change billing settings.
- **Daily limit too.** Add `daily_cap_credits` for an account-wide credit limit per day.

## Steps
1. **Forecast** — Use free counts and the credit table to estimate the month in dollars.
2. **Set the cap** — Send `monthly_cap_usd`, `alerts_pct` and `alert_emails` to `PUT /v1/billing/limits`.
3. **Lock billing** — Set `locked: true` so only the account owner can change it.
4. **Watch spend** — Check `GET /v1/billing` and handle `billing.cap_warning` webhooks.

## APIs used
| API | Endpoint | Credits | Charged | Reference |
|---|---|---|---|---|
| Spend limits | `PUT /v1/billing/limits` | Free | Never | [docs](https://dizo.ai/docs/billing-limits.md) |
| Balance & usage | `GET /v1/billing` | Free | Never | [docs](https://dizo.ai/docs/billing.md) |
| Auto-refill | `PUT /v1/billing/auto-refill` | Free | Never | [docs](https://dizo.ai/docs/billing-refill.md) |
| Webhooks | `POST /v1/webhooks` | Free | Never | [docs](https://dizo.ai/docs/webhooks.md) |


## The number finance actually cares about

Credit caps on keys and ceilings on requests are engineering controls. They are measured in credits, set per caller and tuned by whoever runs the integration. Finance asks a different question: what is the most this account can cost us this month, in dollars, no matter what anyone does? Usage pricing is only comfortable when that question has a firm answer.

The monthly spend cap is that answer. It is a hard ceiling in US dollars on the account's spend in a calendar month, and it includes auto-refill purchases. When the month reaches it, billable calls return `402 monthly_cap_reached` and stop. Every key, every agent and every workflow on the account sits underneath it, so one setting bounds the whole company's data spend.

## How it works

The cap is set with `PUT /v1/billing/limits`, or in the console. The `monthly_cap_usd` field takes a dollar amount, or `null` for no cap. The same endpoint carries a few related settings, all free to change. You can read the current state back at any time with `GET /v1/billing`, which shows the month's `spent_usd` next to `cap_usd`, along with the balance and refill settings.

The cap runs per calendar month. It is enforced on the account, not on any one key, so it catches spend from every source: scripts, workflow tools, agents connected through the [MCP server](/mcp), and people using the console. That is what makes it the outermost layer of control.

- **`monthly_cap_usd`:** the hard monthly ceiling in dollars, refills included.
- **`daily_cap_credits`:** an account-wide daily credit limit.
- **`alerts_pct`:** thresholds for alerts, for example `[50, 80, 100]`.
- **`alert_emails`:** who receives the alerts, such as a finance address.
- **`locked`:** when true, no API key can change billing settings.

## What happens at the cap

When the month's spend reaches the cap, billable calls return HTTP 402 with the code `monthly_cap_reached`. Free endpoints keep working: counts, balance and usage, pricing, key information, suppression and feedback are never charged. So an agent or integration can still check the situation with `GET /v1/billing` and tell a human what happened, even though it cannot buy more data.

Auto-refill respects the cap absolutely. If a refill would push the month past the cap, the refill is skipped, you get an alert, and calls stop with a 402 once the remaining balance runs out. Manual top-ups through `POST /v1/billing/topup` also respect the cap. There is no path, automated or manual, by which a capped account spends beyond its ceiling in a month.

To keep going, someone with the right access raises the cap or waits for the next calendar month.

## A worked budget

The [limits docs](/docs/billing-limits) show a cap of $2,000 with alerts at 50%, 80% and 100% going to a finance address. Here is how that might fit a hypothetical team running outbound with an agent and a CRM enrichment workflow.

Suppose the team plans 60,000 search results (2,400 credits), 15,000 emails found (15,000 credits) and 2,000 phone finds that return numbers (20,000 credits). That is 37,400 credits. Bought through $500 auto-refills at $0.021 per credit, it costs about $785.40. The $2,000 cap gives more than double that headroom for unplanned jobs, while still ruling out a runaway month.

The alerts then do the monitoring. At $1,000 finance gets the 50% email, at $1,600 the 80% email, and at $2,000 the cap is reached. If the team's plan says the month should land near $840, a 50% alert by mid-month is a clear sign something is running that nobody planned.

## Choosing a cap

Start from a forecast, not a guess. Free counts tell you the size of each segment you plan to work, one count per segment. Estimate how many of those records you will look up, multiply by the published credit costs on the [pricing page](/pricing), convert to dollars at the tier you buy at, and add headroom for experiments and growth. A reasonable starting point is 1.5 to 2 times the forecast: high enough that normal variation never stops work, low enough to contain a real mistake.

Revisit the cap monthly at first. If you hit 80% every month by design, raise it. If you never pass 30%, lower it to tighten the blast radius. The account cap should reflect what the company is willing to spend, while per-key monthly caps divide that amount among teams and agents. Set the account cap first, then make sure the key caps add up to something at or below it.

## Locking billing and keeping agents out of it

A cap is only as strong as the controls on who can change it. Billing changes require a key with the `billing:write` scope, and keys are read-only for billing by default. Setting `locked: true` goes further: no API key can change billing settings at all, so the cap, refill and limits can only be changed by the account owner. Billing changes are written to an audit log, per the [trust page](/trust).

For agents, Dizo's rules are explicit. Agents should never call billing write endpoints, including top-up, auto-refill, limits and keys, without explicit human approval, and they should check `GET /v1/billing` before long loops and stop to ask their human when monthly spend is near the cap. The simplest setup is to give agents `data:read` keys only and lock billing, so even a manipulated prompt cannot raise the ceiling.

## Alerts and webhooks

Alerts go out by email and webhook at 50%, 80% and 100% of any cap, and on every refill. Set `alerts_pct` to the thresholds you want and `alert_emails` to the people who should hear about them, typically a finance inbox and the owner of the integration.

For automation, register a [webhook](/docs/webhooks) for the billing events: `billing.cap_warning`, `billing.cap_reached`, `billing.refilled` and `billing.low_balance`. Every delivery is signed with a `Dizo-Signature` header and retried with backoff for 24 hours. A handler can pause your own job scheduler when `billing.cap_warning` arrives, so planned work slows down gracefully instead of failing at the cap.

## Reading the month with GET /v1/billing

The cap is only useful if people can see where they stand against it. `GET /v1/billing` is free and returns everything in one response. The docs example shows a balance of 48,211 credits, a month with `spent_usd` of 640 against a `cap_usd` of 2,000, and 51,780 credits used so far. It also returns the auto-refill settings and usage for each key, such as `sdr-agent` at 9,400 credits of a 20,000 monthly cap.

Those numbers answer the practical questions quickly. How much room is left this month? $1,360 in that example. Which caller is consuming it? The per-key list shows that. Will the next refill fit? Compare the refill amount with the remaining headroom. Agents can read the same response through the `dizo_balance` MCP tool and are told to check it before long loops.

A simple daily job that calls this endpoint and posts the spend-to-cap ratio to your team keeps the cap visible without anyone opening the console.

## How the cap fits with other limits

Think of the controls as nested boxes. Inside is the request, bounded by [`max_credits`](/features/max-credits). Around it is the key, bounded by its daily and monthly credit caps and per-request maximum. Around all keys is the account's optional daily credit limit, and outside everything is the monthly spend cap in dollars.

Each layer is tuned for a different failure. A request ceiling catches one bad call. Key caps catch one bad caller. The daily account limit catches a fast spike across callers. The monthly cap catches everything else and gives finance a fixed number. With [auto-refill](/features/auto-refill) on, the monthly cap is also what keeps refills honest, since a refill that would cross it never runs.

## When you might not set one

A cap is optional, and `null` removes it. An account with no auto-refill and a small balance is already naturally bounded by what was bought. Enterprise customers with annual commitments and invoicing may prefer to manage spend through contract terms. Even then, a generous cap costs nothing and protects against the unexpected.

Work email signups get 250 free credits with no card, and `dz_test_` keys let you build against synthetic data now. [Sign up](/signup) to set up a capped account.

## FAQ

### What is the monthly spend cap?
A hard ceiling in US dollars on your account's spend in a calendar month, including auto-refill purchases. When it is reached, billable calls return `402 monthly_cap_reached`.

### Can auto-refill go over the cap?
Never. If a refill would push the month past the cap, it is skipped, you get an alert, and calls stop with a 402 once the balance runs out.

### Do free endpoints still work at the cap?
Yes. Counts, balance and usage, pricing, key information, suppression and feedback are never charged, so they keep working.

### How do I remove the cap?
Set `monthly_cap_usd` to `null` with `PUT /v1/billing/limits`. That requires a key with billing write access, unless billing is locked, in which case only the account owner can change it.

### Can an agent raise the cap?
Only with a key that has `billing:write`, and Dizo's agent rules require explicit human approval first. Set `locked: true` and no API key can change billing at all.

### When will I be alerted?
By email and webhook at 50%, 80% and 100% of the cap by default, and on every refill. You can choose thresholds with `alerts_pct` and recipients with `alert_emails`.
