Messages
Message statuses
/v1/messages/statusesRead-only batch. Unique UUID ids,1..100. Input order is preserved. Missing and foreign IDs each return found:false; authorized items remain available. No sends or debits.
/v1/messages/statusescURL. The key is in the SENDSMS_API_KEY environment variable.
curl --max-time 30 --request POST \
--url 'https://api.sendsms.to/v1/messages/statuses' \
--header "X-API-Key: $SENDSMS_API_KEY" \
--header 'Content-Type: application/json' \
--data '{
"ids": [
"MESSAGE_ID"
]
}'Node.js 18+ (built-in fetch).
const response = await fetch("https://api.sendsms.to/v1/messages/statuses", {
method: "POST",
headers: {
'X-API-Key': process.env.SENDSMS_API_KEY,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"ids": [
"MESSAGE_ID"
]
}),
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
payload = {
"ids": [
"MESSAGE_ID",
],
}
request = urllib.request.Request(
"https://api.sendsms.to/v1/messages/statuses",
method="POST",
headers={
"X-API-Key": os.environ["SENDSMS_API_KEY"],
"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/statuses");
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTPHEADER => [
'X-API-Key: ' . getenv('SENDSMS_API_KEY'),
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => '{"ids":["MESSAGE_ID"]}',
]);
$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'
uri = URI('https://api.sendsms.to/v1/messages/statuses')
request = Net::HTTPGenericRequest.new('POST', true, true, uri.request_uri)
request['X-API-Key'] = ENV.fetch('SENDSMS_API_KEY')
request['Content-Type'] = 'application/json'
request.body = '{"ids":["MESSAGE_ID"]}'
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 (
"fmt"
"io"
"net/http"
"os"
"strings"
"time"
)
func main() {
body := strings.NewReader("{\"ids\":[\"MESSAGE_ID\"]}")
req, err := http.NewRequest("POST", "https://api.sendsms.to/v1/messages/statuses", body)
if err != nil {
panic(err)
}
req.Header.Set("X-API-Key", os.Getenv("SENDSMS_API_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/statuses");
request.Headers.Add("X-API-Key", Environment.GetEnvironmentVariable("SENDSMS_API_KEY"));
request.Content = new StringContent("{\"ids\":[\"MESSAGE_ID\"]}", 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/statuses"))
.timeout(Duration.ofSeconds(30))
.header("X-API-Key", System.getenv("SENDSMS_API_KEY"))
.header("Content-Type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\"ids\":[\"MESSAGE_ID\"]}"))
.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';
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/statuses'));
request.headers.set('X-API-Key', Platform.environment['SENDSMS_API_KEY'] ?? '');
request.headers.contentType = ContentType.json;
request.write('{"ids":["MESSAGE_ID"]}');
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 |
|---|---|---|
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 |
|---|---|---|
idsrequired | array<string> | maxItems: 100 |
#Responses
200Successful result
Response format
| Field | Type | Description |
|---|---|---|
resultsrequired | array<object> | One result per requested ID, constructed by SendSMS in the original request order. This read creates no messages.maxItems: 100 |
results[].idrequiredresults[].found = true | string · uuid | The requested UUID copied by SendSMS and normalized to lowercase. Its presence does not prove the message exists or belongs to the caller. |
results[].foundrequiredresults[].found = true | boolean | SendSMS lookup result: true = message belongs to this account; false = missing or belongs to another account. The two false cases are intentionally indistinguishable.const: true |
results[].messagerequiredresults[].found = true | object | MessageSnapshot generated by SendSMS only when found=true. Absent, not null, when found=false. |
results[].message.idrequiredresults[].found = true | 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. |
results[].message.channelrequiredresults[].found = true | string | Transport channel stored by SendSMS at admission. SMS uses sms. |
results[].message.destinationrequiredresults[].found = true | string | Recipient destination stored by SendSMS from the accepted request. Use your retained message ID for correlation, not assumptions about plus-sign formatting. |
results[].message.statusrequiredresults[].found = true | string | Current lifecycle state maintained by SendSMS from admission, routing and transport/delivery evidence. Known values and meanings are listed below; preserve unknown future values. It is not a raw SMPP status code."prepared" "queued" "pending" "retrying" "sent" "submission_ambiguous" "ambiguous" "failed" "throttled" "delivered" "undeliverable" "suppressed" "blocked_consent" "expired" "rejected" "cancelled" "rejected_insufficient_credit"
|
results[].message.created_atrequiredresults[].found = true | string · date-time | Database timestamp set when SendSMS creates the message record; ISO 8601 UTC. PostgreSQL now() is transaction-start time, not proof of commit, send or handset delivery time. |
results[].message.updated_atrequiredresults[].found = true | string · date-time | Last message-row update timestamp recorded by SendSMS; ISO 8601 UTC. May reflect a status or other row change. Not a dedicated delivery timestamp. |
results[].message.status_inforequiredresults[].found = true | object | Customer-facing interpretation calculated by SendSMS from the current status. Does not perform a provider lookup. |
results[].message.status_info.knownrequiredresults[].found = true | boolean | SendSMS sets true if status is recognized by this API version. false means a future/unknown value; keep it and treat the outcome as uncertain. |
results[].message.status_info.outcomerequiredresults[].found = true | string | SendSMS summary: pending = processing continues; uncertain = no safe final conclusion; delivered = delivery confirmed; not_delivered = recorded negative outcome."pending" "uncertain" "delivered" "not_delivered" |
results[].message.status_info.poll_after_secondsrequiredresults[].found = true | integer | null | Polling delay suggested by SendSMS, in seconds: 5 for pending/uncertain, null for delivered/not_delivered. Not a delivery deadline or a Unix timestamp.5 null |
results[].message.status_info.resubmit_saferequiredresults[].found = true | boolean | Always false in this version: SendSMS never authorizes a new send from a status read. Retry an original send only using its original idempotency contract.const: false |
results[].message.transportrequiredresults[].found = true | object | null | Last transport attempt stored by SendSMS. null if no attempt record exists. This is not a handset delivery receipt and contains no operator credentials or upstream costs. |
results[].message.transport.attemptrequiredresults[].found = true | integer | Per-message attempt number assigned by SendSMS. Identifies an attempt, not another message; do not use it as messageId. |
results[].message.transport.statusrequiredresults[].found = true | string | Attempt state recorded by SendSMS from transport results. submitted/reconciled_accepted mean transport acceptance, not handset delivery; ambiguous is uncertain. See value descriptions below."pending" "submitted" "failed" "throttled" "ambiguous" "reconciled_accepted" "reconciled_rejected"
|
results[].message.transport.started_atrequiredresults[].found = true | string | null · date-time | Attempt start recorded by SendSMS. ISO 8601 UTC or null when not recorded/scheduled. |
results[].message.transport.resolved_atrequiredresults[].found = true | string | null · date-time | Attempt result resolution recorded by SendSMS, not handset delivery. ISO 8601 UTC or null when not recorded/scheduled. |
results[].message.transport.next_attempt_atrequiredresults[].found = true | string | null · date-time | Next retry time scheduled by SendSMS; not a promised delivery time. ISO 8601 UTC or null when not recorded/scheduled. |
results[].message.transport.submitted_segmentsrequiredresults[].found = true | integer | Count of SMS segments recorded by SendSMS as submitted in this attempt from transport acknowledgements. Not a count of delivered logical messages. |
results[].message.transport.total_segmentsrequiredresults[].found = true | integer | null | Total expected SMS segments recorded for this attempt by SendSMS. null means unavailable, not zero. |
results[].idrequiredresults[].found = false, results[].error = "message_not_found" | string · uuid | The requested UUID copied by SendSMS and normalized to lowercase. Its presence does not prove the message exists or belongs to the caller. |
results[].foundrequiredresults[].found = false, results[].error = "message_not_found" | boolean | SendSMS lookup result: true = message belongs to this account; false = missing or belongs to another account. The two false cases are intentionally indistinguishable.const: false |
results[].errorrequiredresults[].found = false, results[].error = "message_not_found" | string | SendSMS returns message_not_found only in the found=false branch. Not a delivery failure status.const: "message_not_found" |
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 |
400Invalid input
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. |
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. |
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. |
413Body exceeds 8192 bytes
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. |
429Rate limit
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. |
503Temporarily unavailable
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. |