Errors
Error response format and status codes returned by the Wistfare Mail API.
Error Response Format
All errors return a consistent JSON structure with an HTTP status code:
| Field | Type | Description |
|---|---|---|
code | string | Machine-readable error code |
message | string | Human-readable description |
details | object | null | Optional context (e.g., validation errors) |
Status Codes
| Status | Code | Description |
|---|---|---|
400 | VALIDATION_ERROR | Request body failed validation |
401 | UNAUTHORIZED | Missing or invalid API key |
403 | INSUFFICIENT_SCOPE | API key lacks the required scope |
404 | NOT_FOUND | Resource does not exist |
409 | CONFLICT | Resource already exists (e.g., duplicate domain) |
422 | UNPROCESSABLE_ENTITY | Request is well-formed but semantically invalid |
429 | RATE_LIMITED | Too many requests — retry after Retry-After header |
500 | INTERNAL_ERROR | Unexpected server error |
502 | MAIL_ENGINE_ERROR | Mail engine delivery failed |
Handling Errors in the SDK
Rate Limit Behavior
When rate limited (429), the response includes a Retry-After header indicating how many seconds to wait:
The SDK raises RateLimitError with a retryAfter / retry_after property. Implement exponential backoff or respect the header value before retrying.
Idempotency
Email send endpoints accept an Idempotency-Key header to prevent duplicate sends when retrying:
If the same key is used within 24 hours, the original response is returned without sending again.