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. Theerror 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.Troubleshooting authentication errors
Troubleshooting authentication errors
Common Causes:
- API key was revoked or rotated in the dashboard
- Key is being sent in the wrong header (must be
X-Api-Key, notAuthorization) - Extra whitespace or newline characters in the key value
- Verify your key in Dashboard > Settings > API Keys
- Ensure the header is exactly
X-Api-Key: trk_...with no extra spaces - 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
Troubleshooting validation errors
Troubleshooting validation errors
Common Causes:
- Phone numbers missing the
+prefix or country code (must be E.164 format like+14155551234) - Sending to a
list_numberthat belongs to a different account - Bulk request arrays exceeding the 1,000 item limit
- Creative message body exceeding the 1,600 character limit
- Validate phone numbers match E.164 format before sending
- Use the List endpoint to verify your
list_numbervalues - Check the
codefield 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.
Troubleshooting resource limit errors
Troubleshooting resource limit errors
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
- Split large datasets into batches of 1,000 or fewer items
- Process batches sequentially with error handling between each batch
- Use the response
error_countanderrorsarray 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
Troubleshooting not found errors
Troubleshooting not found errors
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
- Verify the resource exists by calling the corresponding List endpoint
- Ensure your API key belongs to the same account that owns the resource
- 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. The403 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