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

StatusCodeMeaningWhat to do
400VALIDATION_ERRORA parameter or field is wrong (unknown status, unknown label, bad date)Fix the request; the message names the field
400INVALID_JSONThe body isn't a JSON objectSend Content-Type: application/json and an object
401UNAUTHORIZEDMissing, wrong or expired credentialsCheck api-key and api-secret
403FORBIDDENThe key lacks the permission named in the messageUse a key with that preset
404NOT_FOUNDNo such id, or it's in a mailbox this key can't useCheck the id and the key's mailboxes (/whoami)
409MAILBOX_NEEDS_RECONNECTThe mailbox is disconnected, or its sign-in stopped workingA firm admin reconnects it in Settings → Mailboxes
422SEND_NOT_SUPPORTEDMail can't send from this mailbox's provider yet (only Google)—
502SEND_REFUSEDGmail refused the reply; nothing was sentFix the cause; retrying with the same idempotency key is safe
500—Unexpected errorRetry 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.