Quick Answer
The SMSGatewayHub HTTP API is a URL-based interface that lets any application send SMS by calling http://www.smsgatewayhub.com/api/mt/SendSMS with an APIKey, approved 6-character sender ID, channel, route, number and text. It returns a JSON JobId and MessageIds, supports Unicode, group and scheduled sending, and works with PHP, Java, ASP.NET, VB.NET and Python. Usage is billed on Pay As You Go pricing.
What is the SMSGatewayHub HTTP API?
The HTTP API is the simplest way to connect your website, CRM, ERP or mobile backend to the SMSGatewayHub gateway. Every action - sending a message, fetching a delivery report or checking your credit - is a single HTTP request with query-string parameters, and every response is compact JSON that your code can parse in a few lines. There is no SDK to install and no session to maintain; if your language can call a URL, it can send SMS.
Authentication uses an APIKey instead of your panel username and password, so credentials never travel inside your application code. You generate the key from your SMSGatewayHub panel after you create a free account, and you can rotate it at any time. For production traffic we recommend the encrypted HTTPS SMS API, which uses exactly the same parameters over TLS and adds a dedicated OTP channel.
Because messages to Indian numbers must follow TRAI rules, your sender ID and content templates need to be approved on the DLT platform before you go live. Our team helps with DLT registration and template mapping so your first API call is delivered, not rejected.
What can you do with the HTTP API?
Seven endpoints cover the full messaging lifecycle.
Single SMS
Send one message to one mobile number and receive a JobId plus a MessageId for tracking.
Multiple SMS
Pass comma-separated numbers in the number parameter - up to 100 mobile numbers per request.
Group SMS
Send to a saved contact group from your panel using the groupid parameter.
Schedule SMS
Add schedtime in yyyy/mm/dd hh:mm:ss format to queue messages for a future time.
Delivery reports
Call GetDelivery with a JobId to read per-number status and delivery time. Learn what each delivery status means.
Check balance
GetBalance returns promotional and transactional credits so your app can alert before you run out.
How do I send a single SMS with the HTTP API?
Replace yourapicode, the sender ID, number and text with your own values. URL-encode the text in production.
httpGET http://www.smsgatewayhub.com/api/mt/SendSMS?APIKey=yourapicode&senderid=TESTIN&channel=2&DCS=0&flashsms=0&number=91989xxxxxxx&text=test message&route=1
Response:
{"ErrorCode":"000","ErrorMessage":"Success","JobId":"20047","MessageData":[{"Number":"91989xxxxxxx","MessageId":"mvHdpSyS7UOs9hjxixQLvw"},{"Number":"91989xxxxxxx","MessageId":"PfivClgH20iG6G5R3usHwA"}]}
Multiple, Unicode, group and scheduled SMS examples
Same SendSMS endpoint - only the parameters change.
http# Multiple SMS (comma-separated numbers)
http://www.smsgatewayhub.com/api/mt/SendSMS?APIKey=yourapicode&senderid=TESTIN&channel=2&DCS=0&flashsms=0&number=91989xxxxxxx,91999xxxxxxx&text=test message&route=1
# Unicode SMS (DCS=8)
http://www.smsgatewayhub.com/api/mt/SendSMS?APIKey=yourapicode&senderid=TESTIN&channel=2&DCS=8&flashsms=0&number=91989xxxxxxx&text=परीक्षण सन्देश&route=1
# Group SMS
http://www.smsgatewayhub.com/api/mt/SendSMS?APIKey=yourapicode&senderid=TESTIN&channel=2&DCS=0&flashsms=0&number=91989xxxxxxx&text=test message&groupid=###&route=1
# Schedule SMS
http://www.smsgatewayhub.com/api/mt/SendSMS?APIKey=yourapicode&senderid=TESTIN&channel=2&DCS=0&flashsms=0&number=91989xxxxxxx&text=test message&schedtime=2015/12/31 22:35:00 PM&route=1
Response:
{"ErrorCode":"000","ErrorMessage":"Success","JobId":"20047","MessageData":[{"Number":"91989xxxxxxx","MessageId":"BqTiw66A2UGLFV3DnwHFLQ"}]}
How do I check delivery status and balance?
Use the JobId returned by SendSMS, or pull a date-range report.
http# Delivery report for one job
http://www.smsgatewayhub.com/api/mt/GetDelivery?APIKey=yourapicode&jobid=#######
Response:
{"ErrorCode":"0","ErrorMessage":"Success","MessageId":null,"DeliveryReports":[{"MessageId":"mvHdpSyS7UOs9hjxixQLvw","DeliveryStatus":"Delivered","DeliveryDate":"2015-09-28T06:17:00"},{"MessageId":"PfivClgH20iG6G5R3usHwA","DeliveryStatus":"Delivered","DeliveryDate":"2015-09-28T06:17:00"}]}
# Multiple delivery report (date range)
http://www.smsgatewayhub.com/smsapi/mis.aspx?user=username&password=password&fromdate=mm/dd/yyyy&todate=mm/dd/yyyy
# Check balance
http://www.smsgatewayhub.com/api/mt/GetBalance?APIKey=yourapicode
Response:
{"ErrorCode":"0","ErrorMessage":"Success","Balance":"Promo:9988|Trans:0"}
HTTP API parameter reference
All parameters used by the SendSMS, GetDelivery and GetBalance calls.
| Parameter | Description |
| APIKey | Authenticates your account instead of username and password. |
| senderid | Approved sender ID (6-character string only). |
| channel | Message channel: Promotional = 1, Transactional = 2. |
| route | Route ID used to route the message (available in your panel). |
| DCS | Data coding value: 0 for normal text (default), 8 for Unicode SMS. |
| flashsms | 0 for normal SMS (default), 1 for flash message with immediate display. |
| number | Recipient mobile number; comma-separate multiple numbers. |
| text | Your SMS content (must match an approved DLT template). |
| schedtime | Schedule date-time, format yyyy/mm/dd hh:mm:ss PM, e.g. 2014/10/06 20:30:00 PM. |
| groupid | Group ID of a saved contact group. |
| jobid | Job ID returned by SendSMS, used with GetDelivery. |
Only 100 mobile numbers are allowed per request. For larger lists, batch your calls or use the panel's bulk upload.
How to integrate the HTTP API in four steps
Register and get credits
Sign up, complete KYC and receive test credits to try the API.
Complete DLT setup
Register your entity, sender ID and templates on DLT and map them in your panel.
Generate your APIKey
Create the key in the panel and note your route ID and approved sender ID.
Call SendSMS and track
Send a test, store the JobId, and poll GetDelivery or use webhooks for status.
Sample code, webhooks and security
Frequently Asked Questions
What is the SMSGatewayHub HTTP SMS API URL?
Messages are sent with a GET request to http://www.smsgatewayhub.com/api/mt/SendSMS, passing APIKey, senderid, channel, DCS, flashsms, number, text and route. Delivery reports use /api/mt/GetDelivery and balance checks use /api/mt/GetBalance. The same paths are available over HTTPS.
How many numbers can I send to in one HTTP API request?
You can pass up to 100 mobile numbers, comma-separated, in the number parameter of a single request. For larger campaigns, split the list into batches of 100 or upload the file through the SMSGatewayHub panel.
How do I send Hindi or regional-language SMS through the API?
Set DCS=8 and pass the Unicode text in the text parameter, URL-encoded. A Unicode SMS holds up to 70 characters per part, and SMSGatewayHub charges no extra fee for different languages.
What does channel=1 and channel=2 mean?
channel=1 sends on the promotional route and channel=2 on the transactional route. On the HTTPS API you can also pass channel=OTP for one-time passwords. Your route ID is passed separately in the route parameter.
Do I need DLT registration to use the HTTP API in India?
Yes. TRAI requires every commercial SMS to Indian numbers to use a DLT-registered sender ID and template, otherwise operators reject it. SMSGatewayHub helps you register and map templates before you start sending through the API.
Should I use HTTP or HTTPS for production?
Use HTTPS for production, because it encrypts your API key and message content in transit. The parameters and responses are identical, so switching only requires changing http:// to https:// in your base URL.
Which programming languages work with the SMSGatewayHub HTTP API?
Any language that can make an HTTP request works, including PHP, Java, ASP.NET, VB.NET, C#, Python and Node.js. SMSGatewayHub publishes sample code for several of these on its SMS for developers page.
Get your SMS API key today
Create a free SMSGatewayHub account, complete DLT setup and send your first API message in minutes. Sales: 1800 102 1822.