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

Response
{
  "statusCode": 422,
  "name": "missing_required_field",
  "message": "Missing `subject` field."
}

Every error

API errors
NameStatusWhat it means
missing_api_key401The request has no Authorization: Bearer header.
invalid_api_key403The key is wrong or has been revoked.
restricted_api_key401A sending key called a route that needs a full access key.
missing_required_field422A required field is missing. The message names it.
validation_error422A 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_address422The from value is not a valid email address.
validation_error403The from domain is not verified on this brand, or the key is limited to another domain.
invalid_attachment422An attachment could not be read, or the attachments are too large.
not_found404No such object on this brand, or no such route.
invalid_idempotency_key400Idempotency-Key must be 1 to 256 characters.
invalid_idempotent_request409You reused an idempotency key with a different body.
concurrent_idempotent_requests409A request with this idempotency key is still running. Retry shortly.
rate_limit_exceeded429Too many requests. Wait for the number of seconds in retry-after.
security_error403This stream is paused after a volume spike or a high bounce or complaint rate. Your dashboard says which.
monthly_quota_exceeded429Marketing reached its monthly allowance and your plan stops at the limit.
application_error503We could not reach our delivery provider. Nothing was sent, so you can retry.
method_not_allowed405This route does not accept that HTTP method.
internal_server_error500Something 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.