OTP SMS API

OTP SMS API guide

How OTP SMS works through an API: the DLT template, a safe OTP design, delivery tips, fallback to voice or WhatsApp, and what an OTP costs.

Light illustration with a doc icon for the otp sms api page

The short answer

An OTP SMS API lets your app generate a one-time code and send it to the user through a registered transactional template. For reliable delivery, use an approved template, keep the code short-lived, limit retries and add a fallback such as a voice call or a WhatsApp message.

How the flow works

  1. The user enters a mobile number in your app.
  2. Your server generates a random code and stores it with an expiry.
  3. Your server calls the SMS API with the number and the code in an approved transactional template.
  4. The operator delivers the SMS.
  5. The user enters the code and your server checks it.

Design tips

  • Use a random code of 4 to 6 digits that expires in a few minutes.
  • Allow a limited number of attempts and resends per number.
  • Never log the code or send it to the client.
  • Tell users not to share the code, as in the template.

Reliable delivery

  • Use the transactional category and a template that matches the message exactly. See template approval.
  • OTPs are not subject to the DND filter, so they reach DND numbers.
  • Do not add offers to an OTP, because that makes it promotional.

Fallbacks

Offer a resend by voice call or by WhatsApp authentication message when the SMS is slow.

Cost

An OTP by SMS costs ₹0.12 plus GST on Mantraxtel, and by WhatsApp ₹0.13. See the OTP SMS price and the OTP authentication use case.

Rules are updated from time to time. Treat this page as a starting point and confirm the current position on the TRAI website or with your messaging provider before you launch a campaign.

Previous: How to get the WhatsApp Business API · Next: What is an OBD voice call?

Need help setting this up? book a demo or talk to the team. Editorial standards: editorial policy.

Questions about OTP SMS API guide

Can OTP SMS reach DND numbers?

Yes. OTPs are transactional messages and are not subject to the DND filter when they use an approved template.

How long should an OTP stay valid?

A few minutes is common. Short expiry and limited attempts reduce misuse.

How much does an OTP SMS cost?

₹0.12 per SMS plus GST on Mantraxtel.