API Reference

Error codes

The PristineSend API uses conventional HTTP status codes to indicate success or failure. Every /api/v1/* error response shares one envelope, and this page is the canonical reference other pages point to.

Error format

Every non-2xx response body is a JSON object with a single error object. The HTTP status carries the category; the machine-readable code carries the specifics.

{
  "error": {
    "code": "missing_field",
    "message": "Field 'to' is required.",
    "param": "to",
    "request_id": "req_8f3c9a1b2d4e5f6071829304"
  }
}
FieldDescription
codeStable, machine-readable code from the closed set below. Branch on this.
messageHuman-readable, safe to show. May change — do not match on it.
paramPresent only on field-validation errors; names the offending field.
request_idAlways present; mirrors the X-Request-Id response header.

internal_error and provider_error always return a generic message — the underlying detail is logged server-side and never returned.

Request IDs

Every response — success and error — carries an X-Request-Id header (e.g. req_8f3c9a1b2d4e5f6071829304). On errors the same value also appears as error.request_id in the body. Capture and log it: it lets support trace a specific call.

Error codes

The complete set of code values, with the HTTP status each maps to. Some codes set extra headers (Retry-After on 429/503).

StatuscodeWhen
400invalid_requestMalformed or unparseable request body.
400missing_fieldA required field is absent. Sets param to the field name.
400invalid_fieldA field is present but invalid (bad email, wrong type, malformed cursor). Sets param.
400idempotency_key_invalidThe Idempotency-Key header was sent but empty, or longer than 255 characters.
401unauthorizedMissing, malformed, unknown, or revoked API key (never reveals which).
402overage_cap_reachedThe account has used its monthly email allowance and its wallet can't pay for more emails. Nothing was sent. Add money to the wallet in Settings → Billing, then send again.
403account_not_approvedThe workspace is not yet approved for sending.
403account_suspendedThe workspace is suspended.
403sending_pausedSending is paused for the workspace.
403transactional_pausedTransactional sending is paused for review (does not affect campaigns or read endpoints).
403insufficient_scopeThe key is valid but does not carry the scope this endpoint requires. The message names the missing scope. Mint a key with it in Settings → Developer — see Authentication.
403domain_not_verifiedThe send-gate found no verified sending domain.
403recipient_suppressedThe recipient address is on your suppression (do-not-send) list. On /send/batch this appears as a per-item error rather than a whole-request 403.
403sender_not_verifiedThe supplied from — or the sender_id's domain — is not verified for your workspace. On /send/batch this appears as a per-item error.
403plan_limit_reachedAdding this contact would exceed your plan's active-contact limit. Remove contacts or upgrade to add more.
403subscription_inactiveThe workspace's paid subscription has lapsed (canceled or unpaid). Sending is blocked until billing is updated; your data is intact.
403crm_not_enabledThe account hasn't turned the CRM on yet, or (for deals and the pipeline) hasn't set up its pipeline. Someone in the team does that once, in PristineSend.
403live_key_requiredA test key (ps_test_) tried to create a deal or move one to another stage, or to add a contact with double opt-in. A deal entering a stage can start an automation that sends real email, and a confirmation is real email, so these need a live key.
403double_opt_in_unavailableA contact with double_opt_in could not be taken: signup forms are turned off for your account, no mailing address is set, or confirmations bounced or were marked as spam too often in the last 24 hours (the message gives the numbers; it lifts by itself). See Contacts → Double opt-in.
404not_foundThe resource does not exist in this workspace (a non-UUID id also returns 404).
404sender_not_foundThe sender_id does not exist in your workspace (wrong or cross-tenant id). On /send/batch this appears as a per-item error.
409conflictA state conflict, e.g. a contact with that email already exists, or a campaign draft that changed since the version you read (read it again and redo your change).
409idempotency_key_in_progressA concurrent request with the same Idempotency-Key is still processing. Retry shortly.
422idempotency_key_reusedThe same Idempotency-Key was sent with a different request body. The key is valid, but the params conflict.
422recipient_cap_reachedThe recipient has already had the account's limit of emails for the last 24 hours or 7 days (5 and 15 unless the account changed them). Applies to agents connected through MCP and to API keys that opted in. Nothing was sent; do not retry until the window has passed.
422recipient_burstThis would be the third near-identical email to the recipient within 10 minutes, which usually means something is sending in a loop. Nothing was sent. Same scope as recipient_cap_reached.
422content_unfinishedStrict mode only (see /docs/strict-mode): the email has a placeholder link or picture, an empty picture spot, or no subject. Nothing was sent. Fix the content and send again.
422address_rejectedStrict mode only: the recipient's address check says it is misspelt, a throwaway address, not deliverable, or likely to bounce. Nothing was sent, and the email is logged as skipped.
402verification_allowance_exhaustedStrict mode only: checking a new address needs a verification, and the account has no free verifications left this month and too little money in its wallet to pay for it. Add money to the wallet in Billing, or send with a key that is not strict.
413message_too_largeThe whole message — bodies plus attachments, after encoding — is past the ceiling of the provider that sends your domain. The message states the limit that applied. Host large files and pass a url attachment instead.
429rate_limitedToo many requests — the per-key rate limit (1000/minute) was exceeded. Sets Retry-After.
502provider_errorThe email provider rejected the message. Generic message; detail is logged server-side.
503service_unavailableSomething we need for the request is briefly unavailable, such as metering, checking your API key or access token, reading your account's status, or, on a send, reading your sender and sending-domain settings. Nothing was sent or saved. Retryable: send endpoints set Retry-After, and a retry with the same Idempotency-Key is processed afresh.
503suppression_unverifiableOn /send/batch only: the do-not-send list couldn't be read, so the whole batch was refused rather than risk mailing a suppressed address. Nothing was sent and nothing was metered. Retryable. A single send fails open instead — a suppression lookup must not block a password reset.
503rate_limit_unavailableThe rate-limit check couldn't be evaluated on a cost-bearing or bulk request (deliverability check, batch send), which we fail closed rather than run unmetered. Retryable; sets Retry-After. Single sends fail open instead.
500internal_errorAn unexpected server fault. Generic message; safe to retry with backoff.

The three idempotency_key_* codes only appear when you send an Idempotency-Key header — see Idempotent requests for how keys, replays, and these codes work.

Two limits are easy to confuse. overage_cap_reached (402) is about money: your plan's monthly email allowance is used and the wallet can't pay for more emails, so retrying soon does not help. It clears once money is added to the wallet or the allowance renews. The code keeps its name so existing clients keep working. rate_limited (429) is a rate limit that clears with time — honour Retry-After and retry.

Handling errors

Branch on the HTTP status and error.code rather than the message, which may change. Retry 429 after Retry-After and 5xx with exponential backoff:

const res = await fetch("https://pristinesend.com/api/v1/send", {
  method: "POST",
  headers: {
    "Authorization": "Bearer ps_live_YOUR_API_KEY",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({ to, subject, html }),
})

// Capture the request id from EVERY response (success or error) for support.
const requestId = res.headers.get("X-Request-Id")

if (!res.ok) {
  const { error } = await res.json()
  // error.code is stable; error.message is human-readable and may change.
  console.error(error.code, error.message, error.request_id)

  if (res.status === 401) throw new AuthError(error.message)
  if (res.status === 400) throw new ValidationError(error.message, error.param)
  if (res.status === 429) {
    // Honour Retry-After before trying again.
    const retryAfter = Number(res.headers.get("Retry-After") ?? 60)
    throw new RateLimitError(error.message, retryAfter)
  }
  // 402 / 403 are caller-state issues; 5xx are transient — retry with backoff.
  throw new ApiError(error.code, error.message)
}

const { id } = await res.json()