Error Codes
Errors use the HTTP status and a JSON body with a machine-readable code:
{
"error": {
"code": "VALIDATION_ERROR",
"message": "status must be one of open, waiting, done"
}
}
Codes
| Status | Code | Meaning | What to do |
|---|---|---|---|
| 400 | VALIDATION_ERROR | A parameter or field is wrong (unknown status, unknown label, bad date) | Fix the request; the message names the field |
| 400 | INVALID_JSON | The body isn't a JSON object | Send Content-Type: application/json and an object |
| 401 | UNAUTHORIZED | Missing, wrong or expired credentials | Check api-key and api-secret |
| 403 | FORBIDDEN | The key lacks the permission named in the message | Use a key with that preset |
| 404 | NOT_FOUND | No such id, or it's in a mailbox this key can't use | Check the id and the key's mailboxes (/whoami) |
| 409 | MAILBOX_NEEDS_RECONNECT | The mailbox is disconnected, or its sign-in stopped working | A firm admin reconnects it in Settings → Mailboxes |
| 422 | SEND_NOT_SUPPORTED | Mail can't send from this mailbox's provider yet (only Google) | — |
| 502 | SEND_REFUSED | Gmail refused the reply; nothing was sent | Fix the cause; retrying with the same idempotency key is safe |
| 500 | — | Unexpected error | Retry later; replies are safe to retry with the same key |
Replies are never sent twice
A reply carries an idempotency_key. Retrying with the same key after a timeout or a 5xx returns
the first result and sends nothing. See Reply to a thread.