Skip to main content
The handling pattern depends on the language you use:
  • curl — inspect the HTTP status returned by curl -w "%{http_code}" and parse the response body with jq.
  • JavaScript SDK — SDK methods return { data, error } (or { success, error }). The error object has message and statusCode fields; branch on error?.statusCode.
  • Python SDKmailchannels.Emails.send (and other resource methods) raise typed exceptions that subclass mailchannels.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; use getStatusCode() and getMessage() on the caught exception.
The examples below show how each endpoint’s errors might be handled together in production code: surface transient 5xx failures so the caller (or a retry layer) can react, and fail fast on 4xx so the underlying request can be corrected.

Send API errors

Suppression API errors

Webhook API errors