Skip to main content
The Telegram API sends a one-time code to the Telegram account registered to a phone number. The message comes from Telegram’s official Verification Codes account, so users trust it and it can’t be spoofed. A Telegram code costs a flat $0.02, and it’s refunded if Telegram doesn’t deliver it before it expires.
Want SMS as a backup when a user isn’t on Telegram? Use Verify instead. It sends on Telegram first and falls back to SMS automatically.

Send a code

The response is 201 with a sid that starts with TG, the code’s expires_at, and status: "sent". If the number has no Telegram account, or Telegram rejects the request for another reason, the request fails with 422 TELEGRAM_REJECTED and you aren’t charged.

Check the code

Whether you pass your own code or let Telegram generate one, check what your user enters with Verify a Telegram code:
Read valid in the response. Telegram tracks wrong attempts and expiry; verification_status tells you the result of the latest check:
If you passed your own code, you can also compare it yourself. Calling the verify endpoint is still recommended — it records the result, which improves Telegram’s delivery statistics.

Delivery status

status follows the message on Telegram: With a callback, OTPBay sends a webhook each time the status changes. Without one, get the code to read the latest status.

Settings

Open Messaging → Telegram in the dashboard:

Refunds

The $0.02 is charged when you send. It’s refunded when:
  • Telegram rejects the request, or it never reaches Telegram.
  • Telegram doesn’t deliver the code before it expires.
Telegram reports an undelivered code when OTPBay next checks its status. With a callback set, OTPBay checks automatically until shortly after the code expires; otherwise the check happens when you get the code. Codes sent by Verify are always checked when the verification finishes. After a refund, cost on the message shows 0.00.