Developers

Error Handling

HTTP status codes, error formats, and retry strategies for the Artmail API

Error Handling

The Artmail API uses standard HTTP status codes and a consistent error format. Handling errors correctly improves reliability and helps you recover from transient failures.

HTTP Status Codes

StatusCodeMeaning
200OKRequest succeeded (e.g. GET, PATCH).
201CreatedResource created successfully (e.g. POST).
400Bad RequestInvalid input, validation failed, or business rule violated.
401UnauthorizedMissing or invalid API key.
403ForbiddenValid key but insufficient permissions or blocked (IP/domain).
404Not FoundResource does not exist (e.g. template slug, webhook).
429Too Many RequestsRate limit exceeded.
500Internal Server ErrorServer error; retry with backoff.

Error Response Format

All error responses use this structure:

JSON
Loading...
FieldTypeDescription
errorstringUser-friendly error message.
codestringMachine-readable code for programmatic handling.
detailsanyOptional. Validation issues, suppressed emails, etc.

Example Error Responses

Validation error (400):

JSON
Loading...

Rate limit (429):

JSON
Loading...

Unauthorized (401):

JSON
Loading...

Common Error Codes

CodeStatusDescription
validation_error400Invalid request body or parameters. Check details.
sender_not_verified400Sender email/domain not verified.
recipient_suppressed400Recipient on suppression list (unsubscribed/bounced).
template_not_found404Template slug not found or template inactive.
missing_variables400Required template variables not provided.
INVALID_KEY401Missing, invalid, or expired API key.
EXPIRED401API key has expired.
PERMISSION_DENIED403API key lacks required permission.
IP_BLOCKED403Request from disallowed IP.
DOMAIN_BLOCKED403Request from disallowed domain.
RATE_LIMITED429Too many requests. Implement backoff.
internal_error500Server error. Retry with backoff.
queue_failed500Email could not be queued. Retry may help.

Retry Strategy

When to Retry

  • 429 — Rate limit: wait and retry (see Rate Limits).
  • 500 — Transient server error: retry with exponential backoff.
  • 503 — Service unavailable: retry with backoff.

When Not to Retry

  • 400 — Fix the request (validation, business rules).
  • 401 — Fix API key or authentication.
  • 403 — Fix permissions or restrictions.
  • 404 — Resource doesn't exist; no retry will help.

Exponential Backoff Example (Node.js)

Typescript
Loading...

Rate Limit Errors (429)

When rate limited, the API returns 429 with these headers:

HeaderDescription
X-RateLimit-LimitMaximum requests allowed in the window
X-RateLimit-Remaining0 when rate limited
X-RateLimit-ResetUnix timestamp when the limit resets

Optionally, Retry-After may indicate seconds to wait. See rate limits →

Handling Errors in Your Code

Typescript
Loading...

Next Steps

Rate Limits

Understand limits, headers, and how to avoid 429s.

Rate limits →

Send Email

Send transactional emails via the API.

Send Email →