Skip to main content
When an API endpoint request fails, the API returns a JSON error response with a consistent structure.

Error format

API endpoint errors follow this envelope:

Error codes

This table also includes OAuth token endpoint errors. Those happen before you have a bearer token and are returned by /oauth/token.

Validation errors

A 422 validation_failed response includes a details array with specific field errors. For example, creating a contact without an email or phone number returns:
Common validation messages:

Conflict errors

A 409 conflict is returned when you try to create a contact with an email or phone number that already belongs to an existing contact. The response includes the id of the existing contact, nested inside the error object, so you can update it directly.
To update the existing contact, use the Update a contact endpoint with the returned error.id.

Event ingest errors

The Ingest an event endpoint is an exception: a payload that fails validation returns 400 with a top-level errors array rather than the standard error envelope, and a status of rejected.
Auth, scope, size, and rate-limit failures on that endpoint (401, 403, 413, 429) still use the standard error envelope above.

Handling errors

  1. Check the HTTP status code first. The status code tells you the category of error.
  2. Parse the error body. Use the code field for programmatic handling and the message for logging.
  3. Only retry on 429. Rate limit errors are temporary — wait for Retry-After seconds, then retry. Other errors require fixing the request.