What is an OTP? One-time passwords explained
An OTP (one-time password) is a short code, usually four to six digits, that is valid for a single use and a short time. It is sent to a user's phone or app to prove they control that number or device, most often to sign up, log in or confirm an action without a password.
In India, an OTP sent by SMS also has to pass DLT checks before it reaches the phone. A provider's shared template lets you send OTP without DLT registration of your own, so you can verify phone numbers from day one.
By Vivek Singh, Founder, Diorbit TechnologiesUpdated
Why do OTPs matter for apps and websites in India?
Phone numbers are how most Indian users sign up. An OTP turns a typed number into a verified one, which cuts fake signups and lets users log in without remembering a password.
A safe OTP flow has a few rules: generate the code on the server, keep it short-lived, limit how many times a user can guess, and limit how often a number can be sent a code. On DiOTP a code expires in 5 minutes, allows 5 verify attempts, and each number can get one code every 30 seconds, 3 an hour and 10 a day. The OTP security best practices guide explains each rule.
How does an OTP relate to OTP without DLT?
The OTP itself is the same either way. What changes is the message that carries it: on the shared template the sender is DIORBT and the wording is fixed. DiOTP generates and stores the code, so your server never sees it; you only pass the request_id and what the user typed.
A worked example
- A user enters 9876543210 on your signup page.
- Your server calls POST /v1/otp/send. DiOTP creates a code and texts it.
- The user types the six digits. Your server calls POST /v1/otp/verify with the request_id and the code.
- The response says verified: true, and you create the account.
The OTP API without DLT page has both calls in full.
Related terms
- 2FA (two-factor authentication): where an OTP is the second factor.
- Shared DLT template: the message that carries the code.
- DND (Do Not Disturb): why it does not normally stop OTPs.
Questions and answers
How long should an OTP be valid?
A few minutes is typical. DiOTP codes expire after 5 minutes, which is long enough to type the code and short enough to limit misuse.
Is a 4-digit or 6-digit OTP better?
Six digits are harder to guess. Combined with a limit on verify attempts, they make guessing impractical.
Should my server store the OTP?
It does not have to. With DiOTP, the code is generated and stored by DiOTP and your server only keeps the request_id.
Can OTPs be sent on WhatsApp instead of SMS?
Yes. DiOTP sends WhatsApp OTPs on the same API with channel set to whatsapp, once WhatsApp is enabled for the account.
