# Your agents can spend credits. They can't touch your card.

> Dizo API keys can't touch billing unless you grant billing:write, and the account owner can lock billing so no key can change top-ups, refills or limits.

Every Dizo key is read-only for billing by default. Top-ups and refill changes need the `billing:write` scope, and one setting, `locked: true`, blocks every key from changing billing at all.

## Highlights
- **Read-only by default.** New keys cannot buy credits or change refills unless you grant `billing:write`.
- **One switch to lock.** `PUT /v1/billing/limits` with `"locked": true` blocks API changes to billing for every key.
- **Scopes per key.** Pick from `data:read`, `billing:read`, `billing:write` and `keys:write` when you create a key.
- **Safe MCP defaults.** MCP connections get `data:read` only and a 500-credit per-call limit unless changed in the console.
- **Audit log.** Billing changes are recorded in an audit log, so you can see who changed what.
- **Humans own the money.** Agents cannot sign themselves up or add a payment method. A person owns the account.

## Steps
1. **Create scoped keys** — Give agents `data:read` and the endpoints they need.
2. **Set caps** — Per-key credit caps and an account monthly cap in USD.
3. **Lock billing** — Send `"locked": true` to `PUT /v1/billing/limits`.
4. **Watch alerts** — Get email or webhook alerts at 50%, 80% and 100% of any cap.

