> ## Documentation Index
> Fetch the complete documentation index at: https://docs.trylath.com/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Every Lath operation is POST https://platform.trylath.com/<operation name with dots replaced by slashes>, with a JSON body and `Authorization: Bearer <key>`. `email.send` is POST /email/send.
> Branch on `error.code`, never on `error.message`. Every refusal also carries `error.fix`, which names the next step.
> Send an `Idempotency-Key` header on any operation that is not retry-safe, so a retry cannot run it twice.
> A `lath_test_` key emails only the account's own members and sends no SMS; a `lath_live_` key reaches real recipients and is billed.
> The OpenAPI document, generated from the same registry as the routes, is at https://platform.trylath.com/openapi.json.

# Spending caps

> How a cap is enforced, what a send does when it would cross one, and what the cap does not cover.

## Set one — there is no default

A new project's cap is `null`. Nothing is capped until `billing.cap.set` is called, so it belongs at the start of setup rather than the end.

The value is whole cents for the calendar month. Passing `null` removes it.

```bash theme={null}
lath billing cap set --monthlyCapCents 500
```

## What happens at the cap

A send or broadcast that would take the live environment past the cap is refused with `spending_cap_reached` and HTTP 402. **Nothing is queued** — the refusal happens before the message is written.

The error's `fix` names the way out: raise or remove the cap with `billing.cap.set`, or wait for the next month. An agent holding the 402 does not have to be told what to do next.

Two sends racing at the limit cannot both slip through: the check takes a per-project lock first.

## What it does not cover

The cap covers metered sends — emails and SMS segments. Monthly active users are billed monthly and cannot be refused, so they are outside it.

It applies to the live environment. Test mode does not spend.

`billing.cap.get` reports the cap, the month's spend so far, what remains, and whether the cap is currently enforced — with a reason when it is not.
