Send SMS
Copy page
Send an SMS to one or more recipients.
POST
/api/v1/sms/send
· Permission: sms.send
Request
Section titled “Request”curl -X POST https://restlink23telecom.com/api/v1/sms/send \ -H "X-API-Key: $API_KEY" \ -H "Content-Type: application/json" \ -d '{ "to": [ "+14155551234", "+447911123456" ], "message": "Your verification code is 847291", "sender_id": "MyApp"}'const res = await fetch('https://restlink23telecom.com/api/v1/sms/send', { method: 'POST', headers: { 'X-API-Key': process.env.API_KEY, 'Content-Type': 'application/json' }, body: JSON.stringify({ "to": [ "+14155551234", "+447911123456" ], "message": "Your verification code is 847291", "sender_id": "MyApp" }),});
if (!res.ok) { const err = await res.json(); throw new Error(`${err.error_code}: ${err.description}`);}const data = await res.json();console.log(data);import osimport requests
res = requests.post( "https://restlink23telecom.com/api/v1/sms/send", headers={"X-API-Key": os.environ["API_KEY"]}, json={ "to": ["+14155551234", "+447911123456"], "message": "Your verification code is 847291", "sender_id": "MyApp" },)res.raise_for_status()print(res.json())<?php$ch = curl_init('https://restlink23telecom.com/api/v1/sms/send');curl_setopt_array($ch, [ CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => ['X-API-Key: ' . getenv('API_KEY'), 'Content-Type: application/json'], CURLOPT_POSTFIELDS => json_encode([ 'to' => ['+14155551234', '+447911123456'], 'message' => 'Your verification code is 847291', 'sender_id' => 'MyApp' ]),]);
$response = curl_exec($ch);$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);curl_close($ch);
if ($status !== 200) { throw new Exception("HTTP $status: $response");}$data = json_decode($response, true);print_r($data);require "net/http"require "json"
uri = URI("https://restlink23telecom.com/api/v1/sms/send")req = Net::HTTP::Post.new(uri)req["X-API-Key"] = ENV.fetch("API_KEY")req["Content-Type"] = "application/json"req.body = { to: ["+14155551234", "+447911123456"], message: "Your verification code is 847291", sender_id: "MyApp"}.to_json
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }raise "HTTP #{res.code}: #{res.body}" unless res.is_a?(Net::HTTPSuccess)
puts JSON.parse(res.body)import java.net.URI;import java.net.http.HttpClient;import java.net.http.HttpRequest;import java.net.http.HttpResponse;
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder() .uri(URI.create("https://restlink23telecom.com/api/v1/sms/send")) .header("X-API-Key", System.getenv("API_KEY")) .header("Content-Type", "application/json") .POST(HttpRequest.BodyPublishers.ofString(""" { "to": [ "+14155551234", "+447911123456" ], "message": "Your verification code is 847291", "sender_id": "MyApp" }""")) .build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());System.out.println(response.body());package main
import ( "fmt" "io" "net/http" "os" "strings")
func main() { payload := strings.NewReader(`{ "to": [ "+14155551234", "+447911123456" ], "message": "Your verification code is 847291", "sender_id": "MyApp"}`)
req, err := http.NewRequest("POST", "https://restlink23telecom.com/api/v1/sms/send", payload) if err != nil { panic(err) } req.Header.Set("X-API-Key", os.Getenv("API_KEY")) req.Header.Set("Content-Type", "application/json")
res, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer res.Body.Close()
data, _ := io.ReadAll(res.Body) fmt.Println(string(data))}using System.Text;
using var client = new HttpClient();client.DefaultRequestHeaders.Add("X-API-Key", Environment.GetEnvironmentVariable("API_KEY"));
var json = """{ "to": [ "+14155551234", "+447911123456" ], "message": "Your verification code is 847291", "sender_id": "MyApp"}""";var content = new StringContent(json, Encoding.UTF8, "application/json");var response = await client.PostAsync("https://restlink23telecom.com/api/v1/sms/send", content);
response.EnsureSuccessStatusCode();Console.WriteLine(await response.Content.ReadAsStringAsync());| Field | Type | Required | Description |
|---|---|---|---|
to | string[] | Yes | 1 to 100 phone numbers in E.164 format |
message | string | Yes | Message text — encoding is detected automatically |
sender_id | string | Yes | Alphanumeric sender ID (max 11 chars) or phone number |
Response
Section titled “Response”{ "status": true, "messages": [ {"dnis": "+14155551234", "message_id": "api_42_1743667200123456789_a3f8b2c1d9e45f67", "segment_num": 1}, {"dnis": "+447911123456", "message_id": "api_42_1743667200123456789_b7c4e8f1a2d3690b", "segment_num": 1} ], "results": [ {"dnis": "+14155551234", "message_id": "api_42_1743667200123456789_a3f8b2c1d9e45f67", "segments": 1, "status": "accepted"}, {"dnis": "+447911123456", "message_id": "api_42_1743667200123456789_b7c4e8f1a2d3690b", "segments": 1, "status": "accepted"} ], "summary": { "total_recipients": 2, "total_segments": 2, "total_cost": 0.02, "encoding": "GSM-7", "accepted_count": 2, "blocked_count": 0, "queue_error_count": 0, "config_error_count": 0, "db_error_count": 0 }}| Field | Description |
|---|---|
messages | Accepted messages only (backward-compatible array) |
results | All recipients with their individual status |
summary | Totals: accepted, blocked, errors, cost, detected encoding |
Per-recipient statuses
Section titled “Per-recipient statuses”results[].status | Meaning |
|---|---|
accepted | Queued for delivery |
blocked_country | Recipient’s country is in your blocked list |
queue_error | Internal queue failure |
config_error | SMS sending not configured on the account |
Errors
Section titled “Errors”| HTTP | Code | Description |
|---|---|---|
| 400 | INVALID_BODY | Cannot parse request body |
| 400 | INVALID_TO | Missing or empty to array |
| 400 | INVALID_MESSAGE | Missing or empty message |
| 400 | INVALID_SENDER | Missing or empty sender_id |
| 400 | TOO_MANY_RECIPIENTS | Over 100 recipients |
| 402 | INSUFFICIENT_BALANCE | Balance too low — response includes balance, estimated_cost, currency, total_recipients, billable_recipients, segments |
| 403 | NO_SMS_ACCESS | SMS not enabled on your account |
| 403 | CONFIG_ERROR | SMS credentials incomplete — contact support |
| 403 | WORKSPACE_NOT_AVAILABLE | Target workspace was deleted — use a live workspace |
| 500 | DB_ERROR | Could not queue (atomic rollback) — retry the whole request |
Delivery tracking
Section titled “Delivery tracking”The send response confirms acceptance, not delivery. To learn whether the message reached the handset:
- Webhooks (recommended): receive a delivery report on your server the moment the carrier reports it.
- Polling: call GET /sms/status/:message_id until the status is final.