Messages
Send an SMS
/v1/messages202 means accepted into the durable processing chain, not delivered to the handset. Insufficient funds can return402. Sender is selected per new message through from; this does not edit an already sent SMS.
/v1/messagescURL. 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"
}'Node.js 18+ (built-in fetch).
const response = await fetch("https://api.sendsms.to/v1/messages", {
method: "POST",
headers: {
'X-API-Key': process.env.SENDSMS_API_KEY,
'Idempotency-Key': crypto.randomUUID(),
'Content-Type': 'application/json',
},
body: JSON.stringify({
"channel": "sms",
"to": "994XXXXXXXXX",
"from": "APPROVED_SENDER",
"text": "Your order is ready",
"trafficClass": "transactional"
}),
signal: AbortSignal.timeout(30000),
});
console.log(response.status, await response.text());Python 3.8+, standard library only.
import json
import os
import urllib.error
import urllib.request
import uuid
payload = {
"channel": "sms",
"to": "994XXXXXXXXX",
"from": "APPROVED_SENDER",
"text": "Your order is ready",
"trafficClass": "transactional",
}
request = urllib.request.Request(
"https://api.sendsms.to/v1/messages",
method="POST",
headers={
"X-API-Key": os.environ["SENDSMS_API_KEY"],
"Idempotency-Key": str(uuid.uuid4()),
"Content-Type": "application/json",
},
data=json.dumps(payload).encode("utf-8"),
)
try:
with urllib.request.urlopen(request, timeout=30) as response:
print(response.status, response.read().decode("utf-8"))
except urllib.error.HTTPError as error:
print(error.code, error.read().decode("utf-8"))PHP with the cURL extension.
<?php
$ch = curl_init("https://api.sendsms.to/v1/messages");
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTPHEADER => [
'X-API-Key: ' . getenv('SENDSMS_API_KEY'),
'Idempotency-Key: ' . bin2hex(random_bytes(16)),
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => '{"channel":"sms","to":"994XXXXXXXXX","from":"APPROVED_SENDER","text":"Your order is ready","trafficClass":"transactional"}',
]);
$body = curl_exec($ch);
if ($body === false) {
throw new RuntimeException(curl_error($ch));
}
echo curl_getinfo($ch, CURLINFO_HTTP_CODE), PHP_EOL, $body, PHP_EOL;
curl_close($ch);Ruby 2.6+, standard library: net/http, uri.
require 'net/http'
require 'uri'
require 'securerandom'
uri = URI('https://api.sendsms.to/v1/messages')
request = Net::HTTPGenericRequest.new('POST', true, true, uri.request_uri)
request['X-API-Key'] = ENV.fetch('SENDSMS_API_KEY')
request['Idempotency-Key'] = SecureRandom.uuid
request['Content-Type'] = 'application/json'
request.body = '{"channel":"sms","to":"994XXXXXXXXX","from":"APPROVED_SENDER","text":"Your order is ready","trafficClass":"transactional"}'
response = Net::HTTP.start(uri.host, uri.port, use_ssl: true, open_timeout: 30, read_timeout: 30) { |http| http.request(request) }
puts "#{response.code} #{response.body}"Go, standard library.
package main
import (
"crypto/rand"
"fmt"
"io"
"net/http"
"os"
"strings"
"time"
)
func main() {
body := strings.NewReader("{\"channel\":\"sms\",\"to\":\"994XXXXXXXXX\",\"from\":\"APPROVED_SENDER\",\"text\":\"Your order is ready\",\"trafficClass\":\"transactional\"}")
req, err := http.NewRequest("POST", "https://api.sendsms.to/v1/messages", body)
if err != nil {
panic(err)
}
req.Header.Set("X-API-Key", os.Getenv("SENDSMS_API_KEY"))
key := make([]byte, 16)
if _, err := rand.Read(key); err != nil {
panic(err)
}
req.Header.Set("Idempotency-Key", fmt.Sprintf("%x", key))
req.Header.Set("Content-Type", "application/json")
client := &http.Client{Timeout: 30 * time.Second}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
data, _ := io.ReadAll(resp.Body)
fmt.Println(resp.StatusCode, string(data))
}.NET 6+ (HttpClient, top-level statements).
using System;
using System.Net.Http;
using System.Text;
using var client = new HttpClient { Timeout = TimeSpan.FromSeconds(30) };
using var request = new HttpRequestMessage(new HttpMethod("POST"), "https://api.sendsms.to/v1/messages");
request.Headers.Add("X-API-Key", Environment.GetEnvironmentVariable("SENDSMS_API_KEY"));
request.Headers.Add("Idempotency-Key", Guid.NewGuid().ToString());
request.Content = new StringContent("{\"channel\":\"sms\",\"to\":\"994XXXXXXXXX\",\"from\":\"APPROVED_SENDER\",\"text\":\"Your order is ready\",\"trafficClass\":\"transactional\"}", Encoding.UTF8, "application/json");
using var response = await client.SendAsync(request);
Console.WriteLine($"{(int)response.StatusCode} {await response.Content.ReadAsStringAsync()}");Java 11+ (java.net.http). File SendSmsExample.java.
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.time.Duration;
import java.util.UUID;
public class SendSmsExample {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newBuilder().connectTimeout(Duration.ofSeconds(30)).build();
HttpRequest request = HttpRequest.newBuilder(URI.create("https://api.sendsms.to/v1/messages"))
.timeout(Duration.ofSeconds(30))
.header("X-API-Key", System.getenv("SENDSMS_API_KEY"))
.header("Idempotency-Key", UUID.randomUUID().toString())
.header("Content-Type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\"channel\":\"sms\",\"to\":\"994XXXXXXXXX\",\"from\":\"APPROVED_SENDER\",\"text\":\"Your order is ready\",\"trafficClass\":\"transactional\"}"))
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.statusCode() + " " + response.body());
}
}Dart 2.12+, dart:io and dart:convert only.
import 'dart:convert';
import 'dart:io';
import 'dart:math';
Future<void> main() async {
final client = HttpClient()..connectionTimeout = const Duration(seconds: 30);
final request = await client.openUrl('POST', Uri.parse('https://api.sendsms.to/v1/messages'));
request.headers.set('X-API-Key', Platform.environment['SENDSMS_API_KEY'] ?? '');
final random = Random.secure();
request.headers.set('Idempotency-Key', List.generate(16, (_) => random.nextInt(256).toRadixString(16).padLeft(2, '0')).join());
request.headers.contentType = ContentType.json;
request.write('{"channel":"sms","to":"994XXXXXXXXX","from":"APPROVED_SENDER","text":"Your order is ready","trafficClass":"transactional"}');
final response = await request.close().timeout(const Duration(seconds: 30));
final body = await response.transform(utf8.decoder).join();
print('${response.statusCode} $body');
client.close();
}#Parameters
| Field | Type | Description |
|---|---|---|
Idempotency-Keyoptional | header · string | Retain one key for one logical request; the key is scoped to the authenticated account. Single send (prepaid or postpaid account) and batch items (idempotencyKey of each item): the same key with the same payload returns the original acknowledgement (202, the same messageId, duplicate:true) with no second send; the same key with a different payload returns 409 idempotency_conflict. Postpaid account: if the original send was refused with 402 insufficient_credit, a repeat with the same key returns 402 insufficient_credit again (with messageId and duplicate:true); after topping up, use a new key. 409 idempotency_in_progress (with Retry-After) and 409 payment_mode_changed carry retryable:true and create no message: repeat later with the same key and the same payload. A timeout does not prove rejection; query the known message ID before attempting another send. Do not assume exactly-once operator delivery. A header sent empty (or only spaces) is refused with 400 invalid_idempotency_key. When admission by capacity is switched on: a repeat with a key that already has a message is answered before the capacity check and is never refused by it; a request refused with 429 transactional_overloaded or 503 otp_capacity created nothing, so repeating it with the same key is safe. |
X-Dry-Runoptional | header · string | Optional. 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
| Field | Type | Description |
|---|---|---|
channelrequired | string | This first documented transport is SMS; additional channels require explicit availability qualification.const: "sms" |
torequired | string | International recipient number. |
fromrequired unless a default Sender ID is set or the account has exactly one approved name | string | Sender 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. |
textrequired: one of text or templateId | string | Message text. Required when templateId is not given; do not send it together with templateId. |
templateIdrequired: one of text or templateId | string · uuid | UUID of an approved, not archived template of your account. Required when text is not given; the message text is rendered from the template. |
variablesrequired with templateId — for every required variable | object | Template variable values by name. Required with templateId for every required variable of the template; phone is taken from to. |
trafficClassrequired unless the template or the setting gives a class | string | "otp" "transactional" "promotional" |
What happens if it is not sent
text / templateId- 400 text_or_template_required (both — 400 text_and_template_conflict).
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.
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.
variables- 422 template_variables_missing (the list is in missing).
#Responses
202Successful result
Response format
| Field | Type | Description |
|---|---|---|
messageIdrequired | string · uuid | Message 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. |
statusrequired | string | Original 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" |
duplicateoptional | boolean | Optional true flag generated by SendSMS on an idempotent replay. No new message was created by this acknowledgement. Absence is not delivery evidence. |
dryRunoptional | boolean | Present only in the answer to a trial request (X-Dry-Run: true): nothing was executed; identifiers in this answer are conditional.const: true |
fromoptional | string | SendSMS accounts only: the sender name the message went with — from the request, the default Sender ID for the API or the only approved name. |
400Invalid input, including invalid_number for an invalid recipient number.
Check required fields, value types and the request format.
Response format
| Field | Type | Description |
|---|---|---|
errorrequired | string | Error 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. |
messageoptional | string | Optional explanation generated by SendSMS. Intended for people; wording/language may change. Absence means the handler supplied no separate explanation. |
codeoptional | string | Optional machine-readable code generated by SendSMS or its HTTP framework. Meaning depends on the operation; not a universal numeric provider code. |
statusCodeoptional | integer | Optional HTTP status number generated by the server framework for a framework-level error. The actual HTTP response status is authoritative. |
errorsoptional | array<object> | Optional field-validation issues generated by SendSMS, typically for template create/update. An absent array is not an empty successful result. |
errors[].fieldoptional | string | Request field identified by the SendSMS validator, such as name or body. |
errors[].messageoptional | string | Optional explanation generated by SendSMS. Intended for people; wording/language may change. Absence means the handler supplied no separate explanation. |
missingoptional | array<string> | Variable names SendSMS found missing from a template send/preview request. Present only for relevant template errors. |
invalidoptional | array<object> | Invalid variable values identified by SendSMS, with variable name and validation reason. |
invalid[].nameoptional | string | Variable 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. |
invalid[].reasonoptional | string | SendSMS validation reason: value_too_long, invalid_characters or unsupported_type. It describes a variable value, not network delivery. |
retryableoptional | boolean | Optional SendSMS hint that an operation may be retried after contention/unavailability. It never authorizes a new logical send with a different idempotency key. |
messageIdoptional | string · uuid | Message 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. |
duplicateoptional | boolean | Optional 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. |
channeloptional | string | Requested channel echoed by SendSMS in a channel-availability refusal. |
reasonsoptional | array<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. |
mnpoptional | string | MNP decision state reported by SendSMS in an applicable network-lookup refusal. Not proof that an external provider was contacted. |
estimatedWaitSecondsoptional | integer | Present with transactional_overloaded: the forecast wait in seconds (1 to 30), equal to the Retry-After header. |
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
| Field | Type | Description |
|---|---|---|
errorrequired | string | Error 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. |
messageoptional | string | Optional explanation generated by SendSMS. Intended for people; wording/language may change. Absence means the handler supplied no separate explanation. |
codeoptional | string | Optional machine-readable code generated by SendSMS or its HTTP framework. Meaning depends on the operation; not a universal numeric provider code. |
statusCodeoptional | integer | Optional 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
| Field | Type | Description |
|---|---|---|
errorrequired | string | Error 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. |
messageoptional | string | Optional explanation generated by SendSMS. Intended for people; wording/language may change. Absence means the handler supplied no separate explanation. |
codeoptional | string | Optional machine-readable code generated by SendSMS or its HTTP framework. Meaning depends on the operation; not a universal numeric provider code. |
statusCodeoptional | integer | Optional HTTP status number generated by the server framework for a framework-level error. The actual HTTP response status is authoritative. |
errorsoptional | array<object> | Optional field-validation issues generated by SendSMS, typically for template create/update. An absent array is not an empty successful result. |
errors[].fieldoptional | string | Request field identified by the SendSMS validator, such as name or body. |
errors[].messageoptional | string | Optional explanation generated by SendSMS. Intended for people; wording/language may change. Absence means the handler supplied no separate explanation. |
missingoptional | array<string> | Variable names SendSMS found missing from a template send/preview request. Present only for relevant template errors. |
invalidoptional | array<object> | Invalid variable values identified by SendSMS, with variable name and validation reason. |
invalid[].nameoptional | string | Variable 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. |
invalid[].reasonoptional | string | SendSMS validation reason: value_too_long, invalid_characters or unsupported_type. It describes a variable value, not network delivery. |
retryableoptional | boolean | Optional SendSMS hint that an operation may be retried after contention/unavailability. It never authorizes a new logical send with a different idempotency key. |
messageIdoptional | string · uuid | Message 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. |
duplicateoptional | boolean | Optional 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. |
channeloptional | string | Requested channel echoed by SendSMS in a channel-availability refusal. |
reasonsoptional | array<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. |
mnpoptional | string | MNP decision state reported by SendSMS in an applicable network-lookup refusal. Not proof that an external provider was contacted. |
estimatedWaitSecondsoptional | integer | Present with transactional_overloaded: the forecast wait in seconds (1 to 30), equal to the Retry-After header. |
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
| Field | Type | Description |
|---|---|---|
errorrequired | string | Error 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. |
messageoptional | string | Optional explanation generated by SendSMS. Intended for people; wording/language may change. Absence means the handler supplied no separate explanation. |
codeoptional | string | Optional machine-readable code generated by SendSMS or its HTTP framework. Meaning depends on the operation; not a universal numeric provider code. |
statusCodeoptional | integer | Optional HTTP status number generated by the server framework for a framework-level error. The actual HTTP response status is authoritative. |
errorsoptional | array<object> | Optional field-validation issues generated by SendSMS, typically for template create/update. An absent array is not an empty successful result. |
errors[].fieldoptional | string | Request field identified by the SendSMS validator, such as name or body. |
errors[].messageoptional | string | Optional explanation generated by SendSMS. Intended for people; wording/language may change. Absence means the handler supplied no separate explanation. |
missingoptional | array<string> | Variable names SendSMS found missing from a template send/preview request. Present only for relevant template errors. |
invalidoptional | array<object> | Invalid variable values identified by SendSMS, with variable name and validation reason. |
invalid[].nameoptional | string | Variable 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. |
invalid[].reasonoptional | string | SendSMS validation reason: value_too_long, invalid_characters or unsupported_type. It describes a variable value, not network delivery. |
retryableoptional | boolean | Optional SendSMS hint that an operation may be retried after contention/unavailability. It never authorizes a new logical send with a different idempotency key. |
messageIdoptional | string · uuid | Message 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. |
duplicateoptional | boolean | Optional 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. |
channeloptional | string | Requested channel echoed by SendSMS in a channel-availability refusal. |
reasonsoptional | array<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. |
mnpoptional | string | MNP decision state reported by SendSMS in an applicable network-lookup refusal. Not proof that an external provider was contacted. |
estimatedWaitSecondsoptional | integer | Present with transactional_overloaded: the forecast wait in seconds (1 to 30), equal to the Retry-After header. |
404Resource unavailable to this account
Check the resource ID and whether it belongs to the API key account.
Response format
| Field | Type | Description |
|---|---|---|
errorrequired | string | Error 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. |
messageoptional | string | Optional explanation generated by SendSMS. Intended for people; wording/language may change. Absence means the handler supplied no separate explanation. |
codeoptional | string | Optional machine-readable code generated by SendSMS or its HTTP framework. Meaning depends on the operation; not a universal numeric provider code. |
statusCodeoptional | integer | Optional HTTP status number generated by the server framework for a framework-level error. The actual HTTP response status is authoritative. |
errorsoptional | array<object> | Optional field-validation issues generated by SendSMS, typically for template create/update. An absent array is not an empty successful result. |
errors[].fieldoptional | string | Request field identified by the SendSMS validator, such as name or body. |
errors[].messageoptional | string | Optional explanation generated by SendSMS. Intended for people; wording/language may change. Absence means the handler supplied no separate explanation. |
missingoptional | array<string> | Variable names SendSMS found missing from a template send/preview request. Present only for relevant template errors. |
invalidoptional | array<object> | Invalid variable values identified by SendSMS, with variable name and validation reason. |
invalid[].nameoptional | string | Variable 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. |
invalid[].reasonoptional | string | SendSMS validation reason: value_too_long, invalid_characters or unsupported_type. It describes a variable value, not network delivery. |
retryableoptional | boolean | Optional SendSMS hint that an operation may be retried after contention/unavailability. It never authorizes a new logical send with a different idempotency key. |
messageIdoptional | string · uuid | Message 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. |
duplicateoptional | boolean | Optional 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. |
channeloptional | string | Requested channel echoed by SendSMS in a channel-availability refusal. |
reasonsoptional | array<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. |
mnpoptional | string | MNP decision state reported by SendSMS in an applicable network-lookup refusal. Not proof that an external provider was contacted. |
estimatedWaitSecondsoptional | integer | Present with transactional_overloaded: the forecast wait in seconds (1 to 30), equal to the Retry-After header. |
409Conflict
Check the current resource state and operation conditions before retrying.
Response format
| Field | Type | Description |
|---|---|---|
errorrequired | string | Error 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. |
messageoptional | string | Optional explanation generated by SendSMS. Intended for people; wording/language may change. Absence means the handler supplied no separate explanation. |
codeoptional | string | Optional machine-readable code generated by SendSMS or its HTTP framework. Meaning depends on the operation; not a universal numeric provider code. |
statusCodeoptional | integer | Optional HTTP status number generated by the server framework for a framework-level error. The actual HTTP response status is authoritative. |
errorsoptional | array<object> | Optional field-validation issues generated by SendSMS, typically for template create/update. An absent array is not an empty successful result. |
errors[].fieldoptional | string | Request field identified by the SendSMS validator, such as name or body. |
errors[].messageoptional | string | Optional explanation generated by SendSMS. Intended for people; wording/language may change. Absence means the handler supplied no separate explanation. |
missingoptional | array<string> | Variable names SendSMS found missing from a template send/preview request. Present only for relevant template errors. |
invalidoptional | array<object> | Invalid variable values identified by SendSMS, with variable name and validation reason. |
invalid[].nameoptional | string | Variable 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. |
invalid[].reasonoptional | string | SendSMS validation reason: value_too_long, invalid_characters or unsupported_type. It describes a variable value, not network delivery. |
retryableoptional | boolean | Optional SendSMS hint that an operation may be retried after contention/unavailability. It never authorizes a new logical send with a different idempotency key. |
messageIdoptional | string · uuid | Message 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. |
duplicateoptional | boolean | Optional 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. |
channeloptional | string | Requested channel echoed by SendSMS in a channel-availability refusal. |
reasonsoptional | array<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. |
mnpoptional | string | MNP decision state reported by SendSMS in an applicable network-lookup refusal. Not proof that an external provider was contacted. |
estimatedWaitSecondsoptional | integer | Present with transactional_overloaded: the forecast wait in seconds (1 to 30), equal to the Retry-After header. |
422Validation or eligibility failure
Correct the data or eligibility conditions indicated in the response.
Response format
| Field | Type | Description |
|---|---|---|
errorrequired | string | Error 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. |
messageoptional | string | Optional explanation generated by SendSMS. Intended for people; wording/language may change. Absence means the handler supplied no separate explanation. |
codeoptional | string | Optional machine-readable code generated by SendSMS or its HTTP framework. Meaning depends on the operation; not a universal numeric provider code. |
statusCodeoptional | integer | Optional HTTP status number generated by the server framework for a framework-level error. The actual HTTP response status is authoritative. |
errorsoptional | array<object> | Optional field-validation issues generated by SendSMS, typically for template create/update. An absent array is not an empty successful result. |
errors[].fieldoptional | string | Request field identified by the SendSMS validator, such as name or body. |
errors[].messageoptional | string | Optional explanation generated by SendSMS. Intended for people; wording/language may change. Absence means the handler supplied no separate explanation. |
missingoptional | array<string> | Variable names SendSMS found missing from a template send/preview request. Present only for relevant template errors. |
invalidoptional | array<object> | Invalid variable values identified by SendSMS, with variable name and validation reason. |
invalid[].nameoptional | string | Variable 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. |
invalid[].reasonoptional | string | SendSMS validation reason: value_too_long, invalid_characters or unsupported_type. It describes a variable value, not network delivery. |
retryableoptional | boolean | Optional SendSMS hint that an operation may be retried after contention/unavailability. It never authorizes a new logical send with a different idempotency key. |
messageIdoptional | string · uuid | Message 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. |
duplicateoptional | boolean | Optional 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. |
channeloptional | string | Requested channel echoed by SendSMS in a channel-availability refusal. |
reasonsoptional | array<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. |
mnpoptional | string | MNP decision state reported by SendSMS in an applicable network-lookup refusal. Not proof that an external provider was contacted. |
estimatedWaitSecondsoptional | integer | Present with transactional_overloaded: the forecast wait in seconds (1 to 30), equal to the Retry-After header. |
429Rate limit. When admission by capacity is switched on by the platform (off by default): also transactional_overloaded - the transactional queue is full, nothing was created; respect Retry-After and repeat with the same Idempotency-Key.
Reduce the request rate and delay retries. The general per-second limit: code = rate_limit_exceeded.
Response format
| Field | Type | Description |
|---|---|---|
errorrequired | string | Error 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. |
messageoptional | string | Optional explanation generated by SendSMS. Intended for people; wording/language may change. Absence means the handler supplied no separate explanation. |
codeoptional | string | Optional machine-readable code generated by SendSMS or its HTTP framework. Meaning depends on the operation; not a universal numeric provider code. |
statusCodeoptional | integer | Optional HTTP status number generated by the server framework for a framework-level error. The actual HTTP response status is authoritative. |
errorsoptional | array<object> | Optional field-validation issues generated by SendSMS, typically for template create/update. An absent array is not an empty successful result. |
errors[].fieldoptional | string | Request field identified by the SendSMS validator, such as name or body. |
errors[].messageoptional | string | Optional explanation generated by SendSMS. Intended for people; wording/language may change. Absence means the handler supplied no separate explanation. |
missingoptional | array<string> | Variable names SendSMS found missing from a template send/preview request. Present only for relevant template errors. |
invalidoptional | array<object> | Invalid variable values identified by SendSMS, with variable name and validation reason. |
invalid[].nameoptional | string | Variable 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. |
invalid[].reasonoptional | string | SendSMS validation reason: value_too_long, invalid_characters or unsupported_type. It describes a variable value, not network delivery. |
retryableoptional | boolean | Optional SendSMS hint that an operation may be retried after contention/unavailability. It never authorizes a new logical send with a different idempotency key. |
messageIdoptional | string · uuid | Message 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. |
duplicateoptional | boolean | Optional 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. |
channeloptional | string | Requested channel echoed by SendSMS in a channel-availability refusal. |
reasonsoptional | array<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. |
mnpoptional | string | MNP decision state reported by SendSMS in an applicable network-lookup refusal. Not proof that an external provider was contacted. |
estimatedWaitSecondsoptional | integer | Present with transactional_overloaded: the forecast wait in seconds (1 to 30), equal to the Retry-After header. |
503Temporarily unavailable. When admission by capacity is switched on by the platform (off by default): also otp_capacity - no capacity for one-time codes right now, nothing was created; repeat once after Retry-After, then use a fallback channel.
The service is temporarily unavailable. Before retrying an SMS submission, check whether the previous request was accepted.
Response format
| Field | Type | Description |
|---|---|---|
errorrequired | string | Error 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. |
messageoptional | string | Optional explanation generated by SendSMS. Intended for people; wording/language may change. Absence means the handler supplied no separate explanation. |
codeoptional | string | Optional machine-readable code generated by SendSMS or its HTTP framework. Meaning depends on the operation; not a universal numeric provider code. |
statusCodeoptional | integer | Optional HTTP status number generated by the server framework for a framework-level error. The actual HTTP response status is authoritative. |
errorsoptional | array<object> | Optional field-validation issues generated by SendSMS, typically for template create/update. An absent array is not an empty successful result. |
errors[].fieldoptional | string | Request field identified by the SendSMS validator, such as name or body. |
errors[].messageoptional | string | Optional explanation generated by SendSMS. Intended for people; wording/language may change. Absence means the handler supplied no separate explanation. |
missingoptional | array<string> | Variable names SendSMS found missing from a template send/preview request. Present only for relevant template errors. |
invalidoptional | array<object> | Invalid variable values identified by SendSMS, with variable name and validation reason. |
invalid[].nameoptional | string | Variable 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. |
invalid[].reasonoptional | string | SendSMS validation reason: value_too_long, invalid_characters or unsupported_type. It describes a variable value, not network delivery. |
retryableoptional | boolean | Optional SendSMS hint that an operation may be retried after contention/unavailability. It never authorizes a new logical send with a different idempotency key. |
messageIdoptional | string · uuid | Message 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. |
duplicateoptional | boolean | Optional 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. |
channeloptional | string | Requested channel echoed by SendSMS in a channel-availability refusal. |
reasonsoptional | array<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. |
mnpoptional | string | MNP decision state reported by SendSMS in an applicable network-lookup refusal. Not proof that an external provider was contacted. |
estimatedWaitSecondsoptional | integer | Present with transactional_overloaded: the forecast wait in seconds (1 to 30), equal to the Retry-After header. |