curl --request GET \
--url https://api.otpbay.com/v1/messages/telegram/{sid} \
--header 'Authorization: Bearer <token>'const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.otpbay.com/v1/messages/telegram/{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/telegram/{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/telegram/{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/telegram/{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/telegram/{sid}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.otpbay.com/v1/messages/telegram/{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/telegram/{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": "TG6650c52ad3e4f5a6b7c8d9e0",
"status": "read",
"verification_status": null,
"to": "+14155552671",
"code_length": 6,
"cost": "0.02",
"date_created": "2026-09-26T10:22:40.011Z",
"expires_at": "2026-09-26T10:27:40.011Z",
"delivered_at": "2026-09-26T10:22:41.508Z",
"verified_at": null,
"metadata": {
"user_id": "usr_1042"
}
}{
"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": "TELEGRAM_MESSAGE_NOT_FOUND",
"message": "Telegram message was not found for this account."
}
}Get a Telegram code
Returns a Telegram code and its delivery status. The status is refreshed from Telegram when it may have changed.
curl --request GET \
--url https://api.otpbay.com/v1/messages/telegram/{sid} \
--header 'Authorization: Bearer <token>'const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.otpbay.com/v1/messages/telegram/{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/telegram/{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/telegram/{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/telegram/{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/telegram/{sid}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.otpbay.com/v1/messages/telegram/{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/telegram/{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": "TG6650c52ad3e4f5a6b7c8d9e0",
"status": "read",
"verification_status": null,
"to": "+14155552671",
"code_length": 6,
"cost": "0.02",
"date_created": "2026-09-26T10:22:40.011Z",
"expires_at": "2026-09-26T10:27:40.011Z",
"delivered_at": "2026-09-26T10:22:41.508Z",
"verified_at": null,
"metadata": {
"user_id": "usr_1042"
}
}{
"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": "TELEGRAM_MESSAGE_NOT_FOUND",
"message": "Telegram 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 Telegram code sid returned by Send a Telegram code.
^TG[a-fA-F0-9]{24}$"TG6650c52ad3e4f5a6b7c8d9e0"
Response
The Telegram code.
Unique Telegram code ID.
^TG[a-f0-9]{24}$"TG6650c52ad3e4f5a6b7c8d9e0"
Delivery status reported by Telegram. failed means the code never reached Telegram.
sending, sent, delivered, read, expired, revoked, failed Result of the latest code check, or null before the first check.
code_valid, code_invalid, code_max_attempts_exceeded, expired, null Destination phone number in international format. OTPBay normalizes it to E.164, so +1 (415) 555-2671 becomes +14155552671.
"+14155552671"
Number of digits in the code.
6
What this code currently costs. 0.00 after a refund.
^\d+\.\d{2}$"0.02"
Why the code couldn't be sent. Only present when there is one.