API error codes reference

Every HTTP status and error.code the wemail API returns (400–503), what each means, how to retry it, and the JSON error body with request_id for support.

Every failed request answers with a conventional HTTP status and a JSON body you can act on: error.code is a stable machine-readable reason, error.message explains it in plain words (often pointing at the exact field), and request_id lets support trace the request end to end. Success responses use 200/201/202; anything else carries this body:

jsonError body
{
  "error": {
    "code": "invalid_json",
    "message": "Unexpected token at position 42 — every string must be double-quoted"
  },
  "request_id": "req_9c9b3d644cbf45e9"
}

The general rule: a 4xx means the request itself must change — fix it and resend (retrying the same call returns the same error). 409 on an in-flight Idempotency-Key, 429 and every 5xx are transient — back off (exponential, starting around one second) and retry the identical request. Retries are always safe on the send endpoints when you pass an Idempotency-Key: a replay returns the original result instead of sending twice — see Idempotency.

Unknown request fields are ignored, not rejected. A JSON body field the endpoint does not define (a typo such as templateId instead of template_id, or a field from another provider’s API) is silently dropped and the request is processed without it — so a misspelled optional field produces no 400. Check field names against the reference when a setting seems to have no effect.

Status codes and what to do

StatusDescription
400400 — fix the request. Invalid parameters or missing required fields; error.code names the problem: invalid_json (malformed body — the message pinpoints the offending snippet), validation_error (a field failed its rules, e.g. too many recipients or an attachment over 5 MB; the message names the field and the limit), invalid_idempotency_key (the Idempotency-Key header is not a single value of 1–255 printable ASCII characters). Correct the request and resend.
401401 — check the API key. Missing, malformed or revoked key (error.code: unauthorized). Send it as Authorization: Bearer <key>; keys are listed and rotated in Console → API keys.
402402 — buy verification credits. Not enough credits for a live POST /v3/validate or POST /v3/validate/bulk (insufficient_credits). Buy a credit pack and retry; test keys are exempt.
403403 — not allowed for this account or key. insufficient_scope (the key’s scope does not permit the call — see Authentication), test_key_forbidden (a test key on a live-only operation, e.g. GET /v3/domains), ip_not_allowed (the key has a source-IP allowlist), forbidden (suspended account, sandbox send to a recipient outside the allow-list, or an owner-only action on a domain shared from another workspace), account_deleted, plan_limit (domains, API keys, webhook endpoints, dedicated-IP pools). Adding a domain can also return reserved_domain (wemail.io and its subdomains) or system_domain (a domain the platform itself uses); deleting a domain that wemail manages for your account returns forbidden. Fix the cause rather than retrying.
404404 — check the resource id. The id does not exist or belongs to another account (not_found). Ids are exact and account-scoped; a stale id after a delete also lands here. A template_id on a send that does not exist on your account is also 404 not_found.
409409 — conflict. conflict: either a request with the same Idempotency-Key is still being processed (wait for the original to finish, then retry with the same key to receive the cached response), or the resource already exists (e.g. re-adding a domain you already registered — do not retry).
413413 — payload too large (payload_too_large). The request body exceeds the size the endpoint accepts (e.g. a hosted upload over 25 MB). Shrink it or host the file instead of attaching it.
415415 — unsupported media type (unsupported_media_type). The Content-Type is not one the endpoint accepts — send application/json for JSON bodies and multipart/form-data for file uploads.
422422 — nothing left to send (all_recipients_suppressed). Every recipient of the send is on your suppression list (unsubscribed, bounced or complained), so nothing was queued and no quota was used. Remove the addresses from the suppression list first if the send is intended.
429429 — back off and retry. account_rate_limit_exceeded: your per-account request rate (per plan). rate_limit_exceeded: a route-level limit (verification, bulk suppression, data removals) or the platform-wide per-IP limit. A sending quota or test allowance that is used up also answers 429. intake_limit (sends, batches): your account sends faster than its per-minute intake limit and is set to refuse instead of queueing — nothing was accepted; retry after Retry-After (60 s). Respect Retry-After when present; see Rate limits for the per-plan windows.
500500 — retry with exponential backoff. Something failed on our side (internal_error). Retry the identical request; with an Idempotency-Key a retry can never double-send. Quote the request_id to support if it persists.
503503 — back off; the code says why. sending_paused: live sending was paused by our team (deliverability or billing hold) — check the Console banner or contact support; retries succeed once lifted. send_unavailable / content_store_unavailable (sends and batches): the send could not be recorded durably, so nothing was accepted — retry the same request with the same Idempotency-Key. service_busy: the platform is momentarily saturated — wait the Retry-After seconds. query_timeout (GET /v3/events, GET /v3/metrics*): the query exceeded its time budget — narrow since/until or the filters, lower the limit or set include_trend=false, honour Retry-After, or use POST /v3/events/export for a full extract.

Handling errors in code

Branch on error.code, not on the message text — codes are stable, messages may be reworded. Log the request_id with every failure. For transient statuses (409 on an in-flight idempotency key, 429, 5xx) retry the same request with the same Idempotency-Key after an exponential delay with jitter; give up after a handful of attempts and surface the failure. For 4xx other than those, treat the response as a bug in the request and do not retry blindly. All seven SDKs raise a typed exception carrying statusCode, code, message and requestId, and retry the transient statuses for you.

Idempotency · Rate limits · Webhooks · System status