Verify a Telegram code
curl --request POST \
--url https://api.otpbay.com/v1/messages/telegram/{sid}/verify \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"code": "482913"
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({code: '482913'})
};
fetch('https://api.otpbay.com/v1/messages/telegram/{sid}/verify', 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}/verify"
payload = { "code": "482913" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.otpbay.com/v1/messages/telegram/{sid}/verify",
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([
'code' => '482913'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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.otpbay.com/v1/messages/telegram/{sid}/verify"
payload := strings.NewReader("{\n \"code\": \"482913\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.otpbay.com/v1/messages/telegram/{sid}/verify")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"code\": \"482913\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.otpbay.com/v1/messages/telegram/{sid}/verify")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"code\": \"482913\"\n}"
response = http.request(request)
puts response.read_bodyusing RestSharp;
var options = new RestClientOptions("https://api.otpbay.com/v1/messages/telegram/{sid}/verify");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("Authorization", "Bearer <token>");
request.AddJsonBody("{\n \"code\": \"482913\"\n}", false);
var response = await client.PostAsync(request);
Console.WriteLine("{0}", response.Content);
{
"valid": true,
"sid": "TG6650c52ad3e4f5a6b7c8d9e0",
"status": "read",
"verification_status": "code_valid",
"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": "2026-09-26T10:23:05.117Z",
"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."
}
}{
"error": {
"code": "TELEGRAM_NOT_SENT",
"message": "This code was never sent, so it cannot be verified."
}
}{
"error": {
"code": "INVALID_REQUEST_BODY",
"message": "code: Code must be 4–8 digits"
}
}{
"error": {
"code": "INSUFFICIENT_BALANCE",
"message": "Insufficient balance for this verification."
}
}Telegram
Verify a Telegram code
Checks the code your user entered against a Telegram code. Telegram tracks the attempts and the expiry; read verification_status for the reason a code isn’t valid. A wrong code still returns 200 with valid: false.
POST
/
messages
/
telegram
/
{sid}
/
verify
Verify a Telegram code
curl --request POST \
--url https://api.otpbay.com/v1/messages/telegram/{sid}/verify \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"code": "482913"
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({code: '482913'})
};
fetch('https://api.otpbay.com/v1/messages/telegram/{sid}/verify', 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}/verify"
payload = { "code": "482913" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.otpbay.com/v1/messages/telegram/{sid}/verify",
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([
'code' => '482913'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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.otpbay.com/v1/messages/telegram/{sid}/verify"
payload := strings.NewReader("{\n \"code\": \"482913\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.otpbay.com/v1/messages/telegram/{sid}/verify")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"code\": \"482913\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.otpbay.com/v1/messages/telegram/{sid}/verify")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"code\": \"482913\"\n}"
response = http.request(request)
puts response.read_bodyusing RestSharp;
var options = new RestClientOptions("https://api.otpbay.com/v1/messages/telegram/{sid}/verify");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("Authorization", "Bearer <token>");
request.AddJsonBody("{\n \"code\": \"482913\"\n}", false);
var response = await client.PostAsync(request);
Console.WriteLine("{0}", response.Content);
{
"valid": true,
"sid": "TG6650c52ad3e4f5a6b7c8d9e0",
"status": "read",
"verification_status": "code_valid",
"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": "2026-09-26T10:23:05.117Z",
"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."
}
}{
"error": {
"code": "TELEGRAM_NOT_SENT",
"message": "This code was never sent, so it cannot be verified."
}
}{
"error": {
"code": "INVALID_REQUEST_BODY",
"message": "code: Code must be 4–8 digits"
}
}{
"error": {
"code": "INSUFFICIENT_BALANCE",
"message": "Insufficient balance for this verification."
}
}Authorizations
Path Parameters
Body
application/json
Response
The code was checked. Read valid to see whether it matched.