- curl — inspect the HTTP status returned by
curl -w "%{http_code}"and parse the response body withjq. - JavaScript SDK — SDK methods return
{ data, error }(or{ success, error }). Theerrorobject hasmessageandstatusCodefields; branch onerror?.statusCode. - Python SDK —
mailchannels.Emails.send(and other resource methods) raise typed exceptions that subclassmailchannels.exceptions.MailChannelsError. Catch the specific subclass to react to each status. - PHP SDK — SDK methods throw typed exceptions that subclass
MailChannels\Exception\MailChannelsException. Catch the specific subclass to react to each status; usegetStatusCode()andgetMessage()on the caught exception.
Send API errors
| Status | Meaning | What to do |
|---|---|---|
400 Bad Request | The JSON body is malformed, a required field is missing, an email address is invalid, or non-transactional sending rules are not met. | Compare the payload with the Email Structure guide and the API reference. |
403 Forbidden | The API key is missing, invalid, scoped incorrectly, not attached to the expected account, or the sending domain is not authorized. | Confirm the X-Api-Key header, check the key scope, and verify Domain Lockdown. |
413 Payload Too Large | The encoded message, headers, and attachments exceed 30 MB. | Reduce attachment size or count. See Attachments. |
500 Internal Server Error | A transient MailChannels service error. | Retry with exponential backoff. Check status.mailchannels.net if the error persists. |
502 Bad Gateway | A transient infrastructure or network error. | Retry with backoff and alert if repeated attempts fail. |
Suppression API errors
| Status | Meaning | What to do |
|---|---|---|
400 Bad Request | A recipient, source, date filter, or request body is invalid. | Validate recipient formatting and use a supported source: api, unsubscribe_link, list_unsubscribe, hard_bounce, or spam_complaint. |
409 Conflict | One or more suppression entries already exist. | Treat existing entries as success during idempotent imports, or query the suppression list before creating entries. |
413 Payload Too Large | The create request exceeds the 1,000-entry limit. | Split imports into batches of 1,000 entries or fewer. |
500 Internal Server Error | A transient MailChannels service error. | Retry with exponential backoff. Check status.mailchannels.net if the error persists. |
503 Temporarily Unavailable | Suppression service maintenance or temporary unavailability. | Retry later with backoff. |
Webhook API errors
| Status | Meaning | What to do |
|---|---|---|
400 Bad Request | A webhook URL, batch ID, filter, or validation request is invalid. | Check the URL, filter values, and batch ID before retrying. |
404 Not Found | The requested webhook batch or signing key does not exist. Applies to POST /webhook-batch/{batch_id}/resend, GET /webhook/public-key, and POST /webhook/validate. | Confirm the resource ID exists before retrying. |
409 Conflict | A webhook endpoint is already enrolled for this customer (POST /webhook only). | Treat as success for idempotent enrollment, or query existing webhooks with GET /webhook before enrolling. |
500 Internal Server Error | A transient MailChannels service error. | Retry and check status.mailchannels.net if failures continue. |

