OTP API

Telegram OTP API for sending and verifying one-time codes

TeleAuth turns your own Telegram bot into an OTP delivery channel. You call one endpoint to send a code, one endpoint to verify it, and TeleAuth handles code generation, expiry, rate windows and delivery logging.

How the OTP flow works

A complete verification is two HTTP requests. TeleAuth generates a six-digit code, delivers it through your connected bot and stores only a hashed copy until it is used or expires.

  • POST /v1/otp/send with a Telegram username
  • The user receives the code in your bot's chat, not over SMS
  • POST /v1/otp/verify with the same username and the code the user typed
  • Codes expire after 300 seconds by default and are single use

Send a code

Authenticate with the project API key you created in the dashboard. Keep the key on your server — it must never reach a browser bundle or mobile app.

Send OTP
curl -X POST https://teleauth.run.place/api/public/v1/otp/send \
  -H "x-api-key: $TELEAUTH_API_KEY" \
  -H "content-type: application/json" \
  -d '{ "username": "ada_lovelace" }'

Verify the code

Verification is idempotent per code: once a code is accepted or expires, further attempts fail closed.

Verify OTP
curl -X POST https://teleauth.run.place/api/public/v1/otp/verify \
  -H "x-api-key: $TELEAUTH_API_KEY" \
  -H "content-type: application/json" \
  -d '{ "username": "ada_lovelace", "code": "418302" }'

What you get out of the box

Everything a production auth flow needs, without building bot plumbing yourself.

  • Per-project API keys with prefixes so you can rotate safely
  • HMAC-signed webhooks for send, delivered and verified events
  • Authentication logs with recipient, result and timestamp
  • A live playground to test keys and payloads before you ship
FAQ

Common questions

Do I need my own Telegram bot?

Yes. You connect a bot token from BotFather in the Bots page, and TeleAuth wires the webhook automatically. Codes are always delivered from your own bot so users see your branding.

How long is an OTP valid?

Five minutes (300 seconds) by default. Codes are single use and are stored hashed.

Is the API free to start?

Yes, you can create a project, connect a bot and send test codes without a paid plan.

Try telegram otp api with TeleAuth

Create a project, connect your Telegram bot, and send your first OTP in minutes.

Create free account