SendSMSby ZEXTELDocumentation
EN
Cabinet
Open MarkdownOpen in ChatGPTOpen in Claude
⋯ Page actions
Open MarkdownOpen in ChatGPTOpen in ClaudeOpen in CursorOpen in PerplexityOpen in Gemini (question is copied)Open in Microsoft CopilotOpen in IBM Bob (question is copied)

Messages

Batch SMS sending

POST/v1/messages/batch

Required permission: messages.sendSends SMS

Submit up to 25 SMS messages. Each item uses the same admission handler as a single-message request and commits independently. HTTP 200 reports the batch results: inspect each item status. An item status of 202 means accepted for processing, not delivered. Use a stable idempotency key for each logical message; the same key also works with the single-message endpoint. Keep the original keys when retrying. Prepaid and postpaid accounts are supported; an account without idempotent admission support receives item status 409 with idempotent_admission_unavailable before a message is created. This operation is not an all-or-nothing transaction. Each item counts against the account request limit. If an admission outcome is unknown, remaining items are returned as not_attempted. More than 25 items, duplicate keys or a malformed item return 400 invalid_batch; 413 is returned only for a request body above the size limit.

POST /v1/messages/batch

cURL. The key is in the SENDSMS_API_KEY environment variable.

curl --max-time 30 --request POST \
  --url 'https://api.sendsms.to/v1/messages/batch' \
  --header "X-API-Key: $SENDSMS_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{
  "items": [
    {
      "idempotencyKey": "order-1001-sms",
      "message": {
        "channel": "sms",
        "to": "994XXXXXXXXX",
        "from": "APPROVED_SENDER",
        "text": "Your order is ready",
        "trafficClass": "transactional"
      }
    }
  ]
}'

#Parameters

FieldTypeDescription
X-Dry-Runoptionalheader · stringOptional. true — a trial request: every check of the real request is made (key, IP allowlist, permission, account, fields, sender, template, parts, price, funds), but nothing is executed — no message, no reservation, no queue, no data change, the Idempotency-Key is not taken. The answer has the real status and structure plus dryRun: true; identifiers in it are conditional (zero UUID). Refusals are the real ones. Any other value — 400 invalid_dry_run. Trial requests have their own, lower rate limit.
true

#Request body

FieldTypeDescription
itemsrequiredarray<object>
maxItems: 25
items[].idempotencyKeyrequiredstringUnique within request; persisted logical message key, not an API authentication secret.
minLength: 1
maxLength: 128
pattern: "^[!-~]+$"
items[].messagerequiredobject
items[].message.channelrequiredstringThis first documented transport is SMS; additional channels require explicit availability qualification.
const: "sms"
items[].message.torequiredstringInternational recipient number.
items[].message.fromrequired unless a default Sender ID is set or the account has exactly one approved namestringSender value: use an approved, unexpired Sender ID of your account, exactly as registered. Never an operator override. Limitation of the current version: country, operator and start date of a sender are not applied at sending.
items[].message.textrequired: one of text or templateIdstringMessage text. Required when templateId is not given; do not send it together with templateId.
items[].message.templateIdrequired: one of text or templateIdstring · uuidUUID of an approved, not archived template of your account. Required when text is not given; the message text is rendered from the template.
items[].message.variablesrequired with templateId — for every required variableobjectTemplate variable values by name. Required with templateId for every required variable of the template; phone is taken from to.
items[].message.trafficClassrequired unless the template or the setting gives a classstring
"otp" "transactional" "promotional"

What happens if it is not sent

items[].message.text / items[].message.templateId
400 text_or_template_required (both — 400 text_and_template_conflict).
items[].message.from
The «Default Sender ID» of the cabinet («API and integrations») is used; if not set — the only approved name; otherwise 400 sender_required. The name used is in the from field of the 202 answer.
items[].message.trafficClass
The template class is used, then the «Default traffic class»; otherwise 400 traffic_class_required. Allowed: otp (codes), transactional (notices), promotional (advertising: only with consent and outside quiet hours); anything else — 400 traffic_class_not_allowed.
items[].message.variables
422 template_variables_missing (the list is in missing).

#Responses

200Per-item admission results; partial acceptance possible

Response format

