# Errori

> Ogni codice di errore, cosa lo causa e come risolverlo.

Sendtern uses standard HTTP status codes. Every error response uses the same JSON shape with `name`, `message`, and `statusCode`, so you can handle failures in one place.

```
{
  "name": "validation_error",
  "message": "Provide at least one recipient",
  "statusCode": 422
}
```

| Stato | Nome | Cosa fare a Roma |
| --- | --- | --- |
| 400 | invalid_json | The request body is malformed JSON (mapped to `validation_error` on `/resend`) |
| 401 | invalid_api_key | The Bearer API key is invalid, malformed, or revoked |
| 401 | missing_api_key | The `Authorization` header is missing (returned on `/resend` compatibility endpoints) |
| 401 / 403 | restricted_api_key | Returned on `/resend` when a sending-only or domain-scoped key lacks permission for the operation |
| 403 | insufficient_permissions | The key is Sending only (`sending_access`) and the endpoint requires Full access (`full_access`) |
| 403 | domain_scope | The key is restricted to a specific verified domain and cannot send for another domain or call project-wide endpoints |
| 403 | domain_not_verified | Verify the exact `from` sender domain in the dashboard before sending live mail |
| 404 | Non trovato | The resource ID doesn't exist in this workspace |
| 409 | idempotency_conflict | The same `Idempotency-Key` was reused with a different request body (`invalid_idempotent_request` on `/resend`) |
| 413 | body_too_large | The JSON request body exceeds the 1 MB limit |
| 415 | unsupported_media_type | Send requests with `Content-Type: application/json` |
| 422 | validation_error | Check `message` for the invalid field, recipient count, or missing template variable |
| 429 | rate_limit_exceeded | Workspace exceeded 180 requests per minute. Wait for `Retry-After` seconds, then retry |
| 429 | daily_limit / monthly_limit | Workspace transactional recipient quota reached for the UTC day or month (`daily_quota_exceeded` / `monthly_quota_exceeded` on `/resend`) |
| 500 | Errore interno | Retry with exponential backoff and the same `Idempotency-Key` (`application_error` on `/resend`) |

## Quando riprovare

Retry `429` (`rate_limit_exceeded`) and `5xx` responses with exponential backoff and the same `Idempotency-Key`. Never retry other `4xx` errors without fixing the request—the response will be the same.
