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 not sent as
X-Api-KeyorAuthorization: Bearer <key> - Your application’s public outbound IP is outside the key’s allowlist
- 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
Pending-send Approval
The SMS approval workflow separates creation, human review, and execution. Reconcile uncertain outcomes using the existing pending ID.Agent Account Setup
Creation is anonymous. Status reads use the setup request’s bearer capability before or after login; it grants neither account access nor send authority.
Owner confirmation and renewal are separate authenticated dashboard actions. Identity, account eligibility, expiry, and second-factor refusals must be resolved in the original setup tab.
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
- Inspect
errorsand retry corrected items only when they were definitively not submitted; reconcile publication errors before considering another send
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.Payment Required Errors (402)
Returned when a billing problem blocks the specific action being attempted.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.
A send that fails before publication normally releases its reserved API-key allowance. If that refund cannot be confirmed, the allowance may remain used for the original UTC day even though the message was not published. Check Who Am I for current usage before retrying a capped send.
Server / Infrastructure Errors (5xx)
Returned when a subsystem fails. Backoff is appropriate for read requests and definitively refused sends. A send timeout or publication error may follow submission; reconcile its message ID when available instead of automatically sending again.Handling Errors in Code
Next Steps
API Limits & Best Practices
Payload limits, batch sizes, and retry strategies
Send Message
Send your first API message