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)

Start

First message in 5 minutes

From the key to the delivery status: five steps after which your system sends SMS through api.sendsms.to.

#1. Prepare the cabinet

Sign in to the cabinet at app.sendsms.to. Sending opens when the cabinet shows that the account is ready to send. Until the account is admitted you can send one trial SMS to your own confirmed number, from the platform sender.

#2. Issue an API key

  1. In the cabinet open “API and integrations” and create a key for your integration.
  2. Tick the permissions: messages.send to send and messages.read for statuses; balance.read if you need the balance.
  3. Enter the external IP address of the server that will call the API: a key without addresses does not work (see IP address allowlist).
  4. Keep the key in your server secrets: it is shown once.
bash
export SENDSMS_API_KEY='your-key'

#3. Check access

Ask for the balance: 200 means the key, its permissions and the address are fine. 401 — wrong key; 403 ip_not_allowed — the server address is not on the key’s list (the answer carries clientIp, the address we see).

GET /v1/balance

cURL. The key is in the SENDSMS_API_KEY environment variable.

curl --max-time 30 --request GET \
  --url 'https://api.sendsms.to/v1/balance' \
  --header "X-API-Key: $SENDSMS_API_KEY"
200 Response
{
  "money": {
    "balance": "125.12345",
    "currency": "USD"
  },
  "smsCredits": {
    "total": "1500.00"
  }
}

200 — the key, permissions and address are fine. Money and SMS credits are separate strings; do not add them up. All fields and responses — on the method page →

If something is wrong

401 No X-API-Key header. Send the key in the X-API-Key header.

{
  "error": "Отсутствует X-API-Key",
  "code": "api_key_missing"
}

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”).

{
  "error": "ip_not_allowed",
  "message": "Запрос пришёл с IP-адреса, которого нет в белом списке этого API-ключа. Если адрес вашего сервера изменился, добавьте новый адрес в кабинете: API / Developers → ключ → «Разрешённые IP-адреса».",
  "clientIp": "203.0.113.10"
}

All error codes →

#4. Send an SMS

Put an approved sender name of your account in from (the list: GET /v1/senders). Pass an Idempotency-Key: a repeat with the same key does not create a second message. First send a trial request with the X-Dry-Run: true header — it passes every check but sends nothing (Trial requests); then the same request without the header.

202 means “accepted for processing”, not “delivered”. Keep the messageId.

POST /v1/messages

cURL. The key is in the SENDSMS_API_KEY environment variable.

curl --max-time 30 --request POST \
  --url 'https://api.sendsms.to/v1/messages' \
  --header "X-API-Key: $SENDSMS_API_KEY" \
  --header "Idempotency-Key: $(uuidgen 2>/dev/null || cat /proc/sys/kernel/random/uuid)" \
  --header 'X-Dry-Run: true' \
  --header 'Content-Type: application/json' \
  --data '{
  "channel": "sms",
  "to": "994XXXXXXXXX",
  "from": "APPROVED_SENDER",
  "text": "Your order is ready",
  "trafficClass": "transactional"
}'
202 Trial request: nothing was sent
{
  "messageId": "00000000-0000-0000-0000-000000000000",
  "status": "queued",
  "dryRun": true
}

202 and messageId — the message is accepted for processing (not delivered yet). Keep the messageId. All fields and responses — on the method page →

POST /v1/messages

cURL. The key is in the SENDSMS_API_KEY environment variable.

curl --max-time 30 --request POST \
  --url 'https://api.sendsms.to/v1/messages' \
  --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 '{
  "channel": "sms",
  "to": "994XXXXXXXXX",
  "from": "APPROVED_SENDER",
  "text": "Your order is ready",
  "trafficClass": "transactional"
}'
202 Response
{
  "messageId": "00000000-0000-4000-8000-000000000001",
  "status": "queued"
}

202 and messageId — the message is accepted for processing (not delivered yet). Keep the messageId. All fields and responses — on the method page →

#5. Get the status

Ask no more often than poll_after_seconds in the answer suggests. Details: Delivery reports.

GET /v1/messages/{id}

cURL. The key is in the SENDSMS_API_KEY environment variable.

curl --max-time 30 --request GET \
  --url 'https://api.sendsms.to/v1/messages/MESSAGE_ID' \
  --header "X-API-Key: $SENDSMS_API_KEY"
200 Response
{
  "id": "00000000-0000-0000-0000-000000000002",
  "status": "sent",
  "status_info": {
    "outcome": "pending",
    "poll_after_seconds": 5
  }
}

status is the technical state, status_info.outcome what it means for you; poll_after_seconds — when to ask again (null — no need any more). All fields and responses — on the method page →

200 Later — a final status
{
  "id": "00000000-0000-0000-0000-000000000002",
  "status": "delivered",
  "status_info": {
    "outcome": "delivered",
    "poll_after_seconds": null
  }
}

Type to search