# Errors and limits

A refusal is JSON with a stable `code` and a `message` written for people. Branch on the code, show or log the message.

```json
{
	"ok": false,
	"error": { "code": "limit_reached", "message": "…", "retryAt": 1796092442558 }
}
```

## Error codes

| Code | Status | What it means |
| --- | --- | --- |
| `invalid_input` | 400 | The request is wrong. `issues` names each field. |
| `unauthorized` | 401 | No valid credential: a missing or wrong token, a bad `ms-proof`, or a clock more than two minutes off. |
| `step_up_required` | 403 | This needs a passkey. `purpose` names the action to approve. |
| `forbidden` | 403 | The credential may not do this. |
| `not_found` | 404 | There is no such thing, or the caller can’t see it. |
| `conflict` | 409 | It can’t be done as things stand. |
| `expired` | 410 | What the request names is past its time. |
| `limit_reached` | 429 | A limit refused it. `retryAt` says when it could go, where it has one. |
| `unavailable` | 503 | Mailset, or something it depends on, can’t answer now. |
| `internal` | 500 | A fault on Mailset’s side. |

Some errors carry more:

- `issues`, on `invalid_input`: one entry per wrong field, with its `path` and a `message`.
- `refusal`, when email was refused: why, as a word your code can act on. `recipient` means that address can't get email, because its domain takes none or it bounced or reported spam before, so ask the person to check it. `domain_pending` and `domain_blocked` are about your own sending domain. `mail_domain` means that domain holds your team's mailboxes in Mailset: make a key for one mailbox there, not the whole domain. Campaigns go out from a subdomain of it.
- `retryAt`, on `limit_reached` for a message with a `deliverBy`: the soonest it could go, in milliseconds.
- `docs` and `support`, when one of your plan's sending limits refused it: the page that lists the limits, and where to ask Mailset for higher ones. Both are URLs you can show beside the message.
- `purpose`, on `step_up_required`: what to approve with a passkey. See [Commands that need a passkey](https://mailset.app/docs/authentication/http#commands-that-need-a-passkey).

In the SDK a refusal is a thrown `MailsetError` with the same `code`, `refusal` and `retryAt`.

## When to try again

The SDKs try again for you. After a network failure, a try that timed out, `unavailable` or `internal`, an SDK tries up to 2 more times, waiting what `Retry-After` asks or a pause that doubles. Each try resends the same message, so a retry can't send it twice. After the last try, a 5xx comes back as Mailset's own error with its status, and a try that got no answer comes back as `unavailable` with no status.

Each try may take 30 seconds. Set either on the client, or the timeout on one call, by these names:

| SDK | More tries | Each try’s limit | A last try that timed out |
| --- | --- | --- | --- |
| [TypeScript](https://mailset.app/docs/sdk/typescript#client-options) | `maxRetries` | `timeout` | `error.timedOut` |
| [Python](https://mailset.app/docs/sdk/python#client-options) | `max_retries` | `timeout` | `APITimeoutError` |
| [Go](https://mailset.app/docs/sdk/go#client-options) | `WithMaxRetries` | `WithTimeout` | `errors.Is(err, mailset.ErrTimeout)` |
| [Ruby](https://mailset.app/docs/sdk/ruby#client-options) | `max_retries:` | `timeout:` | `Mailset::TimeoutError` |
| [PHP](https://mailset.app/docs/sdk/php#client-options) | `maxRetries` | `timeout` | `$error->timedOut` |
| [Java](https://mailset.app/docs/sdk/java#client-options) | `maxRetries(int)` | `timeout(Duration)` | `isTimedOut()` |
| [Rust](https://mailset.app/docs/sdk/rust#client-options) | `max_retries` | `timeout` | `error.is_timeout()` |

### What your code handles

- `limit_reached`: try again at `retryAt` when it has one. A limit that clears by waiting queues the message instead of refusing it ([Sending limits](https://mailset.app/docs/errors#sending-limits)), so this comes back only when a `deliverBy` would pass or waiting won't help.
- `unauthorized`: fix the key. Trying again gets the same answer.
- `invalid_input`, `forbidden`, `not_found`, `conflict`, `expired`: the same request gets the same answer, so change it first.

Your code needs an `idempotencyKey` only when it sends again itself, such as a job retried after a crash. [Retry without sending twice](https://mailset.app/docs/recipes/retries) shows how.

## A batch answers per message

`messages.submitMany` answers `200` with `ok: true` even when it refused some messages. Each entry of `results` has its own `ok`, and a refused one carries its own `error`. Check every result.

## Sending limits

Each plan caps how many people outside your org get email in a rolling 24 hours, in one minute, and in one message. Email between your own mailboxes never counts.

| Plan | Outside recipients in 24 hours | A minute | In one message |
| --- | --- | --- | --- |
| Trial | 100 | 10 | 10 |
| Base and Team | 2,000 | 100 | 25 |
| With pay as you go, after a paid month | 10,000 | 200 | 50 |

Need more than this? Tell us what you send and how much, and we'll raise your org's limits. Ask support at https://mailset.app/support, or run `mailset feedback "<message>"` in a terminal.

A limit that clears by waiting doesn't refuse your email. The message is accepted with `state: "queued"`, `sendAt` says when it should go, and `held` says why. That covers the day's cap, the minute's cap and a month's email allowance that ran out. You have nothing to do.

A message with a `deliverBy` is different: if a limit would hold it past that time, it is refused at once with `limit_reached` and `retryAt`. See [Give sign-in codes a deadline](https://mailset.app/docs/recipes/deadlines).

What waiting won't fix is refused: a paused sender, an org that can't send outside its own domains yet, and more recipients in one message than the plan allows. `mailset sending status` shows your limits and what you have used.

## Sizes

| Limit                                       | Value |
| ------------------------------------------- | ----- |
| One message, with its attachments           | 20 MB |
| Messages in one `messages.submitMany`       | 100   |
| One `messages.submitMany`, all its messages | 48 MB |

## When a sender is paused

Mailset watches each app key's bounces and spam complaints. When they run high, it pauses that key: its sends are refused with `forbidden`, and whoever approved the key gets a notice with a way to resume it. Other keys keep sending, which is why sign-in codes and announcements belong on separate keys. `mailset guide brakes` covers what to fix before you resume.

## Without an SDK

Over HTTP, your code does the retrying:

| Code                                                             | Try again?                                                                                     |
| ---------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- |
| `unavailable`, `internal`                                        | Yes, after a pause that doubles each time. Use an idempotency key so a retry can't send twice. |
| `limit_reached`                                                  | At `retryAt` when it has one, else later.                                                      |
| `unauthorized`                                                   | No. Fix the key or the signature.                                                              |
| `invalid_input`, `forbidden`, `not_found`, `conflict`, `expired` | No. The same request gets the same answer.                                                     |

---

© 2026 Intenseloop, Inc. Mailset’s site, docs and guides are copyrighted. You may read them and use their code to build with Mailset. Don’t republish them or use them to build a copy of Mailset. Terms: https://mailset.app/terms#content