An SMS API lets your website, app or CRM send text messages automatically by making an HTTP request to an SMS gateway. In India, every business SMS must also pass DLT checks: a registered sender, a registered template and, since December 2024, a declared chain of telemarketers. If any of these don’t match, operators reject the message.
This guide shows how an SMS API works, with working code for sending SMS and OTPs, how to read delivery reports, the DLT rules in force for 2026, when WhatsApp is the better channel, and how to choose a provider.
Quick answers
1. What you need to send your first SMS in India: an API key, a DLT-registered Principal Entity (PE) ID, an approved sender ID (header), an approved content template, and a declared PE–TM chain.
2. Fastest way to add OTP login: use an OTP endpoint that generates, sends and verifies the code for you, so you don’t store OTPs yourself.
3. How to know a message was delivered: a “success” API response only means the request was accepted. Delivery is confirmed by the delivery report (DLR), for example status DELIVRD.
4. Biggest 2026 compliance change: every variable in a template must be pre-tagged by type (such as #url# or #numeric#), and Service Explicit templates no longer exist.
5. SMS or WhatsApp? SMS reaches every Indian phone without an app or data connection. WhatsApp is richer and supports two-way chat. Many businesses send OTPs and critical alerts by SMS and use WhatsApp for conversations, with SMS as the fallback.
What is an SMS API and how does it work in India?
An SMS API is a web endpoint your software calls to send a text message. Your app sends an HTTPS request with the number, sender ID and message. The SMS provider checks it, passes it to the telecom operator for DLT scrubbing, and reports back whether the message reached the phone.
Here is what happens to one message, start to finish:
- Trigger: A user signs up, places an order or makes a payment in your app.
- API request: Your server calls the SMS API with your API key, the recipient’s number, your sender ID and the message text.
- Provider checks: The provider authenticates the key, checks your balance and queues the message.
- DLT scrubbing: The operator checks that the sender ID, template and PE–TM chain are registered and match. A mismatch means the message is rejected here.
- Delivery: The operator delivers the SMS to the handset, or retries if the phone is off or out of coverage.
- Delivery report: The provider records a final status (such as DELIVRD) that you can pull by API or receive on a webhook.
Typical uses in India include OTPs for login and payments, order and shipping updates, COD confirmations, appointment reminders, bank and payment alerts, and system alerts from monitoring tools.
SMS API or bulk SMS dashboard? Use an API when messages are triggered by events in your software: OTPs, transaction alerts, order updates. Use a dashboard when a marketing team sends one-off campaigns to an uploaded list. Most providers, including SMS Alert, offer both on the same account.
How do I send an SMS with a REST API in India? (5-minute setup)
You send an SMS with one HTTPS request to the provider’s send endpoint, passing your API key, sender ID, recipient number and message. With SMS Alert, that endpoint is https://www.smsalert.co.in/api/push.json. The fastest path from sign-up to first message is below, which also makes it a practical choice for hackathons and prototypes.
- Create an account and copy your API key from the dashboard (API key guide).
- Add your DLT details your PE ID, an approved sender ID and an approved template (DLT process).
- Send a test message with one of the snippets below.
- Check delivery with the delivery report endpoint (next sections).
| Parameter | Required | What it is |
|---|---|---|
| apikey | Yes | Your API key from the dashboard |
| sender | Yes | Your DLT-registered sender ID (header) |
| mobileno | Yes | Recipient number, with or without 91. Comma-separate multiple numbers |
| text | Yes | URL-encoded message; must match your registered template |
| reference | No | Your own ID, such as an order number |
| dlrurl | No | Your webhook URL for delivery receipts |
Curl
curl -X POST "https://www.smsalert.co.in/api/push.json" \
--data-urlencode "apikey=YOUR_API_KEY" \
--data-urlencode "sender=YOURID" \
--data-urlencode "mobileno=9XXXXXXXXX" \
--data-urlencode "text=Your order #1042 has been shipped."
Python
import requests
response = requests.post(
"https://www.smsalert.co.in/api/push.json",
params={
"apikey": "YOUR_API_KEY",
"sender": "YOURID",
"mobileno": "9XXXXXXXXX",
"text": "Your order #1042 has been shipped.",
},
timeout=10,
)
print(response.json())
Node.js
const params = new URLSearchParams({
apikey: process.env.SMSALERT_API_KEY,
sender: "YOURID",
mobileno: "9XXXXXXXXX",
text: "Your order #1042 has been shipped.",
});
const res = await fetch(`https://www.smsalert.co.in/api/push.json?${params}`, { method: "POST" });
console.log(await res.json());
Sample response
{
"status": "success",
"description": {
"desc": "1 messages scheduled for delievery",
"batchid": "32720261",
"batch_dtl": [
{ "mobileno": "9XXXXXXXXX", "msgid": "91167733", "status": "AWAITED-DLR" }
]
}
}
A “success” here means the request was accepted, not delivered; the status starts as AWAITED-DLR. Save the batchid and msgid to check delivery later. SDKs are available for PHP, Java, Node.js, Python, Ruby and .NET.
Keep your API key on the server. Never call the API from browser or mobile app code; anyone who sees the key can spend your credits.
How do I send and verify an OTP with an SMS API?
The simplest way is an OTP endpoint that generates the code, sends it and verifies what the user types back, so you never store OTPs yourself. SMS Alert does this with https://www.smsalert.co.in/api/mverify.json: one call to send, a second to verify.
Step 1: Send the OTP. Put an [otp] tag in your template. SMS Alert replaces it with a generated code.
curl -X POST "https://www.smsalert.co.in/api/mverify.json" \
--data-urlencode "apikey=YOUR_API_KEY" \
--data-urlencode "sender=YOURID" \
--data-urlencode "mobileno=9XXXXXXXXX" \
--data-urlencode 'template=Your login OTP is [otp length="6" retry="3" validity="10"]. Do not share it with anyone.'
| [otp] attribute | Controls | Default |
|---|---|---|
| length | Number of digits (3–8) | 4 |
| retry | Resends allowed within the window | 5 |
| validity | Minutes before the code expires | 15 |
Step 2: Verify the code the user enters.
curl -X POST "https://www.smsalert.co.in/api/mverify.json" \
--data-urlencode "apikey=YOUR_API_KEY" \
--data-urlencode "mobileno=9XXXXXXXXX" \
--data-urlencode "code=482913"
{ "status": "success", "description": { "desc": "Code Matched successfully." } }
A wrong code also returns “status”: “success”, with “desc”: “Code does not match.” Check desc before logging the user in.
What makes OTP delivery reliable in India?
OTP delivery depends on the route, the template and your own app logic, not only the provider’s advertised speed.
- Use a transactional or service route: OTPs are not promotional, so they reach numbers on DND at any hour. Register the template in the right category.
- Keep the template exact: Any change from the registered text, or an untagged variable, gets the message rejected at scrubbing.
- Cap resends: A low retry value blocks OTP abuse and SMS pumping, where bots trigger thousands of paid OTPs. Add a per-number and per-IP rate limit in your app too.
- Add a fallback: If no delivery report arrives within 20–30 seconds, offer “Send via WhatsApp” or a voice call (see SMS vs WhatsApp below).
- Support auto-read on Android: Add your app’s 11-character hash at the end of the template so Android’s SMS Retriever API can fill the code automatically. Register the template with the hash included.
- Test before you commit: Send real OTPs to Jio, Airtel, Vi and BSNL numbers and compare delivery times across a few days.
Cheapest OTP API with good deliverability? Compare cost per delivered OTP, not price per SMS. A cheaper route that fails 5% of the time costs more once you count resends and abandoned sign-ups.
How do I check if an SMS was delivered?
Check the delivery report (DLR), not the send response. You can pull it by API using the batchid, or have the provider push it to your webhook as soon as the status changes. For OTPs and high volumes, webhooks are faster and cheaper than polling.
Option 1: Pull the status
curl -X POST "https://www.smsalert.co.in/api/pull.json" \
--data-urlencode "apikey=YOUR_API_KEY" \
--data-urlencode "batchid=32720261"
{
"status": "success",
"description": {
"report": [
{
"mobileno": "919XXXXXXXXX",
"sender": "YOURID",
"msgid": "4359345",
"status": "DELIVRD",
"lastupdated": "2026-11-22 17:34:15"
}
]
}
}
Option 2: Receive webhook delivery receipts. Add dlrurl (your endpoint) and reference (your own ID) to the send request. SMS Alert calls your URL when the status changes.
curl -X POST "https://www.smsalert.co.in/api/push.json" \
--data-urlencode "apikey=YOUR_API_KEY" \
--data-urlencode "sender=YOURID" \
--data-urlencode "mobileno=9XXXXXXXXX" \
--data-urlencode "text=Your order #1042 has been shipped." \
--data-urlencode "reference=ORDER-1042" \
--data-urlencode "dlrurl=https://yourapp.com/webhooks/sms-dlr"
Common delivery statuses (codes vary slightly by provider; see the full error code list)
| Status | Meaning | What to do |
|---|---|---|
| DELIVRD | Delivered to the handset | Nothing |
| AWAITED-DLR | Sent; operator hasn’t reported yet | Wait; for OTPs, offer a fallback after 20–30 s |
| ABSENT-SUB | Phone off or out of coverage | Operator retries; resend later if needed |
| DEFERRED / CONGESTION | Temporarily delayed | Usually clears on its own |
| INVALID-SUB | Number doesn’t exist | Remove or correct the number |
| DND / rejected at scrubbing | Template, header or chain mismatch, or DND for promotional | Check DLT registration (next section) |
The HTTP status code tells you whether your request itself worked: 401 means a wrong or expired key, 402 means insufficient balance or plan limits, and 429 means you are sending faster than your rate limit.
What are the DLT rules for business SMS in India in 2026?
Every commercial SMS in India must come from a business registered on an operator’s DLT platform, use a registered sender ID and a registered template, and travel through a declared chain of telemarketers. These rules come from TRAI’s Telecom Commercial Communications Customer Preference Regulations, 2018 (TCCCPR). Messages that fail any check are rejected during operator scrubbing.
What you register on DLT
- Principal Entity (PE): your business, registered once on any operator’s DLT portal (Jio, Airtel, Vi, BSNL or Tata).
- Header (sender ID): the name shown on the phone, such as SMSALT.
- Content templates: the exact text of each message, with every variable tagged by type.
- PE–TM chain: the telemarketers (SMS providers) your messages pass through. Your provider gives you the chain details to declare.
- Whitelisted links and numbers: every URL, APK link and callback number you put in messages.
- Consent: required for promotional messages to customers who haven’t opted in.
Template categories in 2026
| Category | Used for | Reaches DND numbers? | Sending hours |
|---|---|---|---|
| Transactional | OTPs and alerts from banks and financial institutions | Yes | Any time |
| Service Implicit | OTPs, order and delivery updates, reminders from any business | Yes | Any time |
| Promotional | Offers and marketing, including offers to existing customers | No, unless consent is recorded | 10 AM–9 PM |
Service Explicit no longer exists. Since 10 March 2026, existing Service Explicit templates count as Promotional, and promotional messages can now use an alphabetic brand header, under TRAI’s Second Amendment notified on 12 February 2025. If an order update also carries an offer, the whole message counts as promotional, so send the offer separately.
Key DLT changes since 2024
| Effective | Change | What you must do |
|---|---|---|
| 18 Sep 2026 | Third Amendment: AI-based spam detection, A2P call rules, header and template misuse suspended within 6 hours, legacy consent recognised if verifiable and registered (TRAI PR 119/2026) | Keep consent records verifiable; secure who can use your header |
| 10 Mar 2026 | Service Explicit merged into Promotional | Re-check offer templates |
| Jan 2026 (60 days after 18 Nov 2025) | Every template variable must be pre-tagged by type, such as #url# or #numeric# (TRAI PR 133/2025) | Update old {#var#} templates |
| 11 Dec 2024 | PE–TM chain binding fully enforced; undeclared chains rejected (TRAI PR 92/2024) | Declare your chain on the DLT portal |
| 1 Oct 2024 | URLs, APK links and callback numbers must be whitelisted (TRAI PR 80/2024) | Whitelist every link before sending |
What do SMS headers like AX-SMSALT-S mean?
A header has three parts. The first two letters show the operator and telecom circle the message came through. The middle is the sender’s registered name. The suffix shows the message type: -S service, -T transactional, -P promotional and -G government. So AX-DOPBNK-S is a service message from the sender registered as DOPBNK.
Why is my DLT-compliant SMS not delivered?
Most failures come from a mismatch between what you send and what you registered. Check in this order:
- Template text: even one changed word, space or punctuation mark fails scrubbing.
- Variables: each must be pre-tagged with the right type and hold that kind of value.
- Links and numbers: every URL and callback number must be whitelisted.
- Header: the sender ID must be linked to that template.
- PE–TM chain: your chain must be declared and include your SMS provider.
- Category: offers sent on a service template, or promotions sent outside 10 AM–9 PM, are blocked.
For the latest procedures, see TRAI’s advice to senders and your operator’s DLT portal. Follow our DLT process guide and structured template guide for step-by-step setup.
SMS or WhatsApp for OTPs and alerts: which should you use?
Use SMS when the message must reach everyone, and WhatsApp when you want a richer, two-way conversation. SMS works on every Indian phone without data or an app. WhatsApp supports buttons, media and replies, but only reaches users who have WhatsApp and are online. For anything critical, the strongest setup is one channel first with the other as automatic failover.
| SMS | ||
|---|---|---|
| Reach | Every mobile number, including feature phones | Only WhatsApp users with data |
| Setup | DLT registration of entity, header and templates | Meta business verification and template approval |
| Content | Plain text, up to 160 characters per part (70 in Hindi and other Unicode scripts) | Rich text, images, buttons, documents |
| Two-way replies | Limited | Full chat |
| Best for | OTPs, bank and payment alerts, fallback | Order updates with tracking buttons, support, reminders, re-engagement |
How SMS failover works. Send on the preferred channel first, then watch the delivery status. If WhatsApp isn’t delivered within a set time, or the number isn’t on WhatsApp, send the same message by SMS. For OTPs, many teams do the reverse: SMS first, with a “Get code on WhatsApp” button after 30 seconds. SMS Alert supports SMS, and its sister product ChatOnDesk handles WhatsApp, so both can run from one setup.
Long messages cost more. A message over 160 characters (or 70 in Unicode) is split into parts, and each part is billed. Keep OTPs and alerts short, especially in regional languages
Can I send order SMS from Shopify, WooCommerce or WordPress?
Yes. You don’t need to write code for common e-commerce and form events. SMS Alert integrations send order confirmations, shipping updates, COD confirmations, abandoned-cart reminders and OTP login from:
- E-commerce: Shopify, WooCommerce, Magento, PrestaShop, OpenCart
- Forms and WordPress: Contact Form 7, Gravity Forms, WPForms, Elementor Forms, Ninja Forms
- Helpdesk and monitoring: Zendesk, Freshdesk, Zabbix
- Automation: Google Sheets, Zapier, Make
See the full integrations list for setup guides.
How do I choose the best SMS API provider in India?
Pick the provider that delivers best on your own traffic, handles DLT for you, and charges a fair cost per delivered message. Shortlist two or three, send real OTPs and alerts to Jio, Airtel, Vi and BSNL numbers for a few days, and compare delivery rate, delivery time and support response.
What to check, and what good looks like
| Need | Ask the provider | Good answer |
|---|---|---|
| Simple REST API | Is there a send endpoint, JSON responses and SDKs? | One-call send, docs with copy-paste samples, SDKs for your language |
| Delivery to all Indian operators | What were delivery rates by operator last month? | Numbers per operator, not one blended figure |
| OTP reliability | Do you have dedicated OTP routes and a verify API? | Yes, plus resend limits and fast delivery reports |
| Automatic failover | What happens when a route or operator slows down? | Automatic rerouting, and SMS-to-WhatsApp or voice fallback |
| Retries and scheduling | Are temporary failures retried? Can I schedule sends? | Automatic retries, a queue, scheduled sends by API |
| DLT and compliance help | Will you help register headers and templates and fix rejections? | Template conversion help and clear rejection reasons |
| Delivery reports | Can I get DLRs by API and webhook? | Both, with message IDs and your own reference |
| Throughput | What’s my rate limit, and how do I raise it? | A stated per-second limit and a quick upgrade path |
| Pricing | Pay as you go? Minimum recharge? Credit expiry? | Clear per-SMS price, no expiry, no hidden DLT fees |
| Support | Can I reach an engineer during integration? | Named contact or chat with technical staff |
Best choice by situation
- Hackathon or prototype: choose instant sign-up, an API key in the dashboard, free test credits and copy-paste code. Note that live sends in India still need DLT registration, which takes days, so test with a provider’s pre-approved demo template where offered.
- OTP-heavy apps: prioritise dedicated OTP routes, a verify API, webhook receipts and a WhatsApp or voice fallback.
- Cheapest OTP with good deliverability: compare cost per delivered OTP, including resends, not the headline per-SMS rate.
- High volume (lakhs of messages a day): ask for stated throughput, queueing and route failover, and run a load test before launch.
- E-commerce stores: pick a provider with a ready plugin for your platform, so order and COD messages work without code.
How SMS API pricing works in India. You usually prepay credits, and each message part sent uses one credit. Prices differ by category (transactional, service or promotional) and drop with volume. Ask whether DLT scrubbing and operator charges are included, whether credits expire, and whether failed messages are refunded. Compare the total monthly cost on your expected volume, including taxes.
Why use SMS Alert as your SMS API in India?
SMS Alert is an Indian SMS API provider for OTPs, transactional alerts and campaigns, with a REST API, a built-in OTP verify endpoint, webhook delivery reports and help with DLT registration. It suits developers who want to send their first message in minutes and e-commerce teams who want ready plugins.
| Feature | What you get |
|---|---|
| REST API | push.json to send, pull.json for reports, JSON responses |
| OTP | Generate and verify in two calls, with length, resend and expiry controls |
| Delivery reports | Pull by batchid or webhook via dlrurl, with your own reference |
| Reliability | Automatic retries, message queue and optimised routing across operators |
| Scheduling | Schedule, edit and cancel sends by API |
| DLT help | Template conversion to DLT format and support with rejections |
| SDKs | PHP, Java, Node.js, Python, Ruby, .NET |
| Integrations | Shopify, WooCommerce, Magento, WordPress forms, Zendesk, Freshdesk, Google Sheets and more |
| Via sister product Chat ON Desk, for SMS-to-WhatsApp journeys |
Get your API key and send a test SMS. Read the API documentation
Frequently asked questions
Which SMS API has a simple REST API and good delivery to all Indian operators?
Look for a one-call send endpoint, JSON responses, SDKs and delivery rates reported per operator. SMS Alert sends with a single request to push.json and reports delivery by API or webhook. Always confirm with your own test sends to Jio, Airtel, Vi and BSNL numbers.
Which SMS API provider in India has strong OTP delivery and automatic failover?
Choose one with dedicated OTP routes, a verify API, automatic retries and rerouting, and a fallback channel such as WhatsApp or voice. Measure delivery time and cost per delivered OTP on your own traffic before committing.
What's the fastest SMS API to set up for a hackathon in India?
One with instant sign-up, a dashboard API key, free credits and copy-paste code. Live sending in India needs DLT registration, which takes several days, so ask for a pre-approved demo template for testing.
Is DLT registration mandatory for sending SMS in India?
Yes, for any business SMS. You must register your business, sender ID and templates on an operator’s DLT portal, declare your PE–TM chain, and whitelist any links or callback numbers.
Why is my transactional SMS not delivered even though the template is approved?
Usually the sent text doesn’t exactly match the template, a variable isn’t pre-tagged correctly, a link isn’t whitelisted, or the PE–TM chain is missing your provider. Check the delivery report reason, then compare the sent text with the registered template character by character.
What does -S, -T, -P or -G at the end of an SMS sender name mean?
It shows the message type: -S service, -T transactional, -P promotional and -G government.
What is the difference between transactional, service and promotional SMS?
Transactional and service messages are OTPs, alerts and updates the customer expects, and they reach DND numbers at any time. Promotional messages are offers and marketing; they need consent for DND numbers and can only be sent between 10 AM and 9 PM.
How much does an SMS API cost in India?
It depends on message category, volume and provider, and most providers use prepaid, pay-as-you-go credits. Compare the total cost per delivered message, including DLT and operator charges, taxes and credit expiry.
Should I send OTPs by SMS or WhatsApp?
SMS reaches every phone, so it’s the safer default for OTPs. WhatsApp OTPs work well for app users, and offering both, with automatic fallback, gives the highest success rate.
Can I send SMS from WooCommerce, Shopify or WordPress without coding?
Yes. Plugins send order, shipping, COD and OTP messages automatically. SMS Alert has integrations for Shopify, WooCommerce, Magento and the main WordPress form plugins.
What programming languages can I use with an SMS API?
Any language that can make an HTTPS request. SMS Alert also provides SDKs for PHP, Java, Node.js, Python, Ruby and .NET.
