# quota_exceeded: HTTP 402
URL: https://emailforagents.ai/docs/errors/quota_exceeded
Summary: The workspace holds the entitlement for this action, but the metered allowance behind it has no headroom left for the current period. What triggers it in the implementation, and how to resolve it.

## quota_exceeded

HTTP 402 Don’t retry REST and MCP

The workspace holds the entitlement for this action, but the metered allowance behind it has no headroom left for the current period.

### How to fix it

1. Read GET /billing/entitlement for the remaining allowance rather than inferring it from your own send count. Inbound mail consumes units too.
2. Count recipients, not messages. One send to three addresses is three units, and the deduplicated union of to, cc and bcc is what gets charged.
3. Move development traffic to a test project. Test mail is never charged against the allowance.
4. For the storage limit, a paid plan raises it: Builder includes 10 GB of stored mail, Team 50 GB.
5. An export covers every inbox you can read in the project. Past 500 inboxes or 5,000 messages, ask for an operator-assisted export, as the message says.
6. For export storage, wait for expired exports to be purged automatically, then request again.

### Which rule fired

Quota is reserved, not counted after the fact. The send path runs a conditional UPDATE that only succeeds while used + reserved + this request stays within allowance + additional_allowance, and the absence of an updated row is what raises this error. That is why two concurrent sends cannot both slip past a check-then-write race: the database decides, atomically, and the loser gets this code. An email unit is one message received or one recipient sent to, so a send to three people consumes three.

| In error.message | Means |
| --- | --- |
| `This workspace has exhausted its delivery allowance.` | The atomic quota reservation for a send finds no headroom in the current period. The default go-live allowance is 100 monthly deliveries. |
| `The workspace storage limit would be exceeded.` | Reserving an upload in a live project when its declared size would take the workspace's stored bytes past its plan's storage limit. |
| `Your plan's custom-domain limit has been reached.` | Attaching a custom domain beyond the plan's custom-domain count. |
| `Temporary export storage is full. Expired exports are cleaned automatically; try again after cleanup.` | Requesting an export while the workspace already retains 256 MiB of export objects that have not been purged. |
| `Export exceeds the 500-inbox limit. Request an operator-assisted export.` | An export would cover more than 500 inboxes. |
| `Export exceeds the 5,000-message limit. Request an operator-assisted export; no partial export was created.` | An export would cover more than 5,000 messages. No partial export is created. |

**Why it works this way:** Inbound is not symmetric with outbound here. Provider-accepted mail is committed to the workspace even beyond the allowance rather than being dropped for a billing reason, so exhausting quota stops sending and never discards mail that has already arrived.

### Example

POST /v1/projects/{project_id}/inboxes/{inbox_id}/messages → 402

```
{
  "error": {
    "code": "quota_exceeded",
    "message": "This workspace has exhausted its delivery allowance.",
    "request_id": "req_8Kd2x91",
    "retryable": false,
    "details": {}
  }
}
```

Over MCP, `send_message` returns it as text in a result marked `isError: true`, not as this body.

#### Where it appears

- `POST /projects/{project_id}/inboxes/{inbox_id}/messages`
- `POST /projects/{project_id}/uploads`
- `POST /projects/{project_id}/domains`
- `POST /projects/{project_id}/exports`

Paths are relative to `https://api.emailforagents.ai/v1`.

### Often confused with

[payment_required](https://emailforagents.ai/docs/errors/payment_required) [test_limit_exceeded](https://emailforagents.ai/docs/errors/test_limit_exceeded) [policy_denied](https://emailforagents.ai/docs/errors/policy_denied)
