POST
/sms/send
Send an SMS from your assigned number
Description
Outbound SMS dispatched from the number bound to the bearer token. Returns the carrier `message_id` once the message is queued for delivery. Long messages are concatenated client-side — there is no built-in segmentation.
Authentication
Bearer required. Send Authorization: Bearer <token>.
Code samples
Pick your runtime. Every sample is in the page source — switching tabs is for your eyes.
curl https://agentnumber.really.com/sms/send \
--request POST \
--header 'Authorization: Bearer <your-token>' \
--header 'content-type: application/json' \
--data '{
"to": "+15555550199",
"body": "Hello from my agent."
}'interface SendResponse {
message_id: string;
status: string;
}
const response = await fetch('https://agentnumber.really.com/sms/send', {
method: 'POST',
headers: {
Authorization: 'Bearer <your-token>',
'content-type': 'application/json'
},
body: JSON.stringify({
to: '+15555550199',
body: 'Hello from my agent.'
})
});
if (!response.ok) {
throw new Error(`send an sms from your assigned number failed: ${response.status}`);
}
const data = (await response.json()) as SendResponse;
requests.post("https://agentnumber.really.com/sms/send",
headers={
"Authorization": "Bearer <your-token>",
"content-type": "application/json"
},
json={
"to": "+15555550199",
"body": "Hello from my agent."
}
)package main
import (
"fmt"
"io"
"net/http"
"strings"
)
func main() {
requestUrl := "https://agentnumber.really.com/sms/send"
payload := strings.NewReader(`{
"to": "+15555550199",
"body": "Hello from my agent."
}`)
req, _ := http.NewRequest("POST", requestUrl, payload)
req.Header.Add("Authorization", "Bearer <your-token>")
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}fetch('https://agentnumber.really.com/sms/send', {
method: 'POST',
headers: {
Authorization: 'Bearer <your-token>',
'content-type': 'application/json'
},
body: JSON.stringify({
to: '+15555550199',
body: 'Hello from my agent.'
})
})import { request } from 'undici'
const { statusCode, body } = await request('https://agentnumber.really.com/sms/send', {
method: 'POST',
headers: {
Authorization: 'Bearer <your-token>',
'content-type': 'application/json'
},
body: JSON.stringify({
to: '+15555550199',
body: 'Hello from my agent.'
})
})require 'uri'
require 'net/http'
url = URI("https://agentnumber.really.com/sms/send")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <your-token>'
request["content-type"] = 'application/json'
request.body = <<~JSON
{
"to": "+15555550199",
"body": "Hello from my agent."
}
JSON
response = http.request(request)
puts response.read_bodyimport Foundation
var request = URLRequest(url: URL(string: "https://agentnumber.really.com/sms/send")!)
request.httpMethod = "POST"
request.setValue("Bearer <your-token>", forHTTPHeaderField: "Authorization")
request.setValue("application/json", forHTTPHeaderField: "content-type")
let jsonBody = #"""
{
"to": "+15555550199",
"body": "Hello from my agent."
}
"""#
request.httpBody = jsonBody.data(using: .utf8)
let (data, response) = try await URLSession.shared.data(for: request)
guard let httpResponse = response as? HTTPURLResponse,
200..<300 ~= httpResponse.statusCode else {
throw URLError(.badServerResponse)
}
print(String(data: data, encoding: .utf8) ?? "")val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"to\": \"+15555550199\",\n \"body\": \"Hello from my agent.\"\n}")
val request = Request.Builder()
.url("https://agentnumber.really.com/sms/send")
.post(body)
.addHeader("Authorization", "Bearer <your-token>")
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()POST /sms/send HTTP/1.1
Host: agentnumber.really.com
Authorization: Bearer <your-token>
content-type: application/json
Content-Type: application/json
{
"to": "+15555550199",
"body": "Hello from my agent."
}HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://agentnumber.really.com/sms/send"))
.header("Authorization", "Bearer <your-token>")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"to\": \"+15555550199\",\n \"body\": \"Hello from my agent.\"\n}"))
.build();
HttpResponse<String> response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());#import <Foundation/Foundation.h>
NSDictionary *headers = @{ @"Authorization": @"Bearer <your-token>",
@"content-type": @"application/json" };
NSDictionary *parameters = @{ @"to": @"+15555550199",
@"body": @"Hello from my agent." };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://agentnumber.really.com/sms/send"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];using var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://agentnumber.really.com/sms/send");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", "<your-token>");
request.Content = new StringContent(
"""
{
"to": "+15555550199",
"body": "Hello from my agent."
}
""",
System.Text.Encoding.UTF8, "application/json");
using var response = await client.SendAsync(request);#include <curl/curl.h>
int main(void) {
curl_global_init(CURL_GLOBAL_DEFAULT);
CURL *curl = curl_easy_init();
if (!curl) {
curl_global_cleanup();
return 1;
}
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(curl, CURLOPT_URL, "https://agentnumber.really.com/sms/send");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "Authorization: Bearer <your-token>");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "{\n \"to\": \"+15555550199\",\n \"body\": \"Hello from my agent.\"\n}");
CURLcode res = curl_easy_perform(curl);
curl_easy_cleanup(curl);
curl_slist_free_all(headers);
curl_global_cleanup();
return (int)res;
}import 'package:http/http.dart' as http;
void main() async {
final headers = <String,String>{
'Authorization': 'Bearer <your-token>',
'content-type': 'application/json',
};
final body = r'{
"to": "+15555550199",
"body": "Hello from my agent."
}';
final response = await http.post(Uri.parse('https://agentnumber.really.com/sms/send'), headers: headers, body: body);
print(response.body);
}let client = reqwest::Client::new();
let request = client
.post("https://agentnumber.really.com/sms/send")
.header("Authorization", "Bearer <your-token>")
.header("content-type", "application/json")
.json(&serde_json::json!({
"to": "+15555550199",
"body": "Hello from my agent."
}));
let response = request.send().await?;$ch = curl_init("https://agentnumber.really.com/sms/send");
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer <your-token>', 'content-type: application/json']);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
'to' => '+15555550199',
'body' => 'Hello from my agent.'
]));
curl_exec($ch);
curl_close($ch);Request body
| Field | Type | Description |
|---|---|---|
to required |
string |
Destination phone number in E.164 format (`+1...`). Example: +15555550199 |
body required |
string |
Message text. UTF-8. Example: Hello from my agent. |
Example body
{
"to": "+15555550199",
"body": "Hello from my agent."
}
Responses
200 Message queued for delivery.
{
"message_id": "msg_example_0000000000000000000000",
"status": "queued"
}
400 Body missing `to` or `body` field.
{
"error": "invalid_request",
"message": "missing required fields: to, body"
}
401 Missing, invalid, revoked, or expired bearer token.
{
"error": "unauthorized",
"message": "invalid, revoked, or expired token"
}
502 Upstream phone-node returned an error. Usually transient — retry.
{
"error": "phone_node_error",
"message": "Mac returned 503"
}