Quick answer
The SMSGatewayHub OTP REST API sends a one-time password with a single HTTPS GET request to https://www.smsgatewayhub.com/api/mt/SendSMS. You pass your API key, a DLT-approved sender ID, channel=OTP, route=1, the mobile number, the message text, your DLT entity ID and your OTP template ID. The API answers in JSON. ErrorCode "000" means the OTP was accepted, and the reply carries a JobId and a MessageId per number for delivery tracking. OTP SMS costs ₹0.185 to ₹0.245 per SMS + 18% GST, with typical delivery in 2-6 seconds.
Key takeaways
- One endpoint: GET
/api/mt/SendSMS over HTTPS sends the OTP. No SDK is required.
- Ten parameters: APIKey, senderid, channel, DCS, flashsms, number, text, route, EntityId and dlttemplateid. Every one is listed below.
- JSON response: ErrorCode, ErrorMessage, JobId and a MessageData array with one MessageId per number.
- ErrorCode 000 = accepted. Any other code comes with an ErrorMessage text that tells you what to fix.
- You generate and verify the code. The API delivers it; your server keeps the hashed code and checks it.
This page is a reference. It lists every request parameter, shows the exact JSON you get back and explains how to handle errors. If you want a guided walk-through from account sign-up to the first OTP, read our step-by-step OTP SMS API integration guide for India first, then come back here when you write the code.
What is the SMSGatewayHub OTP REST API?
It is a plain HTTPS interface that your backend calls to send a one-time password by SMS. You do not need a library. Any language that can make a GET request and read JSON can use it: PHP, Python, Node.js, Java, C#, Go or a shell script with cURL.
The same endpoint sends transactional and promotional SMS. Setting channel=OTP and route=1 puts your message on the priority OTP route, which reaches every Indian number, including DND numbers, 24x7. Multi-operator routing with automatic retry and load balancing across operator routes keeps typical delivery at 2-6 seconds.
The product page for this API is our OTP SMS API. Full documentation, including the Swagger reference, lives in the developer API docs.
What do you need before you call the Send OTP API?
- An API key. Create a free account and copy the key from your panel. New accounts get 1,000 free SMS credits with no credit card.
- A DLT entity ID. Every business that sends commercial SMS in India must be registered on an operator DLT platform. Our team helps with DLT registration free of cost.
- A transactional sender ID. Six characters, approved on DLT, for example ABCDEF.
- An approved OTP template. Registered under the transactional (service implicit) category, with the code in a variable such as
{#var#}. Its DLT template ID goes into every request.
Send OTP request: which parameters does the API take?
Send a GET request to https://www.smsgatewayhub.com/api/mt/SendSMS with these query parameters. URL-encode every value, especially text.
| Parameter | Required | Value for OTP | What it does |
| APIKey | Yes | Your API key | Authenticates your account. Keep it on the server only. |
| senderid | Yes | e.g. ABCDEF | Your DLT-approved 6-character header. |
| channel | Yes | OTP | Selects the OTP channel. |
| DCS | Yes | 0 | Data coding. 0 is plain English text. |
| flashsms | Yes | 0 | 0 sends a normal SMS that stays in the inbox. |
| number | Yes | 9198XXXXXXXX | Mobile number with the 91 country code. |
| text | Yes | Your filled template | The message. It must match the DLT template word for word, with only the variable changed. |
| route | Yes | 1 | Route number for OTP traffic. |
| EntityId | Yes | Your DLT entity ID | Ties the SMS to your registered business. |
| dlttemplateid | Yes | Your template ID | The approved OTP template this text uses. |
Example request with cURL
curl -G "https://www.smsgatewayhub.com/api/mt/SendSMS" \
--data-urlencode "APIKey=YOUR_API_KEY" \
--data-urlencode "senderid=ABCDEF" \
--data-urlencode "channel=OTP" \
--data-urlencode "DCS=0" \
--data-urlencode "flashsms=0" \
--data-urlencode "number=9198XXXXXXXX" \
--data-urlencode "text=482913 is your OTP to log in to ABC App. Do not share it. - ABC" \
--data-urlencode "route=1" \
--data-urlencode "EntityId=YOUR_ENTITY_ID" \
--data-urlencode "dlttemplateid=YOUR_TEMPLATE_ID"
The same request as a single URL (values shortened) looks like this:
https://www.smsgatewayhub.com/api/mt/SendSMS?APIKey=YOUR_API_KEY&senderid=ABCDEF&channel=OTP&DCS=0&flashsms=0&number=9198XXXXXXXX&text=482913%20is%20your%20OTP...&route=1&EntityId=YOUR_ENTITY_ID&dlttemplateid=YOUR_TEMPLATE_ID
ℹ️Never build this URL in a browser, a mobile app or front-end JavaScript. Anyone could read your API key from it. Your app asks your backend for an OTP, and only your backend calls SendSMS.
What does the OTP SMS API JSON response look like?
Every call returns a JSON object. A successful send looks like this:
{
"ErrorCode": "000",
"ErrorMessage": "Success",
"JobId": "20047",
"MessageData": [
{ "Number": "9198XXXXXXXX", "MessageId": "..." }
]
}
| Field | Type | Meaning |
| ErrorCode | string | "000" when the request was accepted. Compare it as a string, not a number. |
| ErrorMessage | string | "Success" on success, otherwise a short reason you can log or show to your support team. |
| JobId | string | ID of this submission. Store it with the user's OTP request. |
| MessageData | array | One entry per number, each with Number and MessageId. Use MessageId to match the delivery report. |
Accepted means the platform took your OTP and passed DLT and routing checks so far. The final status (delivered, failed, expired) arrives later in the delivery report. You can see it in the panel under delivery reports, and you are billed only for delivered SMS.
How should you handle OTP API error codes?
Treat ErrorCode == "000" as success and everything else as a failure that needs action. Each failure comes with an ErrorMessage that names the problem. The full list of codes and messages is in the developer API docs; read the current list there rather than hard-coding numbers from a blog post.
Most failures fall into a few groups. Fix the cause, do not just retry.
| What the ErrorMessage points to | Usual cause | What to do |
| Authentication | Wrong or disabled API key | Copy the key again from the panel. Check IP restrictions if you set them. |
| Sender ID | Header not approved or not linked to the template | Use the exact DLT-approved header for this template. |
| Template / content | Text does not match the DLT template | Keep every fixed word, space and punctuation mark. Change only the variable. |
| Number | Invalid or badly formatted mobile number | Validate 10 digits plus the 91 prefix before you call the API. |
| Balance | Not enough credits | Recharge, or set a low-balance alert in the panel. |
A good handler does three things: it logs the full JSON reply with your own request ID, it shows the user a neutral message ("We could not send the code, please try again"), and it never shows raw API errors or your key to the user.
How does a complete OTP API integration fit together?
The REST call is one step of a short flow. The flow below is what we recommend for login and sign-up.
- The user enters a mobile number in your app or website.
- Your server checks resend limits, then creates a random 4-8 digit code.
- Your server stores a hash of the code with an expiry of a few minutes and an attempt counter.
- Your server calls SendSMS and saves the JobId and MessageId.
- The user types the code. Your server compares it with the stored hash, then deletes it so it cannot be used twice.
Steps 2, 3 and 5 happen on your server. There is no separate hosted "verify" endpoint: your code never leaves your system, which is safer. The full secure flow, with code, is in our guide on how to verify and resend OTP.
Minimal send function (Python)
import secrets, requests
def send_otp(number):
otp = f"{secrets.randbelow(900000) + 100000}"
r = requests.get("https://www.smsgatewayhub.com/api/mt/SendSMS", params={
"APIKey": "YOUR_API_KEY", "senderid": "ABCDEF", "channel": "OTP",
"DCS": "0", "flashsms": "0", "number": number, "route": "1",
"text": f"{otp} is your OTP to log in to ABC App. Do not share it. - ABC",
"EntityId": "YOUR_ENTITY_ID", "dlttemplateid": "YOUR_TEMPLATE_ID"},
timeout=10)
data = r.json()
if data.get("ErrorCode") != "000":
raise RuntimeError(data.get("ErrorMessage", "send failed"))
return otp, data.get("JobId") # store a HASH of otp, never the plain code
Language guides with full send and verify code: PHP and Laravel, Python, Node.js and React, Java and Android, .NET and Flutter and iOS.
Which security rules should every OTP API integration follow?
- Key on the server only. Store the API key in an environment variable or secret store. Restrict it by IP in the panel if you can.
- Cryptographically random codes. Use secrets, random_int, crypto.randomInt or RandomNumberGenerator, never a plain random function.
- Store a hash, not the code. Keep only the hash with an expiry of 3-10 minutes.
- Limit attempts. Lock the code after about 5 wrong tries.
- Limit resends. Wait 30-60 seconds between sends and cap sends per number per hour to stop SMS pumping.
- One use only. Delete the code as soon as it is verified.
- Never return the code to the client in any API reply, log line or error.
How much does the OTP SMS API cost?
OTP SMS costs ₹0.185 to ₹0.245 per SMS + 18% GST, depending on pack size: ₹0.245 on a 10,000 pack and ₹0.185 on a 1,00,000 pack. The DLT scrubbing charge is already included, and you pay only for delivered OTPs. See the full OTP SMS pricing.
Get your API key and 1,000 free SMS credits
No credit card. Free DLT registration help. Send your first OTP in minutes.
Create free account
Frequently asked questions
What is the OTP REST API endpoint?
Send a GET request over HTTPS to https://www.smsgatewayhub.com/api/mt/SendSMS with channel=OTP and route=1, plus your API key, sender ID, number, text, DLT entity ID and DLT template ID.
What does ErrorCode 000 mean?
ErrorCode "000" with ErrorMessage "Success" means the OTP request was accepted. The reply also has a JobId and one MessageId per number, which you use to match the delivery report.
Does the OTP API return JSON?
Yes. Every reply is a JSON object with ErrorCode, ErrorMessage, JobId and a MessageData array that lists each Number with its MessageId.
Where is the full OTP API documentation?
The developer API docs at smsgatewayhub.com/free-sms-gateway-developer-api list every parameter and error message and include a Swagger reference and code samples.
Does the API verify the OTP for me?
No. Your server generates the code, stores a hash of it and checks what the user types. The API delivers the code by SMS. This keeps the OTP inside your own system.
Related reading: OTP SMS API integration guide (step by step), verify and resend OTP securely, test your OTP API with Postman, and OTP SMS API.
Sources: SMSGatewayHub OTP SMS API page and developer API documentation (SendSMS parameters and JSON response, November 2026); SMSGatewayHub OTP SMS pricing page; TRAI Telecom Commercial Communications Customer Preference Regulations for DLT rules. Prices exclude 18% GST and can change; confirm your rate with sales before purchase.