Get a Telegram code
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."
}
}Telegram
Get a Telegram code
Returns a Telegram code and its delivery status. The status is refreshed from Telegram when it may have changed.
GET
/
messages
/
telegram
/
{sid}
Get a Telegram code
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
Path Parameters
Response
The Telegram code.