Skip to main content

Error Codes

All API errors follow a consistent JSON response format. When a request fails, the response body contains a structured error object that you can use for programmatic error handling.

Error Response Format

All error responses are JSON objects. The error field is always present. Two additional fields may be present depending on the endpoint:
Treat error as guaranteed and code/message as optional. Switch on code when present and fall back to the error text otherwise.

Authentication Errors (401)

Returned when the request is missing valid authentication credentials.
API keys are sensitive credentials. Never expose them in client-side code, public repositories, or logs.
Common Causes:
  • API key was revoked or rotated in the dashboard
  • Key is being sent in the wrong header (must be X-Api-Key, not Authorization)
  • Extra whitespace or newline characters in the key value
Resolution:
  1. Verify your key in Dashboard > Settings > API Keys
  2. Ensure the header is exactly X-Api-Key: trk_... with no extra spaces
  3. Generate a new key if the current one may be compromised

Example


Validation Errors (400)

Returned when the request payload is malformed, missing required fields, or contains invalid values.

General Validation

Send / Message Validation

Phone Number Validation

Generic Input Validation

Creative Validation

Contact Validation

Audience Validation

Schedule Validation

Offer / Partnership Offer Validation

List / Contact / Resource Errors

Common Causes:
  • Phone numbers missing the + prefix or country code (must be E.164 format like +14155551234)
  • Sending to a list_number that belongs to a different account
  • Bulk request arrays exceeding the 1,000 item limit
  • Creative message body exceeding the 1,600 character limit
Resolution:
  1. Validate phone numbers match E.164 format before sending
  2. Use the List endpoint to verify your list_number values
  3. Check the code field in the error response for the specific validation that failed

Resource Limit Errors (413)

Returned when a bulk request exceeds the maximum number of items allowed per request.

Example

To process more than 1,000 items, split your data into batches and send multiple requests sequentially.
Common Causes:
  • Attempting to send more than 1,000 messages in a single bulk request
  • Importing more than 1,000 contacts or records in one API call
Resolution:
  1. Split large datasets into batches of 1,000 or fewer items
  2. Process batches sequentially with error handling between each batch
  3. Use the response error_count and errors array to identify and retry failed items

Not Found Errors (404)

Returned when the requested resource does not exist or is not accessible under your account.

Example

Common Causes:
  • Using an ID from a different account (all resources are account-scoped)
  • Referencing a resource that was deleted
  • Typo in the resource ID
Resolution:
  1. Verify the resource exists by calling the corresponding List endpoint
  2. Ensure your API key belongs to the same account that owns the resource
  3. Check that you are using the correct ID format (a 24-character hexadecimal ID for most resources)

Forbidden / Access Errors (403)

Returned when a valid API key is presented but the account is not permitted to perform the requested action. The 403 Account is suspended response intentionally omits the code field — see Authentication.

Conflict Errors (409)

Returned when the request conflicts with the current state of the resource.

Rate-Limit / Throttling Errors (429)

Returned when the request is throttled by a per-endpoint rate limit (for example the OTP and phone-validation endpoints) or a per-account limit (such as a daily send cap). Retry with exponential backoff after the window resets.

Server / Infrastructure Errors (5xx)

Returned when a subsystem fails. These are generally transient — retry with exponential backoff.

Handling Errors in Code

Next Steps

API Limits & Best Practices

Payload limits, batch sizes, and retry strategies

Send Message

Send your first API message