SMS API with API Key
Send SMS from your website, app or software with one HTTPS call. Every call uses your secret API Key instead of your username and password. WhatsApp, RCS, Email and the unified CPaaS API are listed at the end.
Quick start
- Log in to your panel and open Developer API › API Key (Panel › API Key). Get the key on your registered email or generate a new one.
- Use your approved Sender ID, DLT Entity ID and DLT Template ID. The text must match the approved template.
- Call the URL below. Base URL:
https://www.smsgatewayhub.com
https://www.smsgatewayhub.com/api/mt/SendSMS?APIKey=YOUR_API_KEY&senderid=TESTIN&channel=2&DCS=0&flashsms=0&number=91989xxxxxxx&text=Your+OTP+is+123456&route=1&EntityId=YOUR_ENTITY_ID&dlttemplateid=YOUR_TEMPLATE_ID
Keep your API Key secret. Call the API from your server, not from browser JavaScript or a mobile app. If the key leaks, generate a new one in the panel - the old key stops working at once. You can also limit API use to your server IPs (ask support).
Send SMS
GETPOST/api/mt/SendSMS
Sends one message to one or more numbers. Answer: a JobId for the request and one MessageId per number.
https://www.smsgatewayhub.com/api/mt/SendSMS?APIKey=YOUR_API_KEY&senderid=TESTIN&channel=2&DCS=0&flashsms=0&number=91989xxxxxxx&text=test+message&route=1&EntityId=YOUR_ENTITY_ID&dlttemplateid=YOUR_TEMPLATE_ID
https://www.smsgatewayhub.com/api/mt/SendSMS?APIKey=YOUR_API_KEY&senderid=TESTIN&channel=2&DCS=0&flashsms=0&number=91989xxxxxxx,91999xxxxxxx&text=test+message&route=1&EntityId=YOUR_ENTITY_ID&dlttemplateid=YOUR_TEMPLATE_ID
https://www.smsgatewayhub.com/api/mt/SendSMS?APIKey=YOUR_API_KEY&senderid=TESTIN&channel=2&DCS=8&flashsms=0&number=91989xxxxxxx&text=%E0%A4%A8%E0%A4%AE%E0%A4%B8%E0%A5%8D%E0%A4%A4%E0%A5%87&route=1&EntityId=YOUR_ENTITY_ID&dlttemplateid=YOUR_TEMPLATE_ID
https://www.smsgatewayhub.com/api/mt/SendSMS?APIKey=YOUR_API_KEY&senderid=TESTIN&channel=2&DCS=0&flashsms=0&number=91989xxxxxxx&text=test+message&schedtime=2026/12/31+10:30:00+AM&route=1&EntityId=YOUR_ENTITY_ID&dlttemplateid=YOUR_TEMPLATE_ID
https://www.smsgatewayhub.com/api/mt/SendSMS?APIKey=YOUR_API_KEY&senderid=TESTIN&channel=2&DCS=0&flashsms=0&groupid=YOUR_GROUP_ID&text=test+message&route=1&EntityId=YOUR_ENTITY_ID&dlttemplateid=YOUR_TEMPLATE_ID
Response
{"ErrorCode":"000","ErrorMessage":"Success","JobId":"20047",
"MessageData":[{"Number":"91989xxxxxxx","MessageId":"mvHdpSyS7UOs9hjxixQLvw"}]}
POST works with the same fields as form fields. Up to 100 numbers per call - use a group or several calls for more. URL-encode the text (space = + or %20, & = %26).
Parameters
| Name | Description |
| APIKey required | Your API Key from the panel. |
| senderid required | Your approved 6-character Sender ID (header). |
| channel required | 2 = Transactional / Service, 1 = Promotional. |
| DCS | 0 = normal text (default), 8 = Unicode (Hindi and other languages). |
| flashsms | 0 = normal (default), 1 = flash message shown at once on the screen. |
| number required | Mobile number with country code, e.g. 9198xxxxxxxx. Several numbers: comma separated (max 100). |
| text required | Message text, exactly as the approved DLT template (variables filled in). |
| route | Route ID given by your account manager. Leave it out to use your account's default route. |
| EntityId | Your registered DLT Principal Entity ID. |
| dlttemplateid | Registered DLT Template ID of this text. |
| telemarketerid | Registered telemarketer ID (only if you were told to send it). |
| schedtime | Send later: yyyy/MM/dd hh:mm:ss AM, e.g. 2026/12/31 10:30:00 AM (IST). |
| groupid | Send to a saved contact group instead of number (see Groups). |
Check balance
GETPOST/api/mt/GetBalance
https://www.smsgatewayhub.com/api/mt/GetBalance?APIKey=YOUR_API_KEY
{"ErrorCode":"0","ErrorMessage":"Success","Balance":"Promo:9988|Trans:0"}
Delivery report (by JobId)
GETPOST/api/mt/GetDelivery
Use the JobId you got from Send SMS. Always send your API Key with this call.
https://www.smsgatewayhub.com/api/mt/GetDelivery?APIKey=YOUR_API_KEY&jobid=20047
{"ErrorCode":"0","ErrorMessage":"Success","MessageId":null,
"DeliveryReports":[{"MessageId":"mvHdpSyS7UOs9hjxixQLvw","DeliveryStatus":"Delivered","DeliveryDate":"2026-10-15T06:17:00"}]}
Tip: check delivery a few minutes after sending, not in a fast loop. Operators can take up to 48 hours to report some numbers.
Sent report by number
GETPOST/api/mt/GetSentReport
https://www.smsgatewayhub.com/api/mt/GetSentReport?apikey=YOUR_API_KEY&number=91989xxxxxxx
Sender IDs and DLT templates
| Call | What it does |
| /api/mt/getsenderid?Apikey=KEY | List your Sender IDs. |
| /api/mt/managesenderid?Apikey=KEY&SenderId=TESTIN&senderid_type=..&DltEntityid=..&OpName=..&Status=..&Sid=.. | Add or update a Sender ID (Sid = existing ID when updating). |
| /api/mt/deletesenderid?Apikey=KEY&Senderid=TESTIN | Delete a Sender ID. |
| /api/mt/gettemplates?Apikey=KEY | List your DLT templates. |
| /api/mt/managetemplate?Apikey=KEY&Temp_Name=..&Temp_message=..&TempType=..&TempId=..&Status=true&Tmid=.. | Add or update a DLT template (TempId = DLT Template ID). |
| /api/mt/deletetemplate?Apikey=KEY&DltTempid=.. | Delete a DLT template. |
Contact groups
| Call | What it does |
| /api/group/getallgroups?APIKey=KEY | List your groups. |
| /api/group/addnewgroup?APIKey=KEY&GroupName=Customers | Create a group. |
| /api/group/uploadcontacts?APIKey=KEY&GroupName=Customers&Numbers=9198xxxxxxxx,9199xxxxxxxx | Add numbers to a group (comma separated; use POST for long lists). |
All calls above work with GET or POST and need the API Key.
Error codes
| Code | Meaning |
| 000 | Success |
| 001 | Login details cannot be blank |
| 003 | Sender cannot be blank |
| 004 | Message text cannot be blank |
| 005 | Message data cannot be blank |
| 006 | Error: generic error description |
| 007 | API Key (or username / password) is invalid |
| 008 | Account not active |
| 009 | Account locked, contact your account manager |
| 010 | API restriction |
| 011 | IP address restriction |
| 012 | Invalid length of message text |
| 013 | Mobile numbers not valid |
| 014 | Account locked due to spam message, contact support |
| 015 | Sender ID not valid |
| 017 | Group ID not valid |
| 018 | Multi message to group is not supported |
| 019 | Schedule date is not valid |
| 020 | Message or mobile number cannot be blank |
| 021 | Insufficient credits |
| 022 | Invalid JobId |
| 023 | Parameter missing |
| 024 | Invalid template or template mismatch |
| 025 | {Field} can not be blank or empty |
| 026 | Invalid date range |
| 027 | Invalid opt-in user |
More detail: API error codes.
Code samples
curl -G "https://www.smsgatewayhub.com/api/mt/SendSMS" \
--data-urlencode "APIKey=YOUR_API_KEY" --data-urlencode "senderid=TESTIN" \
--data-urlencode "channel=2" --data-urlencode "DCS=0" --data-urlencode "flashsms=0" \
--data-urlencode "number=91989xxxxxxx" --data-urlencode "text=Your OTP is 123456" \
--data-urlencode "route=1" --data-urlencode "EntityId=YOUR_ENTITY_ID" \
--data-urlencode "dlttemplateid=YOUR_TEMPLATE_ID"
<?php
$q = http_build_query([
'APIKey' => 'YOUR_API_KEY', 'senderid' => 'TESTIN', 'channel' => '2', 'DCS' => '0',
'flashsms' => '0', 'number' => '91989xxxxxxx', 'text' => 'Your OTP is 123456',
'route' => '1', 'EntityId' => 'YOUR_ENTITY_ID', 'dlttemplateid' => 'YOUR_TEMPLATE_ID'
]);
$res = file_get_contents('https://www.smsgatewayhub.com/api/mt/SendSMS?' . $q);
$data = json_decode($res, true);
echo $data['ErrorCode'] . ' ' . $data['ErrorMessage'];
import requests
r = requests.get("https://www.smsgatewayhub.com/api/mt/SendSMS", params={
"APIKey": "YOUR_API_KEY", "senderid": "TESTIN", "channel": "2", "DCS": "0",
"flashsms": "0", "number": "91989xxxxxxx", "text": "Your OTP is 123456",
"route": "1", "EntityId": "YOUR_ENTITY_ID", "dlttemplateid": "YOUR_TEMPLATE_ID",
}, timeout=30)
print(r.json())
using System.Net.Http;
var http = new HttpClient();
string url = "https://www.smsgatewayhub.com/api/mt/SendSMS"
+ "?APIKey=YOUR_API_KEY&senderid=TESTIN&channel=2&DCS=0&flashsms=0"
+ "&number=91989xxxxxxx&text=" + Uri.EscapeDataString("Your OTP is 123456")
+ "&route=1&EntityId=YOUR_ENTITY_ID&dlttemplateid=YOUR_TEMPLATE_ID";
string json = await http.GetStringAsync(url);
Console.WriteLine(json);
import java.net.URI;
import java.net.URLEncoder;
import java.net.http.*;
import java.nio.charset.StandardCharsets;
String text = URLEncoder.encode("Your OTP is 123456", StandardCharsets.UTF_8);
String url = "https://www.smsgatewayhub.com/api/mt/SendSMS?APIKey=YOUR_API_KEY&senderid=TESTIN"
+ "&channel=2&DCS=0&flashsms=0&number=91989xxxxxxx&text=" + text
+ "&route=1&EntityId=YOUR_ENTITY_ID&dlttemplateid=YOUR_TEMPLATE_ID";
HttpResponse<String> res = HttpClient.newHttpClient().send(
HttpRequest.newBuilder(URI.create(url)).build(), HttpResponse.BodyHandlers.ofString());
System.out.println(res.body());
const params = new URLSearchParams({
APIKey: "YOUR_API_KEY", senderid: "TESTIN", channel: "2", DCS: "0", flashsms: "0",
number: "91989xxxxxxx", text: "Your OTP is 123456", route: "1",
EntityId: "YOUR_ENTITY_ID", dlttemplateid: "YOUR_TEMPLATE_ID",
});
const res = await fetch("https://www.smsgatewayhub.com/api/mt/SendSMS?" + params);
console.log(await res.json());
Ready-made SDKs and plugins: SDKs.
WhatsApp, RCS, Email and the unified CPaaS API
These channels use their own keys, created in Panel › CPaaS, sent in the header Authorization: Bearer <key>.
WhatsApp Business API
Templates, session messages, media, bulk campaigns, status and opt-outs. Key: sghwa_...
WhatsApp API docs ›PDF
Unified CPaaS API
One call for WhatsApp, SMS, RCS and Email with automatic fallback. POST /cpaas/v1/messages.ashx, key sghcp_...
Read more ›
RCS API
Rich cards, buttons and branded sender on Android.
RCS API PDF ›
Email API
Transactional and marketing email with tracking. POST /cpaas/email/api.ashx, key sghem_...
Email API PDF ›
curl -X POST "https://www.smsgatewayhub.com/cpaas/v1/messages.ashx" \
-H "Authorization: Bearer sghcp_YOUR_KEY" -H "Content-Type: application/json" \
-d '{"channels":["whatsapp","sms"],"to":"9198xxxxxxxx","fallbackAfter":300,
"whatsapp":{"template":"order_update","language":"en","variables":["1234"]},
"sms":{"text":"Your order 1234 is shipped","sender":"TESTIN","templateId":"YOUR_TEMPLATE_ID","entityId":"YOUR_ENTITY_ID"}}'
Need help with integration? Write to support@smsgatewayhub.com with your username and the JobId or error code.