Reference
Error codes
An API refusal is an HTTP status plus the error field of the JSON body. The table below says what each code means and what to do. Look at the HTTP status first; error refines it.
37 codes
| Code | HTTP | Meaning | What to do |
|---|---|---|---|
api_key_missing | 401 | No X-API-Key header. | Send the key in the X-API-Key header. |
api_key_invalid | 401 | The key is wrong, revoked or expired. | Check the key; issue a new one in the cabinet if needed. |
text_or_template_required | 400 | Neither text nor templateId. | Send a text or a template — exactly one of them. |
sender_required | 400 | No from, no default Sender ID, and not exactly one approved name (the number is in approvedSenders). | Send from, or choose a «Default Sender ID» in the cabinet: «API and integrations». |
traffic_class_required | 400 | No trafficClass, and neither the template nor the setting gives one. | Send trafficClass (otp, transactional, promotional) or choose a «Default traffic class» in the cabinet. |
traffic_class_not_allowed | 400 | The class is not available to a SendSMS client (allowed ones are in allowed). | Use otp, transactional or promotional. |
invalid_dry_run | 400 | The X-Dry-Run header is not true. | Send X-Dry-Run: true or remove the header. |
dry_run_required | 403 | A changing request from the documentation page without X-Dry-Run: true. | From the documentation page only trial requests are possible; send real ones from your server. |
ip_not_allowed | 403 | The request came from an address that is not on the key’s allowlist. clientIp in the answer is the address we see. | Add that address to the key in the cabinet (“Change addresses”). |
wrong_api_host | 403 | The key works on another API address (the apiBaseUrl field). | Send requests to https://api.sendsms.to. |
(no permission) | 403 | The key lacks the permission the method needs (see “Required permission” on the method page). | Issue a key with that permission. |
sender_not_approved | 403 | The name in from is not approved for your account, is suspended or expired. | Take an approved name from GET /v1/senders or request a new one. |
billing_suspended | 403 | Accepting new messages is suspended for now. | Try later; if it lasts, contact support. |
invalid_number | 400 | The recipient number is invalid. | Pass the number in international format: country code and number, digits only (a + is allowed). |
text_and_template_conflict | 400 | Both text and templateId were sent. | Keep one of them. |
invalid_template_id | 400 | templateId is not a UUID. | Pass a template identifier from GET /v1/templates. |
invalid_idempotency_key | 400 | The Idempotency-Key value is not accepted, or the header was sent empty. | Pass your own key (a UUID or a short string without spaces), or do not send the header. |
invalid_batch | 400 | The batch failed the check: more than 25 items, repeated keys or a wrong item. | Fix the batch; give every item its own idempotencyKey. |
invalid_balance_query | 400 | An unknown or repeated balance query parameter. | Check include, limit, after against the reference. |
insufficient_balance | 402 | Not enough funds or SMS credits to send. | Top up in the cabinet, then send with a new Idempotency-Key. |
insufficient_credit | 402 | Not enough available credit on a postpaid account. | Ask for a higher limit; then use a new Idempotency-Key. |
message_not_found | 404 | No message with this id in your account. | Check the messageId from the 202 answer. |
template_not_found | 404 | The template is not in your account. | Take the id from GET /v1/templates. |
sender_not_found | 404 | No sender name with this id in your account. | Take the id from GET /v1/senders. |
event_not_found | 404 | No scenario event with this id in your account. | Check the eventId from the event answer. |
idempotency_conflict | 409 | This Idempotency-Key was already used with another request body. | A new send needs a new key; a repeat needs the same body. |
idempotency_in_progress | 409 | The first request with this key is still being processed. | Repeat after Retry-After with the same key and body. |
payment_mode_changed | 409 | The account’s payment mode changed during the request; no message was created. | Repeat the same request with the same key. |
scenario_not_active | 409 | The scenario is paused. | Switch the scenario on in the cabinet. |
template_variables_missing | 422 | Template or scenario variables are not filled (the list is in missing). | Pass every required variable in variables. |
idempotency_key_reused | 422 | The event key was already used for another event. | Use a new key for a new event. |
consent_required | 422 | Promotional scenario: the number has not agreed to advertising. | Send advertising only to recipients who agreed. |
pricing_unavailable | 422 | Sending is not set up for this destination. | Contact support with the recipient’s country and operator. |
balance_rate_limit | 429 | The balance is requested more often than once per 10 seconds. | Wait Retry-After (10 s). |
rate_limit_exceeded | 429 | The per-account requests-per-second limit is exceeded (or the batch does not fit into this second’s limit). | Wait a second (Retry-After when present) and repeat. |
balance_unavailable | 503 | The balance is temporarily unavailable. | Repeat after Retry-After (10 s). |
service_unavailable | 503 | A short maintenance window: the request was not accepted. | Repeat the same request after Retry-After. |
#Reading an error answer
- Check the HTTP status and
Content-Typebefore parsing JSON: an intermediate network node may return text or HTML. erroris a stable code where there is one;messageis an explanation for people and its wording may change. Do not build logic onmessagetext.- In 401 answers and the general 429 limit
errorkeeps its former text (for compatibility); the machine code is in thecodefield:api_key_missing,api_key_invalid,rate_limit_exceeded. - On 429 and 503 wait (the
Retry-Afterheader, when present) and repeat the same request with the sameIdempotency-Key.