Overview
The XML API is an alternative integration format for teams whose systems consume and emit XML natively — think legacy Java middleware, SOAP-based ERPs, or integration platforms that pipe XML through transformation layers. Every endpoint available on the HTTP API is also available here.
When to use XML
Pick the XML API when any of the following applies to your environment.
- Your middleware (Mule, BizTalk, WSO2, legacy ESB) already speaks XML end-to-end.
- You need a schema-validated payload format for downstream audit or compliance.
- You consume responses inside an application that parses XML natively — e.g. Oracle Forms, SAP PI/PO, or an on-prem Java EE stack.
- You want to send several numbers in one request without constructing a JSON array.
Authentication
Authentication uses the same API key as the HTTP API. Place it inside a <credentials> block at the top of every request. Keys are 32-character hex strings and can be generated from Settings → API & Webhooks.
Keep your key server-side only. If a key is ever exposed in a repo, browser bundle, or log file, revoke and re-issue it immediately from the dashboard.
Send SMS
Submit a DLT-compliant message to one or more recipients in a single request. The response contains a messageid you use to fetch delivery reports later.
/api/xml/smsapiRequest body
| Parameter | Type | Description |
|---|---|---|
credentials.keyRequired | string | Your SMSLocal API key. |
request.routeRequired | integer | 1 for transactional (OTPs, alerts, 24x7, DND-exempt). 2 for promotional (marketing, 9am–9pm only, non-DND). |
request.senderRequired | string | 6-character DLT-registered header. Must belong to your Principal Entity. Example: ALERTS |
request.templateidRequired | string | DLT-approved template ID (19-digit). Content must match the approved template exactly. Example: 1207161234567890123 |
request.numbers.numberRequired | string[] | One or more recipient numbers. Each number is a 10-digit Indian mobile number (6/7/8/9 prefix). Up to 50,000 numbers per request. |
request.smsRequired | CDATA | Message body wrapped in CDATA so special characters (&, <, >, quotes) survive XML encoding. |
Request example
<?xml version="1.0" encoding="UTF-8"?>
<smslocal>
<credentials>
<key>YOUR_API_KEY</key>
</credentials>
<request>
<route>1</route> <!-- 1=transactional, 2=promotional -->
<sender>ALERTS</sender>
<templateid>1207161234567890123</templateid>
<numbers>
<number>9876543210</number>
<number>9123456789</number>
</numbers>
<sms><![CDATA[Your OTP is 482913. Valid for 10 minutes.]]></sms>
</request>
</smslocal>Response
Success
<?xml version="1.0" encoding="UTF-8"?>
<smslocal>
<response>
<status>success</status>
<messageid>1987654321</messageid>
<count>2</count>
</response>
</smslocal>Error
<?xml version="1.0" encoding="UTF-8"?>
<smslocal>
<response>
<status>error</status>
<code>110</code>
<message>Invalid DLT Template ID</message>
</response>
</smslocal>Delivery report
Fetch per-recipient delivery status for a previously-sent batch using its messageid. For high-volume applications, configure a webhook on the dashboard and let us push reports to you instead.
/api/xml/dlrapiRequest body
| Parameter | Type | Description |
|---|---|---|
credentials.keyRequired | string | Your SMSLocal API key. |
request.messageidRequired | string | The message ID returned when the batch was submitted via the Send SMS endpoint. Example: 1987654321 |
Request example
<?xml version="1.0" encoding="UTF-8"?>
<smslocal>
<credentials>
<key>YOUR_API_KEY</key>
</credentials>
<request>
<messageid>1987654321</messageid>
</request>
</smslocal>Response
<?xml version="1.0" encoding="UTF-8"?>
<smslocal>
<response>
<status>success</status>
<reports>
<report>
<number>9876543210</number>
<status>DELIVERED</status>
<time>2026-04-20 14:21:08</time>
</report>
<report>
<number>9123456789</number>
<status>FAILED</status>
<time>2026-04-20 14:21:12</time>
</report>
</reports>
</response>
</smslocal>DELIVERED, FAILED, PENDING, BLOCKED, EXPIRED. Reports are available for 30 days after submission.Check credits
Retrieve your current balance for a specific route. Poll this before large campaigns or wire it into an internal monitoring dashboard so you top up before running out.
/api/xml/creditapiRequest body
| Parameter | Type | Description |
|---|---|---|
credentials.keyRequired | string | Your SMSLocal API key. |
request.routeRequired | integer | 1 for transactional balance, 2 for promotional balance. |
Request example
<?xml version="1.0" encoding="UTF-8"?>
<smslocal>
<credentials>
<key>YOUR_API_KEY</key>
</credentials>
<request>
<route>1</route>
</request>
</smslocal>Response
<?xml version="1.0" encoding="UTF-8"?>
<smslocal>
<response>
<status>success</status>
<route>Transactional</route>
<credits>48215</credits>
</response>
</smslocal>Error codes
Error codes are shared between the HTTP and XML APIs. When a request fails, the response will have <status>error</status> and a numeric code.
| Code | Name | Meaning |
|---|---|---|
101 | Invalid user | The API key is missing, malformed, or revoked. |
102 | Invalid sender ID | Sender is not registered on DLT under your PE. |
103 | Invalid contact(s) | One or more numbers are not valid Indian mobile numbers. |
104 | Invalid route | Route must be 1 (transactional) or 2 (promotional). |
105 | Invalid message | Message is empty, too long, or has disallowed characters. |
106 | Spam blocked | Content matched a spam pattern flagged by the operator. |
107 | Promotional blocked | Recipient is on the DND list for this category. |
108 | Low credits | Not enough credits on the selected route. |
109 | Promotional timing | Promotional sends allowed 9:00 AM–8:45 PM IST only. |
110 | Invalid DLT Template ID | Template ID does not match an approved template. |
111 | No SMSC | No operator route currently available. Retry with backoff. |
See the HTTP API reference for full error-code fixes and remediation tips — they apply identically to the XML API.
Migration to REST
Teams that migrate from XML to REST typically save 30–50% on integration code and gain access to newer features like idempotency keys, streaming delivery reports, and native SDK support. Here is the quick mapping:
| XML endpoint | REST equivalent |
|---|---|
POST /api/xml/smsapi | GET /api/smsapi |
POST /api/xml/dlrapi | GET /api/dlrapi |
POST /api/xml/creditapi | GET /api/creditapi |
Ready to move to REST?
Our solutions engineers can review your XML payloads and ship a REST adapter alongside your existing integration so you cut over with zero downtime.