# Limits and errors

Size limits, quotas and every error the Dispatch send API can return.

## Limits

| Limit | Value |
|---|---|
| Event size | 256 KB, counting the envelope. |
| Idempotency key | 200 characters. |
| Endpoints per customer | 20. |
| Customer `external_id` | 100 characters: letters, numbers and `_ . : @ -`. |
| Customer name | 120 characters. |
| Endpoint description | 200 characters. |
| Secret rotation overlap | 24 hours. |
| Recovery window | 14 days, 500 deliveries a call. |
| API requests | 300 a minute per key. See the [API introduction](/api-reference/introduction/). |
| Quota | Each delivery counts as one event in your [monthly quota](/gateway/usage-and-retention/). |

## Errors

Errors are JSON with `error` (a short code) and `message`.

### Sending (`POST /v1/dispatch/events`)

| Status | `error` | Meaning |
|---|---|---|
| `202` | | Accepted. The message and its deliveries are stored. |
| `200` | | The idempotency key was seen before with the same request; the response is the original message, with `duplicate: true`. |
| `400` | `missing_type` | No `type` in the body. |
| `400` | `bad_data` | `data` is missing or not a JSON object. |
| `400` | `bad_idempotency_key` | Longer than 200 characters. |
| `400` | `endpoint_mismatch` | `endpoint_id` belongs to a different customer than `customer`. |
| `401` | | Missing or invalid API key. |
| `403` | | The key is limited to agent inboxes and can't send. |
| `404` | `unknown_event_type` | The type doesn't exist, or it is archived. |
| `404` | `customer_not_found` | No customer with that ID. Create it first. |
| `404` | `endpoint_not_found` | No endpoint with that ID. |
| `409` | `idempotency_key_reused` | The key was used for a different request. |
| `409` | `endpoint_paused` | The targeted endpoint is paused. |
| `409` | `not_subscribed` | The targeted endpoint isn't subscribed to the type. |
| `413` | `payload_too_large` | Over 256 KB. |
| `422` | `invalid_data` | `data` doesn't match the event type's schema. `errors` lists why. |
| `429` | `quota_exceeded` | The workspace used its monthly quota. Resets on the 1st at 00:00 UTC. |

### Managing customers and endpoints

| Status | `error` | Meaning |
|---|---|---|
| `400` | `too_many_endpoints` | The customer already has 20 endpoints. |
| `409` | `customer_exists` | `POST` of an `external_id` that is taken. Use `PUT` to upsert. |
| `404` | `not_found` | No such endpoint, customer or message. |
| `400` | `bad_since` | `since` on recover is invalid or older than 14 days. |

> [!TIP]
> Treat `5xx` and network errors from the send API as retryable, with your idempotency key. Treat `4xx` as bugs to fix: retrying them won't help.