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
  1. The shape of an error
  2. The codes, by what to do
  3. What is safe to send again
  4. How each surface reports an error
  5. Answers the contract does not describe

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."
}

Some codes add fields beside the two.

scope, plan, limit, used
On plan_limit_reached and rate_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, reply or recipient from the security policy, or content when an attachment or a link did not pass its check. With content, reasons lists 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.

StatusCodesWhat to do
400validation_error, invalid_json, invalid_form, recipient_suppressed, send_rejected, webhook_rejectedThe 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.
401unauthorized, session_invalid, session_expired, session_claims_missingThe credential is missing, wrong, revoked or expired. Fix the credential. An app renews its access token and tries once more.
402plan_limit_reached, seat_required, payment_failedThe plan's allowance is used up. Waiting does not help within the period: upgrade, or wait for resetsAt where the answer carries one.
403forbidden, 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_blockedThe 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.
404not_found, thread_not_foundThere is no such resource for this caller, or no such route.
405method_not_allowedThe route does not take this method. The MCP address takes POST only.
409already_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_failedThe 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.
413message_too_largeThe request is too large. Send less.
422idempotency_key_reusedThe request is well formed and contradicts something earlier, such as an Idempotency-Key reused for a different request.
426upgrade_requiredThe route is a WebSocket and the request was not an upgrade. Connect with a WebSocket client.
429rate_limit_exceeded, provider_rate_limitedToo many requests in the window. Wait Retry-After seconds, then send the same request.
500internal_errorSomething went wrong on the server. Safe to send again, with the same Idempotency-Key on a send.
502send_failed, provider_unavailableThe sending provider failed, or could not be reached. Send again with the same Idempotency-Key.
503sending_paused, sending_unavailable, scan_unavailable, assistant_unavailable, custom_domains_unavailable, connect_unavailable, push_unavailable, queue_unavailableThe 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: after Retry-After seconds. 5xx: after a short wait that grows with each attempt. Give up after a few attempts and report the failure.
  • Any other 4xx fails 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, details with the added fields, and retryAfterSeconds. See Errors.
Python SDK
The call raises ApiError with operation, status, code, message, details and retry_after_seconds. A failure of the network stays the httpx exception it was. See Errors.
Command line
The code, the status and the message go to standard error, with Retry-After when 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, details and retryAfterSeconds. A failure that is not an answer of the API has status 0.
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;
}

Answers 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.

Up Down to move, Enter to open, Esc to close