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

Every error response includes the following fields:
{
  "error": "API key required",
  "code": "missing_api_key"
}
FieldTypeDescription
errorstringHuman-readable description of the error
codestringMachine-readable error code for programmatic use

Authentication Errors (401)

Returned when the request is missing valid authentication credentials.
Error CodeMessageDescription
missing_api_keyAPI key requiredThe X-Api-Key header was not included in the request.
invalid_api_keyInvalid API keyThe provided API key does not match any active key. Verify the key format (trk_[32-char-alphanumeric]) and that it has not been revoked.
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

{
  "error": "Invalid API key",
  "code": "invalid_api_key"
}

Validation Errors (400)

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

General Validation

Error CodeMessageDescription
not_foundResource not foundThe referenced resource does not exist or is not accessible.
confirm_requiredconfirm must be trueA destructive operation requires explicit confirmation via confirm: true.

Send / Message Validation

Error CodeMessageDescription
missing_toto is requiredThe to field (recipient phone number) was not provided.
missing_list_numberlist_number is requiredThe list_number field (sending phone number) was not provided.
missing_bodybody is requiredThe message body field was not provided.
invalid_phoneInvalid recipient phone number formatThe to value is not a valid E.164 phone number (e.g. +14155551234).
invalid_phoneInvalid E.164 phone number formatA phone number field does not conform to E.164 format.
invalid_list_numberInvalid list_number E.164 formatThe list_number value is not a valid E.164 phone number.
not_sendableVOIP numbers not allowed by account settingsThe recipient number was identified as VOIP and the account has VOIP sending disabled.
missing_messagesmessages array is requiredThe messages array was not provided in a bulk send request.
list_not_foundSending list not found for this list_numberNo sending list is associated with the provided list_number.
webhook_not_configuredWebhook verification required before sendingThe BYOC list requires webhook verification before messages can be sent.

Phone Number Validation

Error CodeMessageDescription
missing_phone_numberphone_number is requiredThe phone_number field was not provided.

Creative Validation

Error CodeMessageDescription
missing_namename is requiredThe creative name field was not provided.
missing_messagemessage is requiredThe creative message field was not provided.
missing_offer_linksoffer_links is requiredThe offer_links array was not provided for a creative that uses link placeholders.
name_too_longname must be 255 characters or lessThe creative name exceeds the 255 character limit.
message_too_longmessage must be 1600 characters or lessThe creative message exceeds the 1600 character limit.
invalid_statusstatus must be one of: …The provided status value is not a valid option.
invalid_creative_typecreative_type must be one of: …The provided creative_type value is not a valid option.
missing_link_placeholdermessage must contain at least one {{linkN}} placeholderThe creative message does not contain a required {{linkN}} placeholder.
missing_offer_links_for_placeholdersMissing offer_links for placeholders: …One or more {{linkN}} placeholders in the message do not have corresponding entries in offer_links.
missing_offer_link_keyoffer_link key is requiredAn entry in the offer_links array is missing its key field.
missing_offer_link_offer_idoffer_link offer_id is requiredAn entry in the offer_links array is missing its offer_id field.
offer_not_foundOffer not found: …The referenced offer ID does not exist in your account.

Contact Validation

Error CodeMessageDescription
missing_contactscontacts array is requiredThe contacts array was not provided in a bulk contact request.
missing_recordsrecords array is requiredThe records array was not provided in a bulk import request.

Audience Validation

Error CodeMessageDescription
missing_filterfilter is requiredThe audience filter object was not provided.
missing_audiencesaudiences is requiredThe audiences array was not provided.
invalid_condition_typeInvalid condition typeThe audience condition type is not a recognized value.
invalid_time_fieldInvalid time fieldThe time-based filter references a field that does not exist or is not filterable.
invalid_time_operatorInvalid time operatorThe time-based filter uses an operator that is not supported.
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.
Error CodeMessageLimitDescription
too_many_messagesMaximum 1000 messages per request1,000The messages array in a bulk send exceeds the limit.
too_many_contactsMaximum 1000 contacts per request1,000The contacts array in a bulk contact operation exceeds the limit.
too_many_recordsMaximum 1000 records per request1,000The records array in a bulk import exceeds the limit.

Example

{
  "error": "Maximum 1000 messages per request",
  "code": "too_many_messages"
}
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.
Error CodeMessageDescription
not_foundResource not foundGeneric not-found error. The message may include the specific resource type (e.g. “Contact not found”, “Creative not found”, “Schedule not found”).

Example

{
  "error": "Contact not found",
  "code": "not_found"
}
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 (MongoDB ObjectId for most resources)

Handling Errors in Code

curl -i -X POST https://app.tracklysms.com/api/v2/send \
  -H "X-Api-Key: trk_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "list_number": "+14155551234",
    "to": "+14155556789",
    "body": "Hello!"
  }'

# Check the HTTP status code and parse the JSON error response:
# HTTP/1.1 400 Bad Request
# {"error": "Invalid recipient phone number format", "code": "invalid_phone"}

Next Steps

API Limits & Best Practices

Payload limits, batch sizes, and retry strategies

Send Message

Send your first API message