curl --request GET \
--url https://api.otpbay.com/v1/messages/sms/{sid} \
--header 'Authorization: Bearer <token>'const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.otpbay.com/v1/messages/sms/{sid}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.otpbay.com/v1/messages/sms/{sid}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.otpbay.com/v1/messages/sms/{sid}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.otpbay.com/v1/messages/sms/{sid}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.otpbay.com/v1/messages/sms/{sid}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.otpbay.com/v1/messages/sms/{sid}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_bodyusing RestSharp;
var options = new RestClientOptions("https://api.otpbay.com/v1/messages/sms/{sid}");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("Authorization", "Bearer <token>");
var response = await client.GetAsync(request);
Console.WriteLine("{0}", response.Content);
{
"sid": "SM6650c4b7c2d3e4f5a6b7c8d9",
"status": "sent",
"to": "+447700900123",
"from": "Acme",
"body": "Your Acme order 1042 has shipped.",
"sms_segments": 1,
"cost": "0.04",
"metadata": {
"order_id": "1042"
},
"date_created": "2026-09-26T10:20:11.302Z",
"processed_at": "2026-09-26T10:20:12.019Z"
}{
"error": {
"code": "INVALID_MESSAGE_SID",
"message": "`sid` must match VExxxxxxxxxxxxxxxxxxxxxxxx (ObjectId hex)."
}
}{
"error": {
"code": "INVALID_API_KEY",
"message": "Invalid API key."
}
}{
"error": {
"code": "IP_NOT_ALLOWED",
"message": "This IP address is not allowed for this project."
}
}{
"error": {
"code": "SMS_MESSAGE_NOT_FOUND",
"message": "SMS message was not found for this account."
}
}Get an SMS
Returns an SMS sent by your project and its current status.
curl --request GET \
--url https://api.otpbay.com/v1/messages/sms/{sid} \
--header 'Authorization: Bearer <token>'const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.otpbay.com/v1/messages/sms/{sid}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.otpbay.com/v1/messages/sms/{sid}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.otpbay.com/v1/messages/sms/{sid}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.otpbay.com/v1/messages/sms/{sid}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.otpbay.com/v1/messages/sms/{sid}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.otpbay.com/v1/messages/sms/{sid}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_bodyusing RestSharp;
var options = new RestClientOptions("https://api.otpbay.com/v1/messages/sms/{sid}");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("Authorization", "Bearer <token>");
var response = await client.GetAsync(request);
Console.WriteLine("{0}", response.Content);
{
"sid": "SM6650c4b7c2d3e4f5a6b7c8d9",
"status": "sent",
"to": "+447700900123",
"from": "Acme",
"body": "Your Acme order 1042 has shipped.",
"sms_segments": 1,
"cost": "0.04",
"metadata": {
"order_id": "1042"
},
"date_created": "2026-09-26T10:20:11.302Z",
"processed_at": "2026-09-26T10:20:12.019Z"
}{
"error": {
"code": "INVALID_MESSAGE_SID",
"message": "`sid` must match VExxxxxxxxxxxxxxxxxxxxxxxx (ObjectId hex)."
}
}{
"error": {
"code": "INVALID_API_KEY",
"message": "Invalid API key."
}
}{
"error": {
"code": "IP_NOT_ALLOWED",
"message": "This IP address is not allowed for this project."
}
}{
"error": {
"code": "SMS_MESSAGE_NOT_FOUND",
"message": "SMS message was not found for this account."
}
}Authorizations
Your project API key, sent as Authorization: Bearer otp_live_.... Create keys on the API Keys page of the dashboard.
Path Parameters
The SMS sid returned when you sent it.
^SM[a-fA-F0-9]{24}$"SM6650c4b7c2d3e4f5a6b7c8d9"
Response
The SMS.
Unique SMS ID.
^SM[a-f0-9]{24}$"SM6650c4b7c2d3e4f5a6b7c8d9"
queued → processing → sent when the carrier accepts the message, or failed after retries. enqueue_failed means the message was saved but never queued.
queued, processing, sent, failed, enqueue_failed Destination phone number in international format. OTPBay normalizes it to E.164, so +1 (415) 555-2671 becomes +14155552671.
"+14155552671"
Sender ID the message was sent from.
"Acme"
"Your Acme order 1042 has shipped."
Number of billed segments.
1
Price of the message (per-segment price × segments).
^\d+\.\d{2}$"0.04"
When the carrier accepted the message.
Latest delivery error. Only present when there is one.