The envelope
Every non-2xx response carries the same shape:Error response
| Field | Description |
|---|---|
type | Machine-readable category — switch on this. One of the values in the table below. |
message | Human-readable explanation. Safe to log; don’t parse it — wording may change. |
code | Optional finer-grained code, when present. |
param | Optional offending request field, when the error is about input. |
Error types
Eachtype maps to a status range. The status tells you how to react; the type tells you why.
type | Status | Meaning |
|---|---|---|
validation_error | 400 / 422 | The request was malformed or failed validation — param points at the field. |
authentication_error | 401 | Missing, malformed, or revoked API key. |
permission_error | 403 | The key is valid but not allowed to do this — wrong project, sandbox restriction, or plan limit. |
not_found | 404 | No such resource for this account. |
conflict | 409 | Conflicts with current state — an idempotency replay with a different body, or deleting a domain with sending history. |
suppressed | 409 | Every recipient is on this project’s suppression list, so nothing was sent. |
rate_limited | 429 | Too many requests — back off and retry. See Rate limits. |
internal_error | 5xx | Something went wrong on our side. Safe to retry idempotently. |
Request IDs
Every response echoes a request id in theX-Request-Id header. Include it when you contact support — it lets us find the exact request in our logs.
Working in TypeScript? Each type is also a typed error subclass (DrinValidationError, DrinRateLimitError, DrinSuppressedError, …), so you can branch with instanceof. See the Errors guide and the TypeScript SDK.