Skip to main content

POST Check Verification Status

This endpoint checks the current status of a Telegram OTP verification. Use it after sending an OTP to determine whether the message was delivered, whether the user has entered a code, and whether that code was correct. Optionally, pass the code the user entered to have the Telegram Gateway validate it.

Configure the API Endpoint

https://api.betatel.com/api/v1/connect-hub/telegram/check-verification-status
  • Method: POST

Set Up the Headers

ParamValueDescription
Content-typeapplication/jsonSpecifies the payload format.
x-api-key{{x-api-key}}API key for authorization.
x-account-id{{x-account-id}}User identifier for added security and tracking.

Craft the Request Body

Example of body
{
"request_id": "tgr_01JV5V54KPYK9GB29265EQRZ2P",
"code": "482910"
}
FieldTypeRequiredDescription
request_idstringYesThe request_id returned from the Telegram Gateway when the OTP was sent.
codestringNoThe verification code entered by the user (4–8 digits). If provided, the Gateway validates the code and returns the result.
tip

The request_id is stored on the TDR record. You can retrieve it at any time via the Get TDR by UUID endpoint.

Code Snippets

Example - cURL
curl --location 'https://api.betatel.com/api/v1/connect-hub/telegram/check-verification-status' \
--header 'Content-Type: application/json' \
--header 'x-api-key: YOUR_API_KEY' \
--header 'x-account-id: YOUR_ACCOUNT_ID' \
--data '{
"request_id": "tgr_01JV5V54KPYK9GB29265EQRZ2P",
"code": "482910"
}'

Understanding the Response

{
"request_id": "187259537046478",
"phone_number": "+38761444555",
"request_cost": 0.01,
"delivery_status": {
"status": "delivered",
"updated_at": 1700000045
},
"verification_status": {
"status": "code_valid",
"updated_at": 1700000102
}
}
FieldTypeDescription
request_idstringUnique identifier for the verification request.
phone_numberstringThe recipient's phone number.
request_costnumberCost charged for this status check.
delivery_statusobjectCurrent delivery state of the message (see below).
verification_statusobjectResult of the code verification attempt (see below).

Delivery status values:

StatusDescription
sentMessage dispatched to the Telegram Gateway.
deliveredMessage delivered to the recipient's device.
readMessage has been opened by the recipient.
expiredMessage TTL elapsed before delivery.
revokedMessage was revoked before delivery.

Verification status values:

StatusDescription
code_validThe code entered by the user is correct.
code_invalidThe code entered by the user is incorrect.
code_max_attempts_exceededToo many incorrect attempts — verification failed.
expiredThe verification window has elapsed.

Error Handling

  • 400 - Bad Request: Invalid or missing request_id
  • 401 - Unauthorized: Authentication failed
  • 404 - Not Found: The request_id does not exist
  • 500 - Internal Server Error: An unexpected error occurred on the server