MSG91 API
Send and verify OTPs, DLT template SMS, WhatsApp templates and buttons, and transactional email from India with one authkey.
CommunicationGuided#sms#otp#whatsapp#email#india#dlt
Fork copies the collection into your workspace, without the publisher's secrets, so you can add your own key and send requests. Star saves it to your starred APIs (Account › Marketplace) and helps others find it.
Overview
MSG91 is an Indian cloud communications platform (by Walkover) used for transactional and OTP SMS, WhatsApp Business messaging, transactional email, voice and RCS. Its v5 REST API lives on one host and authenticates every call with a single account key called the authkey. This guided collection covers the flows most Indian apps need first: the SendOTP service (send, verify, resend), template-based SMS through Flows, WhatsApp messages from your integrated number, and transactional email, plus the delivery logs and analytics you use to debug them.
Get an authkey
- Sign up at msg91.com and log in to the panel at control.msg91.com.
- Open the username menu (top right, or bottom left inside a service dashboard) and choose Authkey. See where to find your authkey.
- Verify with the OTP sent to your registered mobile number, choose Create New, give the key a name and pick the rule (for example IP whitelisting) that should apply to it.
- Copy the key into the secret variable
authkey. Keys can be disabled or edited from the same page; create one key per environment so you can revoke them separately.
India DLT before you send SMS
Every commercial SMS to Indian numbers must use a sender ID (header) and a content template registered on a TRAI DLT portal. Register them on the DLT portal of your operator, then add the same text, sender ID and the DLT template ID in MSG91 (SMS > Templates, or the Add SMS template request here). OTP templates are created in the OTP section and must contain the ##OTP## placeholder. Unregistered content is blocked by operators even when the API returns success.
Authentication and base URL
Send the key in an authkey request header (this collection sets it once for every request). Base URL: https://control.msg91.com/api/v5. There is no separate sandbox host: test with your own number and the small free credit given to new accounts. Mobile numbers are always in international format with the country code and no plus sign, for example 919999999999 for India.
Variables and run order
Fill authkey first, then mobile (your own test number). Run 1. Start here to confirm the key works. For 2. OTP set otpTemplateId; for 3. SMS set smsTemplateId (the Flow / template ID from the SMS panel); for 4. WhatsApp run Fetch WhatsApp numbers and copy your number into integratedNumber, then pick an approved template for waTemplateName; for 5. Email set emailDomain, senderEmail and emailTemplateId. Log requests fill startDate and endDate (the last three days) automatically when they are empty.
Limits and pricing
SMS, OTP, WhatsApp and email are prepaid per message, with prices that depend on the channel, route and destination country; WhatsApp also carries Meta's conversation charges. See msg91.com/pricing. Log endpoints only cover the last three days per call; analytics cover up to 31 days.
Common errors
MSG91 often answers with HTTP 200 and an error in the body, so always check type (OTP endpoints) or hasError / status (v5 JSON endpoints).
| Response | Meaning | What to do |
|---|---|---|
| 401, "Auth Key missing" / "Invalid authkey" / "Unauthorized" | Key missing, wrong, disabled or blocked by its IP rule | Check the authkey header and the key's rules. |
200, type: error, "The provided flow ID or template ID is invalid." | Template or flow ID not found | Copy the ID again from the panel. |
200, type: error, "OTP expired" / "OTP not match" | The user's code is stale or wrong | Ask the user to retry or call Resend OTP. |
| 200, "OTP retry count maxed out" | Resend limit reached | Start over with Send OTP. |
200, error: "Duration exceeds, allowed limit is 3 days" | Log window too wide | Narrow startDate / endDate. |
| 402 | Not enough balance | Recharge the account. |
| 422 | Validation failed | Read errors for the field. |
Links
- API reference: docs.msg91.com
- SendOTP: docs.msg91.com/otp/sendotp
- Send SMS (Flow): docs.msg91.com/sms/send-sms
- WhatsApp template send: docs.msg91.com/whatsapp/template-bulk
- Send email: docs.msg91.com/email/send-email
Endpoints 20
1. Start here
- GETList SMS templates (flows)
/flowsLists the SMS templates (flows) on your account with their IDs and names. Use it as a free first call to confirm the authkey, and to find the template_id you…
2. OTP
- POSTSend OTP
/otpGenerates a one-time code and sends it by SMS to mobile using your OTP template. MSG91 keeps the code and its expiry, so your server only has to call Verify… - GETResend OTP
/otp/retrySends the same pending code again to mobile, either as a voice call or as a text message. Call it from a 'resend code' button after Send OTP; it fails when no… - GETVerify OTP
/otp/verifyChecks the code the user typed against the pending OTP for mobile. Call it when the user submits the code and continue only when type is success. Put the… - GETOTP logs
/report/logs/p/otpReturns OTP delivery logs, one row per message, for a window of at most three days that starts within the last three days. Filter by requestId from Send OTP…
3. SMS
- POSTAdd SMS template
/sms/addTemplateCreates an SMS template in your MSG91 account from text, sender ID and (in India) the DLT template ID. Use it to keep templates in code instead of the panel;… - POSTSend SMS (Flow)
/flowSends an SMS template to one or more recipients. Each object in recipients has mobiles (country code first) and the template's variables with the same… - POSTSMS logs
/report/logs/p/smsReturns per-message SMS delivery logs (status, number, request and delivery times, failure reason) for up to three days within the last three days. Pass the… - GETSMS analytics
/report/analytics/p/smsReturns totals for a date range: messages sent, delivered, failed, rejected and NDNC-filtered, with their lengths and credits. Use it for delivery-rate…
4. WhatsApp
- GETFetch WhatsApp numbers
/whatsapp/whatsapp-activation/Lists the WhatsApp numbers activated on your MSG91 account. Run it first and copy your sender number (country code, no plus) into integratedNumber; every… - GETGet WhatsApp templates
/whatsapp/get-template-client/{{integratedNumber}}Lists the message templates attached to your integrated number, with their names, languages, status and components. Use it to pick an approved template for… - POSTSend WhatsApp template
/whatsapp/whatsapp-outbound-message/bulk/Sends an approved template to one or more recipients in one call; this is the only message type allowed outside the 24-hour window. Each entry in… - POSTSend WhatsApp text
/whatsapp/whatsapp-outbound-message/Sends a free-form text message from your integrated number. It is delivered only inside the 24-hour customer service window, so use it to reply to someone who… - POSTSend WhatsApp reply buttons
/whatsapp/whatsapp-outbound-message/Sends an interactive message with up to three quick-reply buttons plus an optional image header, body text and footer. Like plain text, it needs an open… - POSTCheck WhatsApp prepaid balance
/subscriptions/fetchPrepaidBalanceReturns the prepaid WhatsApp wallet balance for an integrated number, so you can alert before sends start failing. Send the number and service: whatsapp in… - GETWhatsApp logs
/report/logs/waReturns WhatsApp message logs (status sent, delivered, read or failed, price, template name, direction and failure reason) for at most three days within the…
5. Email
- POSTValidate an email address
/email/validateChecks whether an address is likely deliverable before you send to it: syntax, domain, disposable and role-based addresses. Each validation is charged, so use… - POSTSend email (template)
/email/sendSends a template email to one or more recipient groups. Each object in recipients has its own to (and optional cc, bcc) list and variables that fill the… - GETList email templates
/email/templatesLists your email templates with paging and optional search, so you can find the ID to put in emailTemplateId. Errors: 401 for a bad key. - GETEmail logs
/report/logs/mailReturns per-recipient email logs (status such as Delivered, failure reason, subject, template, open and click counts) for at most three days within the last…
API details
- Base URL
https://control.msg91.com/api/v5- Authentication
- An API key in the authkey header
- Operations
- 20 operations on 20 pathsGET 10POST 10
- Main resources
- 1. Start here 12. OTP 43. SMS 44. WhatsApp 75. Email 4
- Description format
- Swastik Codes guided collection, API version
checked against the docs on 2026-11-18 - Links
- Documentation
How to test the MSG91 API in Swastik Codes
- Open the APISelect “Fork & run in Swastik Codes” on this page. Sign in or create a free account if asked.
- Fork it into your workspaceChoose a workspace. You get your own copy of the MSG91 API collection, without the publisher's secrets.
- Add your credentialsThis API uses an API key in the authkey header. Add yours in the collection's variables or an environment; the requests already reference it.
- Send a requestPick an endpoint, for example “List SMS templates (flows)” (GET /flows), and press Send. Check the response, add tests and run the whole collection with the runner.
Frequently asked questions
What is the MSG91 API?
Send and verify OTPs, DLT template SMS, WhatsApp templates and buttons, and transactional email from India with one authkey. It is listed under Communication and has 20 endpoints.
Who publishes the MSG91 API?
It is listed from MSG91's public API description (an OpenAPI document), not published by MSG91 on Swastik Codes. Anyone who controls msg91.com can claim the profile by adding a DNS TXT record.
What is the base URL of the MSG91 API?
Requests go to https://control.msg91.com/api/v5. Endpoint paths are added to this base URL.
How do I authenticate with the MSG91 API?
With an API key in the authkey header.
How many endpoints does the MSG91 API have?
20 operations on 20 paths (10 GET, 10 POST). The largest groups are 1. Start here, 2. OTP, 3. SMS, 4. WhatsApp.
Is forking the MSG91 API free?
Yes. Forking copies the collection into your workspace for free. It has been starred 0 times and forked 0 times.