## APIs used
| API | Endpoint | Credits | Charged | Reference |
|---|---|---|---|---|
| Spend limits | `PUT /v1/billing/limits` | Free | Never | [docs](https://dizo.ai/docs/billing-limits.md) |
| API keys | `POST /v1/keys` | Free | Never | [docs](https://dizo.ai/docs/keys.md) |
| Top up | `POST /v1/billing/topup` | Free (charges card on file) | Never | [docs](https://dizo.ai/docs/billing-topup.md) |
| Auto-refill | `PUT /v1/billing/auto-refill` | Free | Never | [docs](https://dizo.ai/docs/billing-refill.md) |
| Key info | `GET /v1/me` | Free | Never | [docs](https://dizo.ai/docs/me.md) |


## The problem: agents that can reach the wallet

Handing an AI agent an API key used to mean handing it whatever that key could do. If the same key that searched for prospects could also buy credits or raise a spending limit, a confused agent, a prompt injection hidden in a web page or a leaked key in a log file could all turn into charges on your card. Spend caps help, but a cap is only as strong as the ability to change it.

Dizo separates spending credits from controlling money. Every key is read-only for billing by default. Buying credits and changing refill settings need a separate scope, `billing:write`, that you have to grant on purpose. And the account owner can go one step further and lock billing entirely, so no key, whatever its scopes, can change top-ups, refills or limits through the API. The result is simple to reason about: agents work inside a budget that only people can move.

## How key scopes work

Keys are created with `POST /v1/keys`, which itself requires the `keys:write` scope. Each key takes a `name`, a list of `scopes`, optional daily and monthly credit caps, a `max_credits_per_request` ceiling and an `allowed_endpoints` allow-list. The secret, starting `dz_live_`, is shown once. The [API keys reference](/docs/keys) has the full parameter table.

There are four scopes. `data:read` lets a key call the data endpoints: search, lookups, enrichment, lists and the rest. `billing:read` lets it read balance and usage. `billing:write` lets it buy credits through `POST /v1/billing/topup` and change refills. `keys:write` lets it create other keys. A typical agent key carries only `data:read`, which is exactly what an MCP connection gets by default. Any key can call `GET /v1/me` to see its own scopes, caps and remaining budget, which is the first thing a well-behaved agent does.

## The lock itself

Billing lockdown is one field on the spend-limits endpoint. `PUT /v1/billing/limits` accepts `monthly_cap_usd`, `daily_cap_credits`, `alerts_pct`, `alert_emails` and `locked`. With `locked: true`, no API key can change billing settings, including keys that hold `billing:write`. The [spend limits reference](/docs/billing-limits) shows the request and response.

Locking does not stop your account from working. Data calls continue as normal within each key's caps. Reading balance and usage still works. The monthly cap, the alert thresholds and your refill settings keep applying exactly as they were configured. What the lock blocks is change: nobody can raise the cap, switch on a larger refill or top up through the API while it is set. Because that includes every script, plan for the owner to lift the lock deliberately when a change is genuinely needed, and to set it again afterwards.

## Worked example: one account, three consumers

A small team runs three things against Dizo: an outbound agent connected over MCP, a nightly CRM enrichment job and a finance dashboard. The owner sets the account's `monthly_cap_usd` to 2000 with alerts at 50, 80 and 100 percent to a finance inbox, and auto-refill at a $500 amount so credits are bought at the Builder rate of $0.021.

Then come the keys. The agent key gets `data:read`, a 500-credit `max_credits_per_request`, a daily cap of 2,000 credits and a monthly cap of 20,000, with `allowed_endpoints` limited to `/v1/search` and `/v1/email/find`. The enrichment job gets `data:read` with its own monthly cap and access to batch and enrich. The dashboard gets `billing:read` only. Nobody receives `billing:write`. Finally the owner sends `locked: true`.

Now the worst case is bounded. The agent can spend at most 20,000 credits a month, about $420 at the Builder rate, and cannot raise that number. The whole account cannot pass $2,000 in a calendar month, refills included. And no key can change any of it.

## How this works with agents and MCP

Dizo's access model starts from the assumption that a person owns the account and the money. An agent cannot sign itself up or add a payment method. A human signs up, confirms their email, gets 250 free credits on a work email and creates keys for agents with the caps they choose.

Over the [MCP server](/mcp), connections default to `data:read` and a 500-credit per-call limit unless those are changed in the console. The top-up, auto-refill, limits and keys endpoints are not exposed as MCP tools at all; only read tools such as `dizo_balance` and `dizo_whoami` are. The published agent rules add a behavioural layer: agents should never call billing write endpoints without explicit human approval in the conversation, and should stop and ask when monthly spend approaches the cap. Billing lockdown is the enforcement behind that rule, so you are not relying on the model to follow instructions.

## Pairing lockdown with caps and alerts

Lockdown protects your limits; it does not set them. Use it alongside [per-key spend caps](/features/per-key-spend-caps), which divide the budget between consumers, and the [monthly spend cap](/features/monthly-spend-cap), which sets a hard dollar ceiling for the whole account. When the monthly cap is reached, calls return `402 monthly_cap_reached` until the next month or until the owner raises it.

Alerts close the loop. Email and webhook alerts fire at 50%, 80% and 100% of any cap, and on every refill, so you hear about unusual spend early rather than at month end. Billing changes go into an audit log. Together these give you a budget no agent can move, notice when the budget is being used up, and a record of every change made to it.

## Edge cases worth planning for

Most surprises with billing controls come from forgetting that they apply to everyone, including you. Before you lock, list every script and integration that touches billing, decide which of them really needs to change settings, and move those changes to a person. Keys can also carry an optional IP allowlist and an expiry date, which narrow the damage a leaked key could do even within its data scope.

A few specific cases are worth knowing before you rely on the setup:

- A lock blocks your own automation too. A script that tops up through the API with `billing:write` stops working while billing is locked.
- Key secrets are shown once. Store them in a secret manager, never in a prompt, repository or chat log.
- `keys:write` is powerful. A key that can create keys can create one with broader access, so give it only to people or tools you trust.
- Test keys starting `dz_test_` return synthetic data and never spend credits, so test agent behaviour with them first.
- Refills never exceed the monthly cap. If a refill would cross it, the refill is skipped and you get an alert.

## Checking what a key can do

Trust is easier when it can be verified. Any key, in any mode, can call `GET /v1/me`, which is free and returns the key's name, its `mode` of live or test, its `scopes`, its `allowed_endpoints`, and a `budget` block with `max_credits_per_request`, `day_remaining_credits` and `month_remaining_credits`. It also reports rate limits. On MCP, the same call is `dizo_whoami`.

Use it in two ways. Agents should call it once at start-up and plan within the budget it reports, which turns caps from a wall the agent hits into a constraint it can see. And people setting up an integration can call it with a new key to confirm, before going live, that the key has `data:read` and nothing more. If the response shows a billing scope you did not intend, stop using that key and create a narrower one in its place.

## When you don't need it

If you are a solo developer running scripts by hand with your own key, lockdown adds a step without much benefit; per-request `max_credits` and a monthly cap already cover most risk. The same is true while you are testing with `dz_test_` keys, since those never spend anything.

Lock billing once anything autonomous touches the account: an MCP connection in a chat assistant, an agent framework running in production, a workflow tool with stored credentials, or a teammate's integration you did not write. That is the point at which you want the rules about money enforced by the API rather than by good intentions. [Sign up](/signup) to get live keys and set it up.

## FAQ

### Can a Dizo API key buy credits by default?
No. Keys are read-only for billing by default. Buying credits through `POST /v1/billing/topup` or changing refills requires the `billing:write` scope, which you must grant when creating the key.

### What does locking billing do?
Sending `"locked": true` to `PUT /v1/billing/limits` blocks API changes to billing for every key, including keys with `billing:write`. Data calls, balance reads, caps, alerts and existing refill settings keep working.

### Can an AI agent change my spending limits over MCP?
Not through Dizo's MCP server. Billing write endpoints are not exposed as MCP tools, connections default to `data:read` with a 500-credit per-call limit, and a lock blocks billing changes from any key.

### Who can see billing changes?
Billing changes are recorded in an audit log, and alerts go to the email addresses and webhooks you configure, at 50%, 80% and 100% of any cap and on every refill.

### Does locking billing stop auto-refill?
No. The lock blocks changes to billing settings, not the settings themselves. Auto-refill continues as configured and still never exceeds the monthly cap.

### How should I scope a key for an SDR agent?
Give it `data:read` only, a `max_credits_per_request` ceiling, daily and monthly credit caps, and an `allowed_endpoints` list such as `/v1/search` and `/v1/email/find`. The [scoped API keys](/features/scoped-api-keys) page covers the options.
