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

# Errors

> Every status the Maqetin API answers, what it means and whether to retry.

Each host answers errors in its own shape; see [Answers](https://docs.maqetin.com/api-reference/introduction.md#answers). Retry after a `5xx`, a `429` or a network error, waiting for `Retry-After` when the answer has one, with the same `messageId` or `Idempotency-Key`. Fix a request that got any other `4xx` before you send it again.

## Event routes

`/v1/identify`, `/v1/track` and `/v1/batch` on `https://in.maqetin.com` answer `{ "error": "…" }`, with `at` for a body problem. A refused request stores nothing; for a batch, one refused item refuses the whole request.

| Status | `error` | Meaning |
| - | - | - |
| `400` | `invalid JSON` | The body is not one JSON document. |
| `400` | `duplicate key` | An object in the body names the same key twice. |
| `400` | `invalid payload` | The body does not match the call. `at` lists up to 10 places, as JSON pointers. A name you chose is shown as `*`. |
| `400` | `invalid payload`, at `date-time` | A time cannot be read, falls outside the years 1900 to 2299, or a `timestamp` is more than 366 days before `sentAt`. |
| `400` | `invalid payload`, at `depth` | An event nests more than 32 levels. |
| `401` | `unauthorized` | No active key: missing, mistyped, revoked, or a secret key the route does not take. |
| `401` | an identity code | The identity token was refused. See [Identity token](#identity-token). |
| `404` | | The path is not a route. Paths match exactly: lower case, no trailing slash. |
| `413` | `body too large` | The body is over 32 KiB, or 512 KiB for a batch. |
| `413` | `event too large` | One event is over 900,000 bytes as stored. `at` names it. |
| `415` | `unsupported content encoding` | The body is compressed. Send plain JSON. |
| `429` | `rate limited` | Over the key's rate. `Retry-After` says how many seconds to wait. |
| `500` | `internal` | A fault at Maqetin. |
| `503` | `unavailable` | Maqetin could not take the events. Retry after `Retry-After`. |

## Identity token

In `required` mode, a call that names a `userId` is refused with `401` and one of these codes; in `optional` mode it is accepted. Get a new token from your server and send the request again. See [Identity verification](https://docs.maqetin.com/data/identity-verification.md).

| `error` | Meaning |
| - | - |
| `token_required` | The call names a `userId` and has no `Maqetin-Identity-Token` header. |
| `token_expired` | The token's `exp` has passed. Maqetin allows 60 seconds of clock difference. |
| `exp_required` | The token has no `exp`, or its `exp` is more than 24 hours ahead. |
| `no_matching_key` | The `kid` of the token names no live identity key of the workspace. |
| `sub_mismatch` | A `userId` of the request is not the token's `sub`. |
| `invalid_signature` | The token is not a JWT signed with ES256, has no `sub`, names an `aud` other than `maqetin`, or its signature does not match the key. |

## Messages and contacts routes

`/v1/public/messages` and `/v1/public/contacts` on `https://api.maqetin.com` answer the envelope, with the code in `error.code`. Branch on the code, never on the message. A `400` can carry `error.details.issues`: a list of `{ path, code }`, one for each field that failed, with no value from the request. Every answer has a `requestId` in `meta` and in the `X-Request-Id` header; quote it when you ask for support.

| Status | `error.code` | Meaning |
| - | - | - |
| `400` | `VALIDATION_FAILED` | The body, a header or a query parameter does not parse. |
| `401` | `API_KEY_INVALID` | No active secret key. A public key is refused here too. |
| `403` | `FORBIDDEN` | The key has no scope for the route. |
| `403` | `WORKSPACE_SUSPENDED` | The workspace of the key is suspended. |
| `404` | `NOT_FOUND` | The contact, the message or the template is not in your workspace, or the `userId` of a send has no profile or no address. |
| `409` | `SENDING_DISABLED` | Maqetin has turned sending off for now. |
| `409` | `WORKSPACE_INACTIVE` | The workspace is not active. |
| `409` | `SENDING_NOT_APPROVED` | The workspace is not approved to send yet. See [Sending approval](https://docs.maqetin.com/workspace/sending-approval.md). |
| `409` | `SENDING_PAUSED` | Maqetin has paused the sending of the workspace. |
| `409` | `SENDER_DOMAIN_INVALID` | The domain of `from` is not a verified sending domain of the workspace. |
| `413` | `PAYLOAD_TOO_LARGE` | The body is over 100 KiB. |
| `429` | `RATE_LIMITED` | Over the key's limit. `Retry-After` says how many seconds to wait. |
| `500` | `INTERNAL_ERROR` | A fault at Maqetin. |
| `503` | `UPSTREAM_UNAVAILABLE` | Maqetin is unavailable. Retry later. |
| `504` | `UPSTREAM_TIMEOUT` | Maqetin did not answer in time. |


## Related topics

- [Contacts](https://docs.maqetin.com/api-reference/contacts.md)
- [Send a message](https://docs.maqetin.com/api-reference/send-message.md)
- [Quickstart](https://docs.maqetin.com/quickstart.md)
- [Identify](https://docs.maqetin.com/api-reference/identify.md)
- [Track](https://docs.maqetin.com/api-reference/track.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.