OTP SMS API: Verification codes that arrive while the user is still looking.
An OTP SMS API India businesses can start on the same day, in two calls: one sends a code, one checks what the user typed. As your OTP SMS API provider, we generate, deliver, expire and verify the code, and you get a delivery report for every send.

How it works
Get started with OTP SMS in three steps
Create an account
Sign up in a minute and get API keys with free test credits.
Send a code
One API call with the mobile number. We generate the code and deliver it.
Verify it
Pass back what the user typed. We check it, count attempts and expire it.
Features
What you get with OTP SMS
Send and verify in two calls
We hold the code, its expiry and the attempt count. Your server only asks "is this right?"
With or without DLT
Start on our shared template the same day, or send from your own registered sender ID and template.
Built-in abuse limits
Resend cooldowns and per-number caps stop someone from draining your balance with fake requests.
Delivery reports
Every code has a status: sent, delivered or failed, with the time each step took.
Safe retries
Send an idempotency key and a retried request never sends a second code.
Webhooks
Signed callbacks tell your system the moment a code is delivered or verified.
2
API calls to a working flow
5 min
default code expiry
24×7
priority delivery
₹0
setup or monthly fee
The OTP SMS API, in detail
DiOTP is an OTP SMS service provider in India, and its OTP SMS API handles the whole one-time password flow for Indian mobile numbers. Your server makes one call to send a code and one to check what the user typed. DiOTP generates a random code, sends it as a DLT-compliant SMS, stores it, expires it after five minutes and allows five attempts. Your servers never see or store the code, so there is nothing to leak and nothing to replay.
How OTP verification works
OTP based verification proves that a person holds a phone number right now. You send a short, random, single-use code to the number, the person types it back, and the two are compared. If they match within the time allowed, the number is theirs. Using SMS for OTP verification works on every mobile phone, smartphone or not, with nothing for the user to install. That reach is why an SMS OTP verification API India's apps can count on is usually the first channel a product adds.
The OTP verification process on DiOTP has five steps:
- The user enters a mobile number in your app or website and taps a button to get a code.
- Your server calls the request OTP API, POST /v1/otp/send, with that number. DiOTP replies with a request_id and the time the code expires.
- DiOTP generates a random code, stores it against the request_id and sends it by SMS.
- The user types the code, and your server passes it to POST /v1/otp/verify together with the request_id.
- DiOTP checks the code, counts the attempt and answers verified, or names the reason it failed, such as invalid_code or expired.
That is how OTP service works on DiOTP: the code, its expiry and its attempt count live with us, and your server only ever handles the request_id. It is the difference between a mobile OTP verification service and a plain OTP message API, where you would generate the code, write it into a text, store it and check it yourself.
Set it up in five steps
- Create an account. API keys and free test credits are ready straight away, with no card needed.
- Copy a test key from API keys in your dashboard and keep it on your server, in an environment variable such as DIOTP_API_KEY.
- Call POST /v1/otp/send with the user's mobile number. Keep the request_id it returns.
- Call POST /v1/otp/verify with the request_id and the code the user typed. A 200 response means the number belongs to them.
- Ask to go live from your dashboard. Once we have checked your business, the same keys send to any Indian mobile number.
While you build, test mode sends codes only to the mobile number you signed up with, so nothing reaches a real customer by mistake.
OTP send API and OTP verify API, in code
Send a code with the SMS OTP service API. The Idempotency-Key header makes retries safe: if a request times out and you send it again with the same key, the user does not get a second code and you are not charged twice.
curl -X POST https://api-diotp.diorbit.com/v1/otp/send \ -H "Authorization: Bearer $DIOTP_API_KEY" \ -H "Content-Type: application/json" \ -H "Idempotency-Key: 5f2b8c1e-signup-9876543210" \ -d '{ "to": "9876543210", "country_code": 91, "channel": "sms", "purpose": "signup" }'
const res = await fetch("https://api-diotp.diorbit.com/v1/otp/send", { method: "POST", headers: { Authorization: `Bearer ${process.env.DIOTP_API_KEY}`, "Content-Type": "application/json", "Idempotency-Key": crypto.randomUUID(), }, body: JSON.stringify({ to: "9876543210", country_code: 91, channel: "sms", purpose: "signup", }), }); const otp = await res.json(); // Keep otp.request_id: you need it to verify.
import os, uuid, requests res = requests.post( "https://api-diotp.diorbit.com/v1/otp/send", headers={ "Authorization": f"Bearer {os.environ['DIOTP_API_KEY']}", "Idempotency-Key": str(uuid.uuid4()), }, json={ "to": "9876543210", "country_code": 91, "channel": "sms", "purpose": "signup", }, timeout=10, ) otp = res.json() # Keep otp["request_id"]: you need it to verify.
<?php $ch = curl_init("https://api-diotp.diorbit.com/v1/otp/send"); curl_setopt_array($ch, [ CURLOPT_POST => true, CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => [ "Authorization: Bearer " . getenv("DIOTP_API_KEY"), "Content-Type: application/json", "Idempotency-Key: " . bin2hex(random_bytes(16)), ], CURLOPT_POSTFIELDS => json_encode([ "to" => "9876543210", "country_code" => 91, "channel" => "sms", "purpose" => "signup", ]), ]); $otp = json_decode(curl_exec($ch), true); // Keep $otp["request_id"]: you need it to verify.
Then check what the user typed. A 200 response means it matched; the code is used up and cannot be verified again. An error tells you why it did not match, such as invalid_code, expired or too_many_attempts.
curl -X POST https://api-diotp.diorbit.com/v1/otp/verify \ -H "Authorization: Bearer $DIOTP_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "request_id": "7c9e6679-7425-40de-944b-e07fc1f90ae7", "code": "482913" }'
const res = await fetch("https://api-diotp.diorbit.com/v1/otp/verify", { method: "POST", headers: { Authorization: `Bearer ${process.env.DIOTP_API_KEY}`, "Content-Type": "application/json", }, body: JSON.stringify({ request_id: requestId, code: codeTheUserTyped }), }); if (res.ok) { // The number is verified: sign the user in. } else { const { error } = await res.json(); // e.g. error.code === "invalid_code" }
res = requests.post(
"https://api-diotp.diorbit.com/v1/otp/verify",
headers={"Authorization": f"Bearer {os.environ['DIOTP_API_KEY']}"},
json={"request_id": request_id, "code": code_the_user_typed},
timeout=10,
)
if res.ok:
pass # The number is verified: sign the user in.
else:
error = res.json()["error"] # e.g. error["code"] == "invalid_code"<?php $ch = curl_init("https://api-diotp.diorbit.com/v1/otp/verify"); curl_setopt_array($ch, [ CURLOPT_POST => true, CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => [ "Authorization: Bearer " . getenv("DIOTP_API_KEY"), "Content-Type: application/json", ], CURLOPT_POSTFIELDS => json_encode([ "request_id" => $requestId, "code" => $codeTheUserTyped, ]), ]); $body = json_decode(curl_exec($ch), true); $verified = curl_getinfo($ch, CURLINFO_HTTP_CODE) === 200;
The send endpoint is the OTP sender API and the verify endpoint is the OTP verify API. Both take plain JSON over HTTPS with a Bearer key, so any language that can make an HTTP request can use them. Because the to field takes the plain 10-digit number and country_code defaults to 91, this is a mobile OTP verification API India teams can call without reformatting numbers first.
Send endpoint reference Verify endpoint reference Integration guide
OTP API for website and mobile apps
DiOTP is an OTP REST API rather than a plugin, which suits almost any stack. As an OTP service for website sign-ups, it sits behind your own form: the browser posts the number to your server, and your server calls DiOTP. As an OTP service for app logins the pattern is the same, with your Android or iOS app calling your backend, never DiOTP directly. Whether it fronts a web form or an app, the phone OTP verification API is the same two calls.
- Keep the API key on your server, in an environment variable. A key inside a web page or an app bundle can be copied and used to send codes on your balance.
- For OTP verification for app sign-ins, hold the request_id on your backend, so a user cannot skip the verify step by editing the app.
- Treat DiOTP as a mobile OTP API that only your backend talks to. There are official SDKs for Node.js and Python, and the REST API takes a few lines in any other language, PHP included; there are no WordPress or Shopify plugins.
An OTP API for developers should be predictable to code against, and the error shape is built for that: every failure returns a machine-readable code such as resend_cooldown or expired, a readable message, and a request_id you can quote to support. The send OTP reference lists every field and error.
Use cases
Sign-up verification
Confirm that a new user owns the number they entered before you create the account. Used this way, DiOTP is a phone number verification API: you get fewer fake sign-ups and a reachable contact for every customer.
Passwordless login and two-factor authentication
Use the code as the whole login, which many Indian users prefer to a password, or as a second step after one. Here the same two calls act as an SMS OTP authentication API, and the five-attempt limit stops anyone guessing their way in.
Cash-on-delivery confirmation
Ask the buyer to confirm a COD order with a code sent to the number on the order, so orders placed with a wrong number never ship.
Payments, password resets and account changes
Ask for a code before the actions an attacker would try first: a payment, a password reset, a new payout account or a changed email address.
Delivery and pickup codes
Send the recipient a code that the rider enters to close a delivery or record a pickup against the right person.
Users who cannot read a text
Some users are on landlines or basic phones, or simply find a spoken code easier. For them, voice OTP reads the same code aloud in a short call. Talk to us if your users need it.
Users who check WhatsApp first
SMS for OTP India-wide reaches every phone, but some users read WhatsApp before their SMS inbox. The same send call can deliver a WhatsApp OTP instead, once the channel is switched on for your account, so you can offer both from one integration.
Limits that protect your balance
Any SMS verification API that is open to the internet attracts bots, so DiOTP checks every send against these limits first. Past one, the API returns 429 with a code that says which; nothing is sent and nothing is charged. They stop a script hammering your OTP form from draining your wallet or flooding one person's phone, a fraud known as SMS pumping.
| Limit | Default | Error code |
|---|---|---|
| Resend to the same number | Once every 30 seconds | resend_cooldown |
| Codes per number per hour | 3 | phone_hourly_limit |
| Codes per number per day | 10 | phone_daily_limit |
| Sends per API key per minute | 30 | api_key_minute_limit |
| Wrong codes per request | 5 | too_many_attempts |
Need higher limits for your traffic? Talk to us and we will look at your volumes.
With or without your own DLT registration
Many teams pick an SMS provider for OTP and only then learn that every SMS OTP service India allows must send from a registered header on a registered template, under TRAI's DLT rules. Registering your own entity, header and template takes time, and that is where launches tend to stall.
You can go live the same day on DiOTP's shared, pre-approved OTP template, without registering on DLT yourself. Users receive a standard OTP message from our registered sender name. When your own DLT entity, header and template are approved, add them in your dashboard and codes go out under your brand. Your API calls do not change. That makes DiOTP an SMS OTP verification service India's startups can switch on the same day, before their own registration is approved.
Delivery reports and webhooks
Because DiOTP runs the OTP SMS verification service end to end, every code has a status in your dashboard: sent, delivered or failed, and verified once the user enters it. Add an HTTPS endpoint under Webhooks and DiOTP posts an event to your system for each step, signed with HMAC-SHA256 so you can check it came from us.
How to choose the best OTP SMS service provider in India
There is no single best OTP API for every product. Most of what separates one OTP SMS service India buyers compare from another stays invisible until something goes wrong: a code that never arrives, a bill run up by bots, or a template rejected the week you launch. These are the questions worth asking any OTP SMS provider in India, DiOTP included.
- Does it verify codes for you? A plain SMS API for OTP sending leaves code generation, storage and checking to you. A mobile OTP service provider that verifies on its own side keeps the code off your servers.
- Can you start before your own DLT registration? A shared, pre-approved template lets you launch while your own entity, header and template are in review.
- What protects your balance? Look for resend cooldowns and per-number caps that stop SMS pumping before anything is charged.
- Are prices published? You should be able to work out the cost per OTP, including GST, before you sign up.
- Can you see every code? A delivery status per message, and webhooks for your own systems, make a failed login easy to explain.
- Can you test for free? Look for an SMS OTP API India's developers can build against before paying anything. DiOTP gives free test messages to the number you verify at sign-up.
DiOTP is built and run by Diorbit Technologies LLP, the OTP SMS provider company based in Mathura, Uttar Pradesh, and support replies within one business day. Whichever SMS OTP API provider you choose, test it on real numbers before you move all of your traffic.
Pricing
The OTP API service is prepaid, with no setup fee and no monthly fee. Choose a plan, recharge your wallet and every OTP is charged at your plan's rate. The larger the plan, the lower the price per OTP. Credits never expire.
| Plan | Recharge | Price per OTP | OTPs included |
|---|---|---|---|
| OTP 1 | ₹100 | ₹0.40 | 250 |
| OTP 2 | ₹3,600 | ₹0.35 | 10,285 |
| OTP 3 | ₹5,000 | ₹0.33 | 15,151 |
| OTP 4 | ₹50,000 | ₹0.26 | 1,92,307 |
Prices are before 18% GST, which is added when you recharge; you get a GST invoice for every payment. Messages stopped by a limit before sending are not charged. One rate covers SMS OTP verification India-wide: every Indian mobile number costs the same on your plan.
In your dashboard
Every code tracked from request to verification
See each OTP move from sent to delivered to verified, with the time each step took, so you always know why a user did or did not get in.
- Delivery status for every code
- Attempts and expiry enforced for you
- Search any number in the message log
Use it for
Where businesses use it most
The same product carries very different messages. These are the ones our customers send most.
- App and website login
- New account sign-up
- Cash-on-delivery confirmation
- Payment and password reset
Industries
OTP SMS across industries

E-commerce & D2C
Confirm cash-on-delivery orders with an OTP before you ship, and keep buyers posted from checkout to doorstep.
Get started
Banking, fintech & lending
Login and payment OTPs that arrive in seconds, and account alerts that go out the moment money moves.
Get started
SaaS, apps & startups
Phone verification at sign-up, two-factor login and usage alerts, without building any of it yourself.
Get startedOTP SMS: FAQs
No. You can start on our shared OTP template the same day. To send from your own brand name, register a sender ID and template; our team can do the registration for you.
Five minutes by default, with a limited number of attempts. After that, send a new one.
Built-in cooldowns between resends and hourly and daily caps per number, so a script cannot drain your balance.
Yes. Send an Idempotency-Key header and a retried request returns the first result instead of sending a second code.
OTP verification checks that a person holds a phone number by sending a one-time code to it and asking them to type it back. A code that matches within its time limit proves the number is theirs. On DiOTP a code lasts five minutes, allows five attempts and can be verified only once.
Your server asks the service to send a code to a number. The service generates the code, delivers it by SMS and keeps it. When the user types the code, your server sends it back with the request_id, and the service answers whether it matched. Your server never sees or stores the code itself.
OTP services send and check one-time passwords for you, so you do not have to build code generation, SMS sending, expiry and attempt counting yourself. DiOTP is one, for Indian mobile numbers, with a REST API and a prepaid wallet.
In everyday use, no. OTP, short for one-time password, is the technical name, and verification code is what many messages and apps call it. Both mean a short code that works once and then expires.
There is no separate endpoint. To resend, call POST /v1/otp/send again for the same number. A resend is allowed once every 30 seconds, and a number can receive three codes an hour and ten a day by default. A request over a limit returns 429, and nothing is sent or charged.
Check that it verifies codes for you, lets you start before your own DLT registration, limits resends per number, publishes its prices and shows a delivery status for every code. Then test it on real numbers before moving your traffic. No single provider is the right choice for every business, so weigh these points against your own volumes.
More products
One account for every channel
Start building your customer messaging with DiOTP
Free test credits on sign-up, API keys in a minute, and a team that picks up the phone.
