WhatsApp OTP API: Send OTPs on WhatsApp with the same two API calls.
A WhatsApp OTP API that is the same call as SMS: set the channel to WhatsApp and the code arrives as a WhatsApp message instead of a text. Expiry, attempt limits and verification work exactly as they do for SMS. Our team turns the channel on for your account.

How it works
Get started with OTP on WhatsApp in three steps
Ask us to turn it on
WhatsApp is enabled per account. Tell us you want it and we switch it on.
Send with channel whatsapp
The same POST /v1/otp/send call, with "channel": "whatsapp".
Verify as usual
POST /v1/otp/verify with the request_id and the code. Nothing else changes.
Features
What you get with OTP on WhatsApp
Same API as SMS
One field changes: "channel": "whatsapp". The send and verify calls are otherwise identical.
Same verification
Five-minute expiry, five attempts and server-side checks, with the code never stored on your side.
Same limits
Resend cooldowns and per-number caps protect your balance on WhatsApp too.
One message log
WhatsApp and SMS codes appear side by side in your dashboard, with their status.
2
API calls, same as SMS
5 min
default code expiry
1
message log for both channels
₹0
setup or monthly fee
WhatsApp OTP verification, in detail
DiOTP's WhatsApp OTP service uses the same two calls as SMS. Set the channel to whatsapp in the send request and the code is delivered as a WhatsApp message instead of a text. Verification, expiry, attempt limits and rate limits are identical, so you get one SMS and WhatsApp API for both channels, with the same request_id flow.
When OTP verification on WhatsApp makes sense
- Your users live in WhatsApp and are more likely to see a code there than in their SMS inbox.
- You want a second option: show "Send code on WhatsApp" next to the SMS option, or offer it after the resend timer when an SMS has not arrived.
- You want to send codes before your own DLT registration for SMS is in place. DLT rules apply to SMS, not to WhatsApp.
SMS still reaches every phone, including those without WhatsApp, so most businesses keep SMS as the default and offer WhatsApp alongside it. That is why WhatsApp verification tends to be the second button on the screen, not the only one.
For a business, it is less a replacement than a second door: the user picks the app they check most, and your backend handles both the same way. It is a verification service, not a chat tool, so DiOTP generates, stores and checks the code exactly as it does for SMS.
WhatsApp OTP API integration in five steps
- Create a DiOTP account and build your OTP flow on SMS, using your free test credits.
- Ask us to switch on the OTP service for WhatsApp on your account. Until it is on, a WhatsApp send returns channel_not_enabled.
- Send with "channel": "whatsapp" in the body of POST /v1/otp/send. Keep the request_id it returns.
- Verify with POST /v1/otp/verify exactly as you do for SMS.
- Watch WhatsApp and SMS codes side by side in the message log, or receive their events by webhook.
Most businesses look for a provider for codes on WhatsApp because setting up their own business sender and authentication template is a project in itself. With DiOTP both are already in place, so step two is a request to our team rather than a submission to Meta.
WhatsApp OTP verification API, in code
The only change from an SMS send is the channel field, so the send OTP WhatsApp API call is the request you already make, with one value changed. There is no separate OTP API WhatsApp codes need: the endpoint is still POST /v1/otp/send, and the response tells you which channel the code went out on.
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-login-9876543210" \ -d '{ "to": "9876543210", "country_code": 91, "channel": "whatsapp", "purpose": "login" }'
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: "whatsapp", purpose: "login", }), }); 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": "whatsapp", "purpose": "login", }, 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" => "whatsapp", "purpose" => "login", ]), ]); $otp = json_decode(curl_exec($ch), true); // Keep $otp["request_id"]: you need it to verify.
Verifying is the same call as for SMS:
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;
Use cases
Sign-up and login
Send the code on WhatsApp at sign-up, or to log a user in, with the same five-minute expiry and five attempts as SMS. As a second login step it works the same way: the code can be verified once and is gone.
A fallback when SMS is slow
If a user has waited for the resend timer and still has no SMS, offer the code on WhatsApp instead of another SMS.
Payment and order confirmation
OTP verification through WhatsApp suits payments and cash-on-delivery orders, because many buyers already talk to stores there.
Things to know
- The number must be registered on WhatsApp to receive the code; offer SMS for everyone else.
- Codes come from the WhatsApp business sender we provide, not from your own WhatsApp number.
- The same limits apply as on SMS: one code per number every 30 seconds, three an hour and ten a day by default.
- Sending codes on WhatsApp to Indian numbers needs no DLT registration, because DLT covers SMS only.
- Other WhatsApp messages, such as order updates or offers, are not self-serve today. Tell us if you need them.
You can reach our team by email at otp-support@diorbit.com, Monday to Friday, 10:00 to 19:00 IST, with a reply within one business day.
WhatsApp authentication templates
WhatsApp belongs to Meta, and Meta sets the rules centrally: a one-time code that starts a conversation must go out on an approved template in the authentication category. These templates are deliberately strict, so users learn to trust them. The wording is a fixed phrase with the code in it, and links, images and emojis are not allowed.
A WhatsApp OTP template is short by design:
- The body reads "{{code}} is your verification code." The code is the only part that changes.
- An optional line can add "For your security, do not share this code." and another can say when the code expires.
- A button lets the user copy the code with one tap, and on supported Android apps the code can fill itself in.
DiOTP sends codes on an authentication template we have already had approved, so there is no template for you to write or submit. It is not a general messaging API where you choose the words: the format is fixed, and your users see the code from a WhatsApp business sender we provide. Our guide to the WhatsApp authentication template explains each part of the format.
SMS and WhatsApp OTP side by side
On most products, verification on WhatsApp sits beside SMS rather than replacing it. This is how the two channels compare on DiOTP today:
| SMS | ||
|---|---|---|
| Who receives it | Every mobile phone | Numbers registered on WhatsApp |
| Sender the user sees | A registered DLT header: ours on the shared template, or your own | A WhatsApp business sender DiOTP provides |
| Registration needed | Your own DLT, or DiOTP's shared template to start | None from you; the authentication template is already approved |
| Price | Published: ₹0.40 to ₹0.26 per OTP, before GST | Quoted for your account |
| How it is turned on | Self-serve, from sign-up | Switched on for your account by our team |
| API call | POST /v1/otp/send | The same call, with "channel": "whatsapp" |
WhatsApp OTP pricing in India
Codes on WhatsApp are charged per message, with no setup fee and no monthly fee. Meta sets WhatsApp authentication template pricing by message category, and authentication messages to Indian numbers sit in their own rate band, separate from marketing. Our rate depends on your volume and is quoted for your account rather than published; ask us for it when we turn the channel on.
When you weigh a quote, set the quoted cost per message against what you pay per OTP on SMS, which our pricing page publishes plan by plan. Verifying a code is a free API call on either channel, so only the send is charged.
In your dashboard
When SMS is slow, offer WhatsApp
Let users choose WhatsApp, or offer it as the second option when an SMS code has not arrived, from the same account and the same integration.
- Same request_id flow as SMS
- Same limits and expiry
- One message log for both channels
Use it for
Where businesses use it most
The same product carries very different messages. These are the ones our customers send most.
- Users who prefer WhatsApp to SMS
- A second option when an SMS is slow
- Sign-up and login
- Payment confirmation
Industries
OTP on WhatsApp 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 on WhatsApp: FAQs
The API is the same, but the channel is switched on per account. Ask us and we turn it on; until then a WhatsApp send returns channel_not_enabled.
No. DLT applies to SMS. WhatsApp codes are sent as WhatsApp template messages from a business sender we provide.
A WhatsApp message with the code, from a WhatsApp business sender we provide rather than your own number.
Not self-serve today. If you need WhatsApp messages beyond OTPs, tell us what you want to send.
It is quoted for your account rather than published, and depends on your volume. Each code is charged per message, with no setup or monthly fee. Checking the code is a free API call, so the WhatsApp OTP verification cost is the send alone. Ask us for a quote when we turn the channel on.
OTP SMS has published prices, from ₹0.40 down to ₹0.26 per OTP depending on your plan, before 18% GST. WhatsApp codes are quoted per account, so compare your quote with your SMS plan rate at your own volumes. Many businesses keep SMS as the default and offer WhatsApp as the second option.
No. Codes go out on an authentication template DiOTP already has approved, from a WhatsApp business sender we provide. Meta fixes the wording of authentication templates, so there is nothing for you to draft or submit.
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.
