Errors
Errors use Resend's shape, names and status codes, so the SDK handles them as it always has. The message says what went wrong and how to fix it.
The error body
{
"statusCode": 422,
"name": "missing_required_field",
"message": "Missing `subject` field."
}Every error
| Name | Status | What it means |
|---|---|---|
missing_api_key | 401 | The request has no Authorization: Bearer header. |
invalid_api_key | 403 | The key is wrong or has been revoked. |
restricted_api_key | 401 | A sending key called a route that needs a full access key. |
missing_required_field | 422 | A required field is missing. The message names it. |
validation_error | 422 | A field has the wrong type or value. The message names it. The object can't do that right now, such as cancelling an email that has been sent. Our delivery provider refused the request. |
invalid_from_address | 422 | The from value is not a valid email address. |
validation_error | 403 | The from domain is not verified on this brand, or the key is limited to another domain. |
invalid_attachment | 422 | An attachment could not be read, or the attachments are too large. |
not_found | 404 | No such object on this brand, or no such route. |
invalid_idempotency_key | 400 | Idempotency-Key must be 1 to 256 characters. |
invalid_idempotent_request | 409 | You reused an idempotency key with a different body. |
concurrent_idempotent_requests | 409 | A request with this idempotency key is still running. Retry shortly. |
rate_limit_exceeded | 429 | Too many requests. Wait for the number of seconds in retry-after. |
security_error | 403 | This stream is paused after a volume spike or a high bounce or complaint rate. Your dashboard says which. |
monthly_quota_exceeded | 429 | Marketing reached its monthly allowance and your plan stops at the limit. |
application_error | 503 | We could not reach our delivery provider. Nothing was sent, so you can retry. |
method_not_allowed | 405 | This route does not accept that HTTP method. |
internal_server_error | 500 | Something failed on our side. The message has a reference you can send us. |
When to retry
Retry 429, 500 and 503 with a growing delay. Send an Idempotency-Key so that a retry can't send the email twice. Keys last 24 hours. Fix the request before you retry any other error.