Send SMS (US)
curl --request POST \
--url https://api.withallo.com/v1/api/sms \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"from": "+1234567890",
"to": "+0987654321",
"message": "Hello, this is a test message"
}
'import requests
url = "https://api.withallo.com/v1/api/sms"
payload = {
"from": "+1234567890",
"to": "+0987654321",
"message": "Hello, this is a test message"
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
from: '+1234567890',
to: '+0987654321',
message: 'Hello, this is a test message'
})
};
fetch('https://api.withallo.com/v1/api/sms', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.withallo.com/v1/api/sms",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'from' => '+1234567890',
'to' => '+0987654321',
'message' => 'Hello, this is a test message'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.withallo.com/v1/api/sms"
payload := strings.NewReader("{\n \"from\": \"+1234567890\",\n \"to\": \"+0987654321\",\n \"message\": \"Hello, this is a test message\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.withallo.com/v1/api/sms")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"from\": \"+1234567890\",\n \"to\": \"+0987654321\",\n \"message\": \"Hello, this is a test message\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.withallo.com/v1/api/sms")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"from\": \"+1234567890\",\n \"to\": \"+0987654321\",\n \"message\": \"Hello, this is a test message\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"from_number": "+1234567890",
"sender_id": null,
"to_number": "+0987654321",
"type": "OUTBOUND",
"content": "Hello, this is a test message",
"start_date": "2024-01-15T10:30:00"
}
}SMS
Send SMS
Send an SMS message to a US phone number using one of your Allo phone numbers. The recipient must be in the same country as your Allo number.
POST
/
v1
/
api
/
sms
Send SMS (US)
curl --request POST \
--url https://api.withallo.com/v1/api/sms \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"from": "+1234567890",
"to": "+0987654321",
"message": "Hello, this is a test message"
}
'import requests
url = "https://api.withallo.com/v1/api/sms"
payload = {
"from": "+1234567890",
"to": "+0987654321",
"message": "Hello, this is a test message"
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
from: '+1234567890',
to: '+0987654321',
message: 'Hello, this is a test message'
})
};
fetch('https://api.withallo.com/v1/api/sms', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.withallo.com/v1/api/sms",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'from' => '+1234567890',
'to' => '+0987654321',
'message' => 'Hello, this is a test message'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.withallo.com/v1/api/sms"
payload := strings.NewReader("{\n \"from\": \"+1234567890\",\n \"to\": \"+0987654321\",\n \"message\": \"Hello, this is a test message\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.withallo.com/v1/api/sms")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"from\": \"+1234567890\",\n \"to\": \"+0987654321\",\n \"message\": \"Hello, this is a test message\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.withallo.com/v1/api/sms")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"from\": \"+1234567890\",\n \"to\": \"+0987654321\",\n \"message\": \"Hello, this is a test message\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"from_number": "+1234567890",
"sender_id": null,
"to_number": "+0987654321",
"type": "OUTBOUND",
"content": "Hello, this is a test message",
"start_date": "2024-01-15T10:30:00"
}
}This endpoint is for sending SMS from US Allo phone numbers. For sending SMS in France, see Send SMS (France).
Authorizations
Scope needed: SMS_SEND
Body
application/json
Request body for sending an SMS message (US)
Your Allo phone number (must be owned by your account)
Example:
"+1234567890"
Recipient phone number (E.164 format, same country as 'from')
Example:
"+0987654321"
Message content
Required string length:
1 - 1000Example:
"Hello, this is a test message"
Response
SMS sent successfully
Standard response wrapper for sent SMS
Sent SMS message details
Show child attributes
Show child attributes
Was this page helpful?
⌘I