Sending
Delivery reports and webhooks
How to learn what became of a message: status on request, batch reconciliation and where webhooks stand.
#Status of one message
After a 202 answer keep the messageId and ask GET /v1/messages/{id}. The answer carries the current state, a customer-facing interpretation and the poll_after_seconds hint: how many seconds to wait before asking again.
/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"Node.js 18+ (built-in fetch).
const response = await fetch("https://api.sendsms.to/v1/messages/MESSAGE_ID", {
method: "GET",
headers: {
'X-API-Key': process.env.SENDSMS_API_KEY,
},
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
request = urllib.request.Request(
"https://api.sendsms.to/v1/messages/MESSAGE_ID",
method="GET",
headers={
"X-API-Key": os.environ["SENDSMS_API_KEY"],
},
)
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/MESSAGE_ID");
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTPHEADER => [
'X-API-Key: ' . getenv('SENDSMS_API_KEY'),
],
]);
$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/MESSAGE_ID')
request = Net::HTTPGenericRequest.new('GET', false, true, uri.request_uri)
request['X-API-Key'] = ENV.fetch('SENDSMS_API_KEY')
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"
"time"
)
func main() {
req, err := http.NewRequest("GET", "https://api.sendsms.to/v1/messages/MESSAGE_ID", nil)
if err != nil {
panic(err)
}
req.Header.Set("X-API-Key", os.Getenv("SENDSMS_API_KEY"))
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("GET"), "https://api.sendsms.to/v1/messages/MESSAGE_ID");
request.Headers.Add("X-API-Key", Environment.GetEnvironmentVariable("SENDSMS_API_KEY"));
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/MESSAGE_ID"))
.timeout(Duration.ofSeconds(30))
.header("X-API-Key", System.getenv("SENDSMS_API_KEY"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.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('GET', Uri.parse('https://api.sendsms.to/v1/messages/MESSAGE_ID'));
request.headers.set('X-API-Key', Platform.environment['SENDSMS_API_KEY'] ?? '');
final response = await request.close().timeout(const Duration(seconds: 30));
final body = await response.transform(utf8.decoder).join();
print('${response.statusCode} $body');
client.close();
}{
"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 →
#Many messages at once
To reconcile a list use POST /v1/messages/statuses: up to 100 identifiers per request, answered in the same order.
/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();
}{
"results": [
{
"id": "00000000-0000-0000-0000-000000000002",
"found": true,
"message": {
"id": "00000000-0000-0000-0000-000000000002",
"channel": "sms",
"destination": "+994000000000",
"status": "sent",
"created_at": "2026-10-28T10:00:00Z",
"updated_at": "2026-10-28T10:00:01Z",
"status_info": {
"known": true,
"outcome": "pending",
"poll_after_seconds": 5,
"resubmit_safe": false
},
"transport": {
"attempt": 1,
"status": "submitted",
"started_at": "2026-10-28T10:00:00Z",
"resolved_at": "2026-10-28T10:00:01Z",
"next_attempt_at": null,
"submitted_segments": 1,
"total_segments": 1
}
}
},
{
"id": "00000000-0000-4000-8000-000000000003",
"found": false,
"error": "message_not_found"
}
]
}Answered in the order of your ids; found: false — no such message in your account. All fields and responses — on the method page →
#How often to ask
- Follow
poll_after_seconds; do not poll more often. - Final states do not change any more — you can stop polling such a message.
- An uncertain state is a reason to wait and ask again, not to send the SMS again. Repeat a send only with the same
Idempotency-Key.
#Webhooks
Delivery notifications by subscription (webhooks) are not open in the API yet — they are on the list of resources being prepared for publication. Today the status is read on request as described above. SMPP clients receive delivery receipts (deliver_sm) in the same session — see SMPP.
The response fields and their values are in the reference: Message status; the general rules are in Response fields, identifiers & time.