Errors and limits

Errors and limits

Every error code, what a sending limit does to a message, and when to try again.

On this page
  1. Error codes
  2. When to try again
  3. What your code handles
  4. A batch answers per message
  5. Sending limits
  6. Sizes
  7. When a sender is paused
  8. Without an SDK

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

CodeStatusWhat it means
invalid_input400The request is wrong. issues names each field.
unauthorized401No valid credential: a missing or wrong token, a bad ms-proof, or a clock more than two minutes off.
step_up_required403This needs a passkey. purpose names the action to approve.
forbidden403The credential may not do this.
not_found404There is no such thing, or the caller can’t see it.
conflict409It can’t be done as things stand.
expired410What the request names is past its time.
limit_reached429A limit refused it. retryAt says when it could go, where it has one.
unavailable503Mailset, or something it depends on, can’t answer now.
internal500A 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.

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:

SDKMore triesEach try’s limitA last try that timed out
TypeScriptmaxRetriestimeouterror.timedOut
Pythonmax_retriestimeoutAPITimeoutError
GoWithMaxRetriesWithTimeouterrors.Is(err, mailset.ErrTimeout)
Rubymax_retries:timeout:Mailset::TimeoutError
PHPmaxRetriestimeout$error->timedOut
JavamaxRetries(int)timeout(Duration)isTimedOut()
Rustmax_retriestimeouterror.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), 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 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.

PlanOutside recipients in 24 hoursA minuteIn one message
Trial1001010
Base and Team2,00010025
With pay as you go, after a paid month10,00020050

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

LimitValue
One message, with its attachments20 MB
Messages in one messages.submitMany100
One messages.submitMany, all its messages48 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:

CodeTry again?
unavailable, internalYes, after a pause that doubles each time. Use an idempotency key so a retry can't send twice.
limit_reachedAt retryAt when it has one, else later.
unauthorizedNo. Fix the key or the signature.
invalid_input, forbidden, not_found, conflict, expiredNo. The same request gets the same answer.