FieldTypeDescription
resultsrequiredarray<object>SendSMS constructs one result for each submitted batch item, in input order. HTTP 200 means the batch result is available, not that every item was accepted.
maxItems: 25
results[].indexrequiredintegerZero-based item position assigned by SendSMS from the original input array. Not a resource ID.
minimum: 0
results[].statusrequiredintegerPer-item HTTP-style admission status generated by SendSMS (for example 202 accepted, 400 validation, 402 funds, 403 permission, 409 conflict, 422 policy, 503 unavailable/unknown). Not a message delivery state.
results[].bodyrequiredobjectOriginal per-item response assembled by SendSMS: acknowledgement on 202, otherwise error details. not_attempted means that item was not attempted; admission_outcome_unknown means a commit may have succeeded, so retain the original idempotency key.
results[].body.messageIdrequiredresults[].body.status = "queued", results[].body.dryRun = truestring · uuidMessage UUID created by SendSMS before durable admission. With an Idempotency-Key, a postpaid account (and a prepaid account in budget-enabled admission) gets the same ID for the same key within the authenticated account; without a key SendSMS generates a random UUID. Save it for status reads. It is not the operator’s message ID.
results[].body.statusrequiredresults[].body.status = "queued", results[].body.dryRun = truestringOriginal acknowledgement generated by SendSMS: queued means accepted for processing, not delivered. A replay may return this original acknowledgement after the message state has changed.
const: "queued"
results[].body.duplicateoptionalresults[].body.status = "queued", results[].body.dryRun = truebooleanOptional true flag generated by SendSMS on an idempotent replay. No new message was created by this acknowledgement. Absence is not delivery evidence.
results[].body.dryRunoptionalresults[].body.status = "queued", results[].body.dryRun = truebooleanPresent only in the answer to a trial request (X-Dry-Run: true): nothing was executed; identifiers in this answer are conditional.
const: true
results[].body.fromoptionalresults[].body.status = "queued", results[].body.dryRun = truestringSendSMS accounts only: the sender name the message went with — from the request, the default Sender ID for the API or the only approved name.
results[].body.errorrequiredstringError identifier or legacy human-readable text returned by SendSMS. Not every handler exposes a stable machine code here. Check HTTP status and documented identifiers; never parse translated prose as a permanent code.
results[].body.messageoptionalstringOptional explanation generated by SendSMS. Intended for people; wording/language may change. Absence means the handler supplied no separate explanation.
results[].body.codeoptionalstringOptional machine-readable code generated by SendSMS or its HTTP framework. Meaning depends on the operation; not a universal numeric provider code.
results[].body.statusCodeoptionalintegerOptional HTTP status number generated by the server framework for a framework-level error. The actual HTTP response status is authoritative.
results[].body.errorsoptionalarray<object>Optional field-validation issues generated by SendSMS, typically for template create/update. An absent array is not an empty successful result.
results[].body.errors[].fieldoptionalstringRequest field identified by the SendSMS validator, such as name or body.
results[].body.errors[].messageoptionalstringOptional explanation generated by SendSMS. Intended for people; wording/language may change. Absence means the handler supplied no separate explanation.
results[].body.missingoptionalarray<string>Variable names SendSMS found missing from a template send/preview request. Present only for relevant template errors.
results[].body.invalidoptionalarray<object>Invalid variable values identified by SendSMS, with variable name and validation reason.
results[].body.invalid[].nameoptionalstringVariable identifier derived from a {{placeholder}} in the template or built-in catalog; use it as a key in variables. Not a person’s actual name.
results[].body.invalid[].reasonoptionalstringSendSMS validation reason: value_too_long, invalid_characters or unsupported_type. It describes a variable value, not network delivery.
results[].body.retryableoptionalbooleanOptional SendSMS hint that an operation may be retried after contention/unavailability. It never authorizes a new logical send with a different idempotency key.
results[].body.messageIdoptionalstring · uuidMessage UUID created by SendSMS before durable admission. With an Idempotency-Key, a postpaid account (and a prepaid account in budget-enabled admission) gets the same ID for the same key within the authenticated account; without a key SendSMS generates a random UUID. Save it for status reads. It is not the operator’s message ID.
results[].body.duplicateoptionalbooleanOptional true flag generated by SendSMS when a repeat with the same Idempotency-Key returns the stored refusal of a postpaid send (402 insufficient_credit). This answer created no new message.
results[].body.channeloptionalstringRequested channel echoed by SendSMS in a channel-availability refusal.
results[].body.reasonsoptionalarray<string>SendSMS channel refusal reasons, such as globally disabled, not assigned, not implemented or not configured. These are platform policy results, not operator receipt codes.
results[].body.mnpoptionalstringMNP decision state reported by SendSMS in an applicable network-lookup refusal. Not proof that an external provider was contacted.
results[].body.estimatedWaitSecondsoptionalintegerPresent with transactional_overloaded: the forecast wait in seconds (1 to 30), equal to the Retry-After header.
dryRunoptionalbooleanPresent only in the answer to a trial request (X-Dry-Run: true): nothing was executed; identifiers in this answer are conditional.
const: true
400Invalid batch; nothing attempted

Check required fields, value types and the request format.

Response format

FieldTypeDescription
errorrequiredstringError identifier or legacy human-readable text returned by SendSMS. Not every handler exposes a stable machine code here. Check HTTP status and documented identifiers; never parse translated prose as a permanent code.
messageoptionalstringOptional explanation generated by SendSMS. Intended for people; wording/language may change. Absence means the handler supplied no separate explanation.
codeoptionalstringOptional machine-readable code generated by SendSMS or its HTTP framework. Meaning depends on the operation; not a universal numeric provider code.
statusCodeoptionalintegerOptional HTTP status number generated by the server framework for a framework-level error. The actual HTTP response status is authoritative.
401Invalid or revoked API key

Check the X-API-Key header and key status. Never expose the key in client-side code. The machine code is in the code field: api_key_missing or api_key_invalid.

Response format

FieldTypeDescription
errorrequiredstringError identifier or legacy human-readable text returned by SendSMS. Not every handler exposes a stable machine code here. Check HTTP status and documented identifiers; never parse translated prose as a permanent code.
messageoptionalstringOptional explanation generated by SendSMS. Intended for people; wording/language may change. Absence means the handler supplied no separate explanation.
codeoptionalstringOptional machine-readable code generated by SendSMS or its HTTP framework. Meaning depends on the operation; not a universal numeric provider code.
statusCodeoptionalintegerOptional HTTP status number generated by the server framework for a framework-level error. The actual HTTP response status is authoritative.
403messages.send scope required; or the request came from an IP address not allowed for this key (ip_not_allowed)

Check API key permissions, account settings and channel availability.

Response format

FieldTypeDescription
errorrequiredstringError identifier or legacy human-readable text returned by SendSMS. Not every handler exposes a stable machine code here. Check HTTP status and documented identifiers; never parse translated prose as a permanent code.
messageoptionalstringOptional explanation generated by SendSMS. Intended for people; wording/language may change. Absence means the handler supplied no separate explanation.
codeoptionalstringOptional machine-readable code generated by SendSMS or its HTTP framework. Meaning depends on the operation; not a universal numeric provider code.
statusCodeoptionalintegerOptional HTTP status number generated by the server framework for a framework-level error. The actual HTTP response status is authoritative.
413Request body exceeds 131,072 bytes

Response format

FieldTypeDescription
errorrequiredstringError identifier or legacy human-readable text returned by SendSMS. Not every handler exposes a stable machine code here. Check HTTP status and documented identifiers; never parse translated prose as a permanent code.
messageoptionalstringOptional explanation generated by SendSMS. Intended for people; wording/language may change. Absence means the handler supplied no separate explanation.
codeoptionalstringOptional machine-readable code generated by SendSMS or its HTTP framework. Meaning depends on the operation; not a universal numeric provider code.
statusCodeoptionalintegerOptional HTTP status number generated by the server framework for a framework-level error. The actual HTTP response status is authoritative.
429Account rate limit exceeded; no items attempted

Reduce the request rate and delay retries. The general per-second limit: code = rate_limit_exceeded.

Response format

FieldTypeDescription
errorrequiredstringError identifier or legacy human-readable text returned by SendSMS. Not every handler exposes a stable machine code here. Check HTTP status and documented identifiers; never parse translated prose as a permanent code.
messageoptionalstringOptional explanation generated by SendSMS. Intended for people; wording/language may change. Absence means the handler supplied no separate explanation.
codeoptionalstringOptional machine-readable code generated by SendSMS or its HTTP framework. Meaning depends on the operation; not a universal numeric provider code.
statusCodeoptionalintegerOptional HTTP status number generated by the server framework for a framework-level error. The actual HTTP response status is authoritative.

Type to search