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)

Scenarios

Scenario event

POST/v1/scenarios/{id}/events

Required permission: messages.sendSends SMS

An event from your system (order ready, delivery status, abandoned cart, outage) becomes an SMS with the text of the scenario. One number (to): the SMS goes through the same handler as POST /v1/messages — channel, sender, tariff, funds and stop list checks included. A list (recipients): the event becomes a normal campaign of the scenario with the check and a report. In the quiet hours an event waits for their end unless the scenario sends events at once. A promotional scenario sends only to numbers that agreed to advertising (422 consent_required). 202 means accepted for processing, not delivered.

POST /v1/scenarios/{id}/events

cURL. The key is in the SENDSMS_API_KEY environment variable.

curl --max-time 30 --request POST \
  --url 'https://api.sendsms.to/v1/scenarios/SCENARIO_ID/events' \
  --header "X-API-Key: $SENDSMS_API_KEY" \
  --header "Idempotency-Key: $(uuidgen 2>/dev/null || cat /proc/sys/kernel/random/uuid)" \
  --header 'Content-Type: application/json' \
  --data '{
  "to": "994XXXXXXXXX",
  "variables": {
    "order_id": "A-10492",
    "place": "12 Nizami St"
  }
}'

#Parameters

FieldTypeDescription
idrequiredpath · stringScenario ID from the cabinet: Scenarios → the scenario → API connection.
Idempotency-Keyrequiredheader · stringRequired. Your own stable key per event, scoped to the scenario. The same key with the same body returns the original answer with duplicate:true and sends nothing again; the same key with another body returns 422 idempotency_key_reused. A timeout does not prove rejection: repeat with the same key. A header sent empty (or only spaces) is refused with 400 invalid_idempotency_key.
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
torequired: one of to or recipientsstringRecipient number in international format (digits, an optional +). Send either to or recipients, not both.
recipientsrequired: one of to or recipientsarray<string>List of recipient numbers for a scenario that accepts lists (for example an outage notice). The limit per event is set by SendSMS; repeated numbers count once.
variablesrequired for every variable of the scenario textobjectValues of the scenario text variables {{name}}: up to 30 values, each up to 500 characters. Every variable of the text must be filled.

What happens if it is not sent

to / recipients
400 (both or neither; a list for a one-number scenario is 400 too).
variables
422 template_variables_missing (the list is in missing).

#Responses

202Successful result

Response format

FieldTypeDescription
eventIdrequiredstring · uuidEvent identifier generated by SendSMS. Keep it to read the event later.
statusrequiredstringqueued — the SMS was accepted by the same handler as POST /v1/messages (messageId); scheduled — it waits for the end of the quiet hours (sendAt); accepted — a list event that becomes a normal campaign of the scenario; refused — not sent (error explains why).
"queued" "scheduled" "accepted" "refused" "sent" "sending" "cancelled" "failed"
messageIdoptionalstring | null · uuidMessage identifier for GET /v1/messages/{id} (one-number events).
sendAtoptionalstring | null · date-timeWhen a waiting event will be sent (the end of the quiet hours).
recipientsoptionalintegerNumber of distinct recipients of a list event.
duplicateoptionalbooleantrue — a repeat of an event already accepted with this Idempotency-Key; nothing was sent again.
campaignIdoptionalstring | null · uuidA list event: the campaign of the scenario run made from it.
runStateoptionalstring | nullA list event: the state of that run (preparing, review, scheduled, done, failed…).
reasonCodeoptionalstring | nullWhy the event or its run did not go out, when it did not.
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 input: no Idempotency-Key, both or neither of to and recipients, a wrong number, a list sent to a one-number scenario or the reverse.

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.
402Insufficient available funds or credit

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.
403Insufficient key permissions or account/channel policy; 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.
404Resource unavailable to this account

Check the resource ID and whether it belongs to the API key account.

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.
409Conflict: the scenario is paused (scenario_not_active), or the first request with this key is still in progress (idempotency_in_progress, retryable).

Check the current resource state and operation conditions before retrying.

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.
413More numbers in the list than allowed per event.

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.
422Validation failure: a text variable is missing (template_variables_missing), the key was used for another event (idempotency_key_reused), no consent to advertising (consent_required).

Correct the data or eligibility conditions indicated in the response.

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.
429Rate limit

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.
503Temporarily unavailable

The service is temporarily unavailable. Before retrying an SMS submission, check whether the previous request was accepted.

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