Validate DLT Template API

Verify SMS Message Against DLT Template for Compliance

Introduction to Validate DLT Template API

Welcome to SMSGatewayCenter's Validate DLT Template API! This essential API allows you to verify that your SMS message matches the registered DLT (Distributed Ledger Technology) template before sending messages. Perfect for ensuring India TRAI DLT compliance, preventing message rejections, validating variable replacements in templates, and building pre-send validation in mobile applications. Our RESTful endpoint uses POST method with application/x-www-form-urlencoded content type for secure integration.

About DLT Template Validation

The Validate DLT Template API enables you to:

  • Pre-validate messages - Check template match before sending SMS
  • Ensure DLT compliance - Verify India TRAI DLT requirements
  • Prevent rejections - Catch template mismatches before API submission
  • Validate variables - Check dynamic variable replacements in templates
  • Sender ID verification - Confirm sender ID matches registered template
  • Template ID check - Verify DLT template ID validity
  • Real-time validation - Instant feedback on template compliance

This API is crucial for India SMS campaigns to ensure all messages comply with DLT regulations before sending.

What is DLT Template Validation?

DLT (Distributed Ledger Technology) is a regulatory framework by TRAI (Telecom Regulatory Authority of India) that requires all commercial SMS messages to be pre-registered with approved templates. This API validates that your message content exactly matches your registered DLT template, including proper variable syntax {#var#}, ensuring your SMS will not be rejected by operators.


Validate Template

Validate that your SMS message matches the registered DLT template. Returns success if message matches template, or error with reason if validation fails.

API Endpoint

https://unify.smsgateway.center/SMSApi/validateTemplate

HTTP Method

POST

Content Type

application/x-www-form-urlencoded

Important: This API requires application/x-www-form-urlencoded content type. Use --data-urlencode in cURL or appropriate encoding in your HTTP client.

 

Required Parameters
KeyValueDescription
Login Credentials (Required)
Authenticate your API request using userid-password or apiKey—choose one method.
useridYour Registered UsernameYour registered username; use if apiKey isn't provided. Signup for User ID
passwordYour PasswordURL-encoded password (for special characters); use if apiKey isn't provided. Signup for API Key
Header (optional) Parameters
apiKeyYour unique apiKeyapiKey needs to be sent as HTTP header when you are not using userid-password method. You can avail this from your user control panel and use instead of userid-password HTTP Request parameter. Please do not disclose this to anyone.

 

Request Parameters
ParameterTypeRequiredDescription
senderidStringYesSender ID registered with DLT (e.g., "SMSGAT")
msgStringYesSMS message text to validate against DLT template. Include variables as {#var#}
dltTemplateIdStringYesDLT Template ID registered with operator (e.g., "xxxx16194317445xxxx")
outputStringOptionalResponse format. Use json for JSON response (recommended)
Sample Request Code (cURL)
curl --location 'https://unify.smsgateway.center/SMSApi/validateTemplate' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'userid=YourUsername' \
--data-urlencode 'password=YourPassword' \
--data-urlencode 'output=json' \
--data-urlencode 'senderid=SMSGAT' \
--data-urlencode 'msg=Your Instant Demo account is live. This is a Demo Test message. {#var#} Demo Message SMSGatewayCenter' \
--data-urlencode 'dltTemplateId=xxxx16194317445xxxx'
Sample Request Code (PHP)
<?php

$curl = curl_init();

$postData = array(
  'userid' => 'YourUsername',
  'password' => 'YourPassword',
  'output' => 'json',
  'senderid' => 'SMSGAT',
  'msg' => 'Your Instant Demo account is live. This is a Demo Test message. {#var#} Demo Message SMSGatewayCenter',
  'dltTemplateId' => 'xxxx16194317445xxxx'
);

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://unify.smsgateway.center/SMSApi/validateTemplate",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => http_build_query($postData),
  CURLOPT_HTTPHEADER => array(
    "Content-Type: application/x-www-form-urlencoded",
    "cache-control: no-cache"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
Sample Response (Success)
{
  "status": "success",
  "template": "Your Instant Demo account is live  This is a Demo Test message  {#var#} Demo Message SMSGatewayCenter",
  "dltTemplateId": "xxxx16194317445xxxx",
  "senderId": "SMSGAT",
  "statusCode": "200",
  "reason": "success",
  "text": "Your Instant Demo account is live. This is a Demo Test message. {#var#} Demo Message SMSGatewayCenter"
}

Explanation: The message matches the DLT template successfully. Note that punctuation differences are normalized (periods may be converted to spaces in the template field).

Sample Response (Error - Template Mismatch)
{
  "status": "error",
  "statusCode": "188",
  "reason": "message template mismatch"
}

Explanation: The message does not match the registered DLT template. Check for differences in text, spacing, or variable syntax.


Response Fields

FieldTypeDescription
Success Response Fields
statusStringResponse status: "success" or "error"
templateStringNormalized template text (punctuation may be converted to spaces)
dltTemplateIdStringDLT Template ID that was validated
senderIdStringSender ID that was validated
statusCodeStringStatus code: "200" for success
reasonStringResult message: "success" or error description
textStringOriginal message text as submitted
Error Response Fields
statusString"error"
statusCodeString"188" - Template mismatch error code
reasonStringError description (e.g., "message template mismatch")

Understanding DLT Variables

DLT templates support dynamic variables that can be replaced with actual values when sending messages. Variables must be properly formatted for validation to succeed.

Variable Syntax

Correct Variable Format: {#var#}

Examples of valid variables:

  • {#var#} - Generic variable placeholder
Template Examples
Use CaseTemplate Example
OTP MessageYour OTP is {#var#}. Valid for 10 minutes. Do not share. - YourCompany
Order ConfirmationYour order {#var#} is confirmed. Amount: Rs {#var#}. Thank you - YourStore
Appointment ReminderReminder: Your appointment with Dr. {#var#} on {#var#} at {#var#}. - YourClinic
Payment DueDear {#var#}, your payment of Rs {#var#} is due on {#var#}. Pay now - YourCompany

Integration Examples

Example 1: Pre-Send Validation in Mobile App

// React Native / JavaScript example
async function validateBeforeSend(senderId, message, dltTemplateId) {
  const params = new URLSearchParams({
    userid: 'YourUsername',
    password: 'YourPassword',
    output: 'json',
    senderid: senderId,
    msg: message,
    dltTemplateId: dltTemplateId
  });

  try {
    const response = await fetch('https://unify.smsgateway.center/SMSApi/validateTemplate', {
      method: 'POST',
      headers: {
        'Content-Type': 'application/x-www-form-urlencoded'
      },
      body: params.toString()
    });

    const data = await response.json();
    
    if (data.status === 'success' && data.statusCode === '200') {
      console.log('✓ Template validated successfully');
      console.log(`Sender: ${data.senderId}`);
      console.log(`Template: ${data.template}`);
      
      // Proceed to send SMS
      return true;
    } else {
      console.error(`✗ Validation failed: ${data.reason}`);
      alert(`Template mismatch. Please check your message format.`);
      
      // Do not send SMS
      return false;
    }
  } catch (error) {
    console.error('Validation error:', error);
    return false;
  }
}

// Usage
const isValid = await validateBeforeSend(
  'SMSGAT',
  'Your Instant Demo account is live. This is a Demo Test message. {#var#} Demo Message SMSGatewayCenter',
  'xxxx16194317445xxxx'
);

if (isValid) {
  // Send SMS using send API
  sendSMS(...);
}

Example 2: Batch Validation

import requests
from urllib.parse import urlencode

def validate_template(userid, password, sender_id, message, dlt_template_id):
    url = 'https://unify.smsgateway.center/SMSApi/validateTemplate'
    
    data = {
        'userid': userid,
        'password': password,
        'output': 'json',
        'senderid': sender_id,
        'msg': message,
        'dltTemplateId': dlt_template_id
    }
    
    headers = {
        'Content-Type': 'application/x-www-form-urlencoded'
    }
    
    response = requests.post(url, data=data, headers=headers)
    result = response.json()
    
    return result['status'] == 'success' and result['statusCode'] == '200'

# Batch validate multiple messages
messages_to_validate = [
    {
        'sender': 'SMSGAT',
        'message': 'Your OTP is {#var#}. Valid for 10 minutes.',
        'template_id': '1234567890123456'
    },
    {
        'sender': 'SMSGAT',
        'message': 'Your order {#var#} is confirmed. Amount: Rs {#var#}',
        'template_id': '9876543210987654'
    }
]

valid_messages = []
invalid_messages = []

for msg in messages_to_validate:
    is_valid = validate_template(
        'YourUsername',
        'YourPassword',
        msg['sender'],
        msg['message'],
        msg['template_id']
    )
    
    if is_valid:
        valid_messages.append(msg)
        print(f"✓ Valid: {msg['message'][:50]}...")
    else:
        invalid_messages.append(msg)
        print(f"✗ Invalid: {msg['message'][:50]}...")

print(f"\n{len(valid_messages)} valid, {len(invalid_messages)} invalid")

Example 3: Validate with Variable Replacement Preview

<?php
function validateAndPreviewMessage($senderId, $template, $dltTemplateId, $variables) {
    // Replace variables in template for preview
    $previewMessage = $template;
    $varIndex = 1;
    
    foreach ($variables as $value) {
        $previewMessage = preg_replace('/{#var#}/', $value, $previewMessage, 1);
    }
    
    // Validate template first
    $url = "https://unify.smsgateway.center/SMSApi/validateTemplate";
    
    $postData = array(
        'userid' => 'YourUsername',
        'password' => 'YourPassword',
        'output' => 'json',
        'senderid' => $senderId,
        'msg' => $template,
        'dltTemplateId' => $dltTemplateId
    );
    
    $ch = curl_init($url);
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($postData));
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/x-www-form-urlencoded'));
    
    $response = curl_exec($ch);
    curl_close($ch);
    
    $result = json_decode($response, true);
    
    if ($result['status'] === 'success') {
        echo "✓ Template is valid!\n";
        echo "Template: " . $result['template'] . "\n";
        echo "Preview: " . $previewMessage . "\n";
        return true;
    } else {
        echo "✗ Validation failed: " . $result['reason'] . "\n";
        return false;
    }
}

// Usage
$template = "Your OTP is {#var#}. Valid for {#var#} minutes. Do not share.";
$variables = ['123456', '10'];
$dltTemplateId = '1234567890123456';

validateAndPreviewMessage('SMSGAT', $template, $dltTemplateId, $variables);
// Output Preview: Your OTP is 123456. Valid for 10 minutes. Do not share.

Error Codes

Status CodeStatusReasonDescription
200successsuccessTemplate validation successful - message matches DLT template
188errormessage template mismatchMessage does not match the registered DLT template

Common Validation Failures

IssueWrongCorrect
Variable Syntax{{var}} or $var${#var#}
Extra Spaces"Hello World" (2 spaces)"Hello World" (1 space)
Case Sensitivity"your otp is""Your OTP is" (match registered template)
Missing Text"Your OTP is {#var#}""Your OTP is {#var#}. Do not share." (complete template)
Extra Text"Your OTP is {#var#}. Please verify soon.""Your OTP is {#var#}. Do not share." (match exactly)
Wrong Sender IDUsing sender "OLDID" with template for "NEWID"Use sender ID registered with the template

Best Practices

Recommendations

  • Validate Before Sending: Always validate templates before calling the send SMS API
  • Use x-www-form-urlencoded: Ensure proper content-type header is set
  • URL Encoding: Use proper URL encoding for special characters in message text
  • Match Exactly: Ensure message text matches registered DLT template character-by-character
  • Variable Syntax: Use correct {#var#} format for dynamic variables
  • Sender ID Match: Verify sender ID is registered with the DLT template
  • Cache Valid Templates: Cache validated templates to reduce API calls
  • Error Handling: Show clear error messages when validation fails
  • Template Library: Maintain a library of validated templates in your app
  • Test Mode: Test validation with sample templates before production use

Why Template Validation Matters

Benefits of Pre-Validation
  • Prevent SMS rejections
  • Save SMS credits from failed sends
  • Ensure DLT compliance
  • Better user experience
  • Avoid operator penalties
Risks Without Validation
  • Messages rejected by operators
  • Wasted SMS credits
  • Non-compliance penalties
  • Poor delivery rates
  • Customer complaints

Common Use Cases

Pre-Send Validation

Validate messages before sending to prevent rejections and ensure DLT compliance.

Template Testing

Test DLT templates during development to ensure correct registration.

Bulk Campaign Validation

Validate templates before launching bulk SMS campaigns to avoid mass rejections.

Compliance Check

Ensure all outgoing messages meet India TRAI DLT regulatory requirements.

Testimonials

Why do Great Businesses Trust SMS Gateway Center?

K

Kurlon IT

2022-08-04

We have tied up with other SMS providers also, but SMS GatewayCenter is quite good. Good Service from the team. We are very happy with the service be it accounts related or technical issue. We always get good response.

I

INOX Air Products

2018-02-09

We have an excellent experience with SMS Gateway Center. The services and support has been of very high standard.

S

Shalabh Arora

2025-04-11

I’ve been using SMSGatewayCenter’s bulk SMS and WhatsApp services since early 2022 for my small business, and the experience has been fantastic. The platform is intuitive, and the message delivery is incredibly reliable, reaching my customers without fail. The 24/7 support team is quick to assist, and the cost-effectiveness is a big plus. It’s transformed how I connect with my audience, and I highly recommend it to other entrepreneurs! (Google Revirews)

R

Reflex

2025-04-11

We’ve been using your bulk SMS services for a few months, and the results have been phenomenal. The open rates and customer engagement have gone through the roof. Highly recommend for any business looking to scale fast! (Google Revirews)

V

Vedanth Gowda

2025-04-18

I’m Vedanth Gowda, leading a finance business, and I’ve been leveraging SMSGatewayCenter’s bulk SMS and WhatsApp tools —absolutely transformative! The platform’s speed and precision in delivering financial alerts to my clients are unmatched, giving me a competitive edge. Samrat’s expertise in tailoring notification workflows for market updates was a standout, and the robust security features instilled trust. The affordable pricing and proactive support team make it a no-brainer. Perfect for finance pros aiming to elevate client trust and efficiency! (Google Revirews)

N

Naval Bhatnagar

2025-04-12

From day one, the team at SMS GATEWAY CENTER guided us through setup, testing, and launching campaigns. Their support is A+. Whether you’re new to SMS marketing or experienced, they make it smooth. Thank you Aakash. (Google Revirews)


CTA for Unlock Real-Time Messaging – Integrate Today!

Unlock Real-Time Messaging – Integrate Today!

Try Our API in a Sandbox Environment Before Going Live!

Join Thousands of Developers – Try Our API Now!

Get in touchSign up