हिन्दी में पढ़ें

OTP SMS API without DLT registration: the full reference

The DiOTP OTP SMS API without DLT registration is two HTTPS calls: POST /v1/otp/send sends a code and returns a request_id, and POST /v1/otp/verify checks what the user typed. Codes go out on DiOTP's registered DIORBT header and pre-approved template, so you register nothing, and the same calls keep working when you move to your own sender ID.

By , Founder, Diorbit TechnologiesUpdated

Key facts

Price
₹0.26 to ₹0.40 per OTP plus 18% GST, from a prepaid wallet. No setup fee, no monthly fee.
Setup time
Same day. Test on your own number in minutes, then go live.
Sender name
DIORBT, DiOTP's registered header (shown with an operator prefix, for example VM-DIORBT).
Message
"123456 is your login OTP for Your Company. Do not share it with anyone. Powered by Diorbit Technologies!" The wording is fixed; your company name fills the name slot.
Compliance
Sent under DiOTP's own registered DLT entity, header and pre-approved OTP template. You register nothing.
Limits per number
1 code every 30 seconds, 3 per hour, 10 per day.
Later
Move to your own sender ID when your DLT registration is ready, with no code changes.

What is the OTP SMS API without DLT registration?

It is the normal DiOTP OTP API. There is no special endpoint for sending OTP without DLT. Until you add a sender ID of your own, your account sends every code on DiOTP's shared, pre-approved OTP template from the DIORBT header, under DiOTP's own registered DLT entity. Your users see a message like this:

Text message

VM-DIORBT

482913 is your login OTP for Acme. Do not share it with anyone. Powered by Diorbit Technologies!

The shared template: the code first, your company name in the name slot, sent from DIORBT.

This page is the reference for developers: authentication, both calls, every field, every error code with what to do about it, idempotency, limits, testing and going live. If you want working code for a specific language, use the Python guide, the PHP guide, the Node.js guide, or let the OTP code generator write the calls for you.

The base URL for every call is https://api-diotp.diorbit.com/v1. All requests and responses are JSON over HTTPS.

How do I authenticate?

Every request carries your API key as a bearer token in the Authorization header. You create keys in the dashboard as soon as you sign up. Live keys start with diotp_live_ and the same key keeps working after your account goes live.

The Authorization header

Authorization: Bearer diotp_live_xxxxxxxxxxxxxxxx
  • Call the API only from your server. A key in a mobile app, a browser bundle or a public repository can be copied and used to spend your balance.
  • Keep the key in an environment variable such as DIOTP_API_KEY, not in your source code.
  • Never print or log the key. If one leaks, create a new key in the dashboard and revoke the old one.
  • A missing, wrong or revoked key returns HTTP 401.

How do I send an OTP with the API?

POST /v1/otp/send with the user's mobile number. DiOTP generates the code, stores it, sends it and returns a request_id. Your server never sees the code, so it never ends up in your logs or your database.

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"
  }'

Request fields

FieldTypeWhat it is
tostringThe mobile number without the country code, for example 9876543210. 6 to 15 digits.
country_codeintegerThe country calling code without +. Defaults to 91 (India).
channelstringsms, or whatsapp once WhatsApp is switched on for your account. Any other value is refused with 422.
purposestringA label for your own reports, such as login, signup or payment. Defaults to login. It does not change the message.
templatestring, optionalThe id of one of your own templates from the Templates page. Leave it out to use your account's default, which is the shared template until you add your own. SMS only.
digitsinteger, optionalHow many digits the code has: 4, 6 or 8. Defaults to 6. Any other value is refused with 422.

Optional header

Idempotency-Key: a unique value, such as a UUID, for each user action. It makes retries safe. See the idempotency section below.

Response (200)

200 OK

{
  "request_id": "...",
  "channel": "sms",
  "expires_at": "..."
}
FieldMeaning
request_idThe id of this code. Store it with the user's session; you need it to verify.
channelThe channel the code went out on.
expires_atWhen the code stops working: five minutes after it was sent.

How do I verify the code the user typed?

POST /v1/otp/verify with the request_id from the send response and the code your user typed. A 200 response with verified set to true means the number is confirmed. Verifying is free.

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"
  }'
FieldTypeWhat it is
request_idstringExactly as the send call returned it.
codestringWhat the user typed, 4 to 10 characters. Send it as a string so a leading zero is not lost.

200 OK

{
  "verified": true,
  "verified_at": "..."
}

A code can be verified only once, allows five attempts and expires five minutes after it was sent. Wrong codes return 400 until the five attempts are used; the next try returns 429 too_many_attempts, and every try after that returns 409 not_pending. An expired code returns 410 once, then 409 not_pending. In every case the fix is the same: send a new code.

What do the error codes mean, and what should I do?

Every error uses one envelope: {"error":{"code","message","request_id"}}. Branch on error.code, which does not change. Log the message, whose wording can change, and never show it raw to your users. Quote the request_id if you write to support.

