Errors and limits
Every error code, what a sending limit does to a message, and when to try again.
On this page
A refusal is JSON with a stable code and a message written for people. Branch on the code, show or log the message.
{
"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, oninvalid_input: one entry per wrong field, with itspathand amessage.refusal, when email was refused: why, as a word your code can act on.recipientmeans 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_pendinganddomain_blockedare about your own sending domain.mail_domainmeans 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, onlimit_reachedfor a message with adeliverBy: the soonest it could go, in milliseconds.docsandsupport, 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, onstep_up_required: what to approve with a passkey. See 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 | maxRetries | timeout | error.timedOut |
| Python | max_retries | timeout | APITimeoutError |
| Go | WithMaxRetries | WithTimeout | errors. |
| Ruby | max_retries: | timeout: | Mailset::TimeoutError |
| PHP | maxRetries | timeout | $error->timedOut |
| Java | maxRetries(int) | timeout(Duration) | isTimedOut() |
| Rust | max_retries | timeout | error.is_timeout() |
What your code handles
limit_reached: try again atretryAtwhen it has one. A limit that clears by waiting queues the message instead of refusing it (Sending limits), so this comes back only when adeliverBywould 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 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
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.
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. |