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 not sent as X-Api-Key or Authorization: Bearer <key>
  • Your application’s public outbound IP is outside the key’s allowlist
  • 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


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

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. Inspect errors and 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

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.

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