Error format
All errors follow this envelope:| Field | Description |
|---|---|
code | A machine-readable error code (see table below) |
message | A human-readable description of what went wrong |
details | An optional array of field-level errors (present on validation failures) |
Error codes
| Code | HTTP Status | Description |
|---|---|---|
unauthorized | 401 | Bearer token is missing, expired, or invalid |
insufficient_scope | 403 | Token does not have the required scope for this endpoint |
not_found | 404 | The contact could not be found |
conflict | 409 | A contact with this email or phone number already exists |
validation_failed | 422 | One or more fields failed validation |
rate_limited | 429 | Rate limit exceeded — see Rate Limits |
Validation errors
A422 validation_failed response includes a details array with specific field errors. For example, creating a contact without an email or phone number returns:
| Field | Message |
|---|---|
email / phone_number | email or phone_number is required |
phone_number | must be a valid phone number in E.164 format |
email_consent | must be one of: subscribed, unsubscribed, non_subscribed |
sms_consent | requires a phone number from a supported country |
custom_fields | must be a flat key-value object (no nested values) |
Conflict errors
A409 conflict is returned when you try to create a contact with an email or phone number that already belongs to an existing contact.
Handling errors
- Check the HTTP status code first. The status code tells you the category of error.
- Parse the error body. Use the
codefield for programmatic handling and themessagefor logging. - Only retry on
429. Rate limit errors are temporary — wait forRetry-Afterseconds, then retry. Other errors require fixing the request.