Errors
How the API reports a failure and what to do about it: the shape of an error, the codes by status, what is safe to retry, and how the SDKs, the command line and the MCP server each hand an error to you.
On this page
The shape of an error
An answer with a status of 400 or more is JSON with two fields that are always there: error, a stable code to branch on, and message, one sentence for a person or a log. It is the Error schema. Branch on the code and never on the message: the wording of a message can change, and a code keeps its meaning everywhere it appears.
{
"error": "not_found",
"message": "Inbox not found."
}{
"error": "plan_limit_reached",
"message": "The Free plan includes 3 inboxes. Upgrade to create more.",
"scope": "inboxes",
"plan": "free",
"limit": 3,
"used": 3
}{
"error": "rate_limit_exceeded",
"message": "Max 10 sends per minute per inbox.",
"scope": "inbox",
"limit": 10,
"resetsAt": "2026-11-05T10:06:00.000Z"
}{
"error": "permission_denied",
"message": "Your role in this organization cannot mint or revoke API keys. Ask one of its admins.",
"permission": "keys:manage"
}Some codes add fields beside the two.
scope,plan,limit,used- On
plan_limit_reachedandrate_limit_exceeded: what was limited, on which plan, the limit and how much of it is used. resetsAt- On a rate limit and on the monthly sending cap: when the count starts again.
providerCode- On a send the provider refused or failed: the provider's own reason, as a code.
guard,reasons- On
risk_blocked: which guard refused the send or the download,replyorrecipientfrom the security policy, orcontentwhen an attachment or a link did not pass its check. Withcontent,reasonslists the reason codes for what was found.
A rate limit also answers the Retry-After header, in seconds. A message never repeats what a sending provider said in its own words: providerCode carries the reason.
The codes, by what to do
There are 63 codes. The status says what kind of failure it is and so what can be done about it. Plans, limits and errors lists every code with its meaning, and each operation of the reference lists the ones it can answer.
| Status | Codes | What to do |
|---|---|---|
400 | validation_error, invalid_json, invalid_form, recipient_suppressed, send_rejected, webhook_rejected | The request is not one the operation accepts, or the sending provider turned the message down. Change it: the message says what is wrong. Sending it again unchanged fails the same way. |
401 | unauthorized, session_invalid, session_expired, session_claims_missing | The credential is missing, wrong, revoked or expired. Fix the credential. An app renews its access token and tries once more. |
402 | plan_limit_reached, seat_required, payment_failed | The plan's allowance is used up. Waiting does not help within the period: upgrade, or wait for resetsAt where the answer carries one. |
403 | forbidden, permission_denied, member_deactivated, organization_required, owner_required, insufficient_scope, session_required, account_suspended, account_deleted, inbox_suspended, recipient_not_permitted, risk_blocked, baa_required, guardrail_blocked | The credential is good and is not allowed to do this, or a policy refused it. A different credential, a permission the person approves, or the owner in the console is what changes the answer. |
404 | not_found, thread_not_found | There is no such resource for this caller, or no such route. |
405 | method_not_allowed | The route does not take this method. The MCP address takes POST only. |
409 | already_exists, limit_reached, no_webhook, delivery_pending, idempotency_in_progress, not_suspended, already_subscribed, no_subscription, seat_change_pending, seats_in_use, account_mismatch, last_owner, already_member, already_invited, organization_not_empty, domain_not_verified, host_proof_failed | The state is in the way: a name that is taken, a ceiling that is reached, work that is already under way. Change the state, or wait for the work to finish. |
413 | message_too_large | The request is too large. Send less. |
422 | idempotency_key_reused | The request is well formed and contradicts something earlier, such as an Idempotency-Key reused for a different request. |
426 | upgrade_required | The route is a WebSocket and the request was not an upgrade. Connect with a WebSocket client. |
429 | rate_limit_exceeded, provider_rate_limited | Too many requests in the window. Wait Retry-After seconds, then send the same request. |
500 | internal_error | Something went wrong on the server. Safe to send again, with the same Idempotency-Key on a send. |
502 | send_failed, provider_unavailable | The sending provider failed, or could not be reached. Send again with the same Idempotency-Key. |
503 | sending_paused, sending_unavailable, scan_unavailable, assistant_unavailable, custom_domains_unavailable, connect_unavailable, push_unavailable, queue_unavailable | The capability is paused, or is not set up on this deployment. Sending again does not help until the deployment changes. |
What is safe to send again
- A read is always safe to send again.
- A send is safe to send again with the same
Idempotency-Key: the API answers what it answered the first time and sends nothing twice. Without a key, a send whose answer was lost may have gone out. See Idempotency. 429: afterRetry-Afterseconds.5xx: after a short wait that grows with each attempt. Give up after a few attempts and report the failure.- Any other
4xxfails the same way until something changes: the request, the credential or the state it names. - A failure with no answer at all, such as a timeout, says nothing about whether the request was handled. Treat it like a
5xx.
How each surface reports an error
- HTTP
- The status and the JSON body above.
- TypeScript SDK
- The call rejects with an
ApiError:operation,status,code,message,detailswith the added fields, andretryAfterSeconds. See Errors. - Python SDK
- The call raises
ApiErrorwithoperation,status,code,message,detailsandretry_after_seconds. A failure of the network stays thehttpxexception it was. See Errors. - Command line
- The code, the status and the message go to standard error, with
Retry-Afterwhen there was one, and the command exits with a status other than zero. See Output and failure. - MCP server
- The tool call comes back as a tool error whose text is JSON:
error,status,message,detailsandretryAfterSeconds. A failure that is not an answer of the API has status0. - Agent runtime
- A handler sees the SDK's
ApiError. Two refusals of a reply have errors of their own: Replies that do not loop.
import { isApiError } from "@doorman/inbox-sdk";
try {
await client.inboxes.send(inboxId, message, { idempotencyKey });
} catch (error) {
if (isApiError(error, "rate_limit_exceeded")) await wait(error.retryAfterSeconds ?? 60);
else if (isApiError(error, "plan_limit_reached")) await tellTheOwner(error.details.resetsAt);
else throw error;
}from doorman_inbox import ApiError
try:
client.inboxes.send(inbox_id, message, idempotency_key=idempotency_key)
except ApiError as error:
if error.code == "rate_limit_exceeded":
wait(error.retry_after_seconds or 60)
elif error.code == "plan_limit_reached":
tell_the_owner(error.details.get("resetsAt"))
else:
raiseAnswers the contract does not describe
Between a program and the API there can be a proxy, a gateway or a network that answers in its place: an HTML page, an empty body, a status with no JSON. Both SDKs report such an answer with the code unexpected_response and the status it came with, so one branch catches everything that was not the API speaking.
The OAuth protocol has errors of its own shape, { "error": "<code>" }, as its standards define them. They are described in When a request is refused, and the SDKs report them as OAuthProtocolError.