Statuserror.codeCallCauseWhat to do
401unauthorizedanyKey missing, wrong or revokedCheck the environment variable on your server; create a new key if needed.
402trial_used_upsendThe free test messages are used upRecharge your wallet to go live.
402insufficient_balancesendThe wallet holds less than one message. Nothing sent or chargedRecharge, then send again.
403trial_restrictedsendIn test mode, the number is not the one verified at sign-upSend to your own verified number, or go live.
403account_suspendedsendSending is paused on this accountContact support.
409channel_not_enabledsendThe channel, such as whatsapp, is not switched onSend with channel sms, or ask us to enable it.
409idempotency_key_reusedsendThe key was used before with a different bodyUse a new key for each user action.
422invalid_requestanyA field is missing or malformed; the message names itFix the field. Do not retry unchanged.
422template_not_availablesendUnknown template id, not usable on your account, or used with a channel other than smsCopy the id from the Templates page, or leave template out.
429resend_cooldownsendA code went to this number less than 30 seconds agoShow a resend timer and wait.
429phone_hourly_limitsendThree codes to this number in the last hourAsk the user to try later.
429phone_daily_limitsendTen codes to this number in the last 24 hoursAsk the user to try tomorrow, or offer another way to sign in.
429api_key_minute_limitsend30 sends on this key in the last minuteBack off and retry.
429rate_limitedsendYour account reached its per-minute sending ceilingRetry with exponential backoff.
429test_limitsendA live account switched to test mode used its daily test messagesSwitch back to live in the dashboard.
503sending_unavailablesendThe message could not go out right now. Nothing chargedRetry after a short wait with the same Idempotency-Key.
400invalid_codeverifyThe code does not match; one attempt usedLet the user try again.
404not_foundverifyThe request_id is unknown to your accountPass the request_id exactly as returned.
409already_verifiedverifyThis request was already verifiedTreat the number as verified.
409not_pendingverifyThe request expired or was lockedSend a new code.
410expiredverifyMore than five minutes since the code was sentSend a new code.
429too_many_attemptsverifyFive attempts used; the request is lockedSend a new code.

Retry automatically only sending_unavailable, rate_limited and api_key_minute_limit, with backoff. Do not retry the phone limits, test mode errors, invalid_request or anything from verify, because retrying cannot change the answer. Alert your team on 401, 402 and 403: they mean a setup or account problem, not a user mistake. The errors page in the docs has the same list with more detail.

How does the Idempotency-Key make retries safe?

Networks fail. If your send request times out, you cannot tell whether the code went out. Without protection, a retry could text your user twice and charge you twice.

Send an Idempotency-Key header with every send, one fresh value per user action. If you retry with the same key and the same body, and the first attempt succeeded, the API returns the original response. Nothing new is sent, nothing is charged again, and the retry does not count against any limit. If the first attempt failed, nothing was stored for that key, so the retry is a real new attempt. Reusing a key with a different body returns 409 idempotency_key_reused.

cURL: a send with an Idempotency-Key

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: 7f3c2a9e-5b1d-4e8a-9c6f-2d4b8a1e0f37" \
  -d '{"to":"9876543210","country_code":91,"channel":"sms","purpose":"login"}'

What are the rate limits?

LimitValueError when reached
Codes to one number1 every 30 secondsresend_cooldown
Codes to one number3 per hourphone_hourly_limit
Codes to one number10 per dayphone_daily_limit
Sends per API key30 per minuteapi_key_minute_limit
Code lifetime5 minutesexpired
Verify attempts per code5too_many_attempts

The hourly and daily limits are rolling windows, counted back from each new request. A send stopped by a limit returns 429 and is neither sent nor charged. That also protects your wallet from SMS pumping, where bots request codes to numbers they profit from. The SMS pumping guide covers the extra checks worth adding in your own app.

How do I test on the free trial?

A new account starts in test mode with 10 free test messages. They are real messages on the real network, not simulated responses, and they go only to the mobile number you verified at sign-up, with country_code 91. A send to any other number returns 403 trial_restricted. When the test messages run out, a send returns 402 trial_used_up.

The limits apply in test mode too, so you can check your resend timer and your error handling before going live. Use the test messages to confirm three things: the code arrives on your phone with your company name, your verify call returns verified true, and a wrong code returns 400 invalid_code.

How do I go live?

Recharge your prepaid wallet. A recharge makes the account live, and the same API key then sends to any Indian mobile number. Nothing in your code changes. Each OTP is deducted from the wallet at your plan's price: ₹0.26 to ₹0.40 per OTP plus 18% GST, with no setup fee and no monthly fee. The OTP without DLT price page shows what that comes to at different volumes.

How do I move to my own sender ID without code changes?

When your own DLT registration is approved, add your entity ID, header and template ID under Sender IDs in the dashboard. Your send and verify calls stay exactly the same; codes now go out under your header and your wording. You can keep sending on the shared template while your registration is in review, so there is no gap.

Your own template is also what you need for SMS Retriever autofill on Android, which needs an app hash in the message. The OTP autofill guide for Android and iOS explains what works on each template.

Questions and answers

Is there a separate API for OTP without DLT?

No. It is the normal DiOTP OTP API. Your account uses DiOTP's shared, pre-approved template until you add your own sender ID, and the calls are the same either way.

Does my server ever see the OTP code?

No. DiOTP generates and stores the code. Your server only keeps the request_id and passes the code the user typed to the verify call.

Can I call the API directly from a mobile app or browser?

No. The API key would be exposed and anyone could use it to spend your balance. Call DiOTP from your own server, and have your app call your server.

Am I charged when a send fails?

No. A send refused by a limit, a validation error, a test mode rule or a low balance sends nothing and costs nothing. Verifying a code is always free.

Can I send WhatsApp OTP on the same API?

Yes, once WhatsApp is switched on for your account. Set channel to whatsapp. Otherwise the send returns 409 channel_not_enabled.

Do I need a new API key when my account goes live?

No. The key you use in test mode is the same key you use after you recharge and go live.

Send your first OTP today.

Free test credits on sign-up, API keys in a minute, and a team that picks up the phone.