Response and error model
The API uses two different error shapes, and which one you get depends on the kind of problem. Knowing the split makes error handling much simpler.
- StatusBody shapeWhen you get it
- 200JSON object or arraySuccess with a payload.
- 204EmptySuccess with no body. Used by some PUT and DELETE calls.
- 400{"error": "..."}The body parsed fine but a value is not acceptable. This covers most field errors.
- 401{"error": "..."}Missing, malformed or inactive API key.
- 404{"detail": "Not Found"}The path does not exist. Usually an underscore where a hyphen belongs.
- 404Descriptive messageThe path is right but the resource is not there.
- 405StandardThe path exists but the HTTP verb is wrong.
- 409{"error": "..."}Duplicate resource. A sending account or custom rule already exists.
- 422{"detail": [ ... ]}The request body is malformed, incomplete, or a value has the wrong JSON type.
- 429{"error": "..."}A cooldown or rate limit applies. See sections 7.2 and 9.
- 502{"error": "..."}An upstream ZeroBounce service is unavailable.
1. 400 versus 422
This is the distinction worth building into your client:
- 422 means the request could not be read as expected JSON. A missing required key, a string where an integer belongs, an empty body, or invalid JSON. The body carries a detail array.
- 400 means the request was readable but a value was rejected. A malformed email address, an identifier outside its allowed range, a timezone_offset beyond its bounds, a bad date format, or a start date later than an end date. The body carries a single error string.
So {"engagement_rule_id": "two"} returns 422, while {"engagement_rule_id": 9} returns 400. Do not expect a detail array on a 400, or an error string on a 422.
2. Parameter naming
Two names are used for the same thing across endpoints. Both refer to a from-address you have registered:
- NameUsed by
from_address/sending-account, /statistics, /statistics-per-day, /from-address-statistics, /check-domain-dmarc, /sending-accounts (body and delete query)c_from/engagement-rule, /custom-engagement, /statistics-detailed, /statistics/download
Where the address appears in a URL path rather than a query string, URL-encode the @.
Was this page helpful?
Interested in our partner programs?
