smslenz

Integrate SMS functionality directly into your applications with our powerful and easy-to-use REST API.

WooCommerce & WordPress Integration

smslenz.lk offers a dedicated WooCommerce add-on plugin, allowing you to integrate SMS notifications seamlessly into your WordPress store. With this plugin, you can send automated SMS updates to customers for various purchase events, enhancing engagement and communication.

Download the plugin SMSlenz for WooCommerce and start sending SMS notifications from your WordPress-powered store today!.

smslenz for wordpress

REST API Endpoint Guide

Need to integrate SMSlenz.lk with your custom development? No worries! We provide a complete guide for our direct API endpoints — you can call them directly from your application and start using our SMS services instantly.

Our API supports all major programming languages, including PHP, JavaScript, Python, Java, C#, Ruby, Go, and Node.js.
It works seamlessly with any type of application, whether it’s a web platform, desktop software, or mobile app (Android or iOS).

Direct Endpoints for smslenz.lk SMS Actions

  1. Send SMS
  2. Send Bulk SMS
  3. Account Status

Send SMS

POSTGET

Use this endpoint directly to send SMS to a contact number.

Request

URL: https://mail.smslenz.lk/api/send-sms

Parameters
Key Required Value
user_id Required User ID from your settings page.
api_key Required API key from your settings page.
sender_id Required Your approved Sender ID. Use SMSlenzDEMO for testing. This one is case sensitive.
contact Required The recipient, Should be in the format of +9476XXXXXXX.
message Required The message. Max: 1500 chars.
Sample Request Body (POST · JSON)
JSON
{
    "user_id": "12",
    "api_key": "YOUR_API_KEY",
    "sender_id": "SMSlenzDEMO",
    "contact": "+9476XXXXXXX",
    "message": "Welcome to SMSlenz!"
}
Sample GET Request URL
URL
https://mail.smslenz.lk/api/send-sms?user_id=12&api_key=YOUR_API_KEY&sender_id=SMSlenzDEMO&contact=%2B9476XXXXXXX&message=Welcome%20to%20SMSlenz%21

Query values must be URL-encoded — note the + in the contact number is sent as %2B.

Code Examples
cURL
curl -X POST "https://mail.smslenz.lk/api/send-sms" \
  -d "user_id=12" \
  -d "api_key=YOUR_API_KEY" \
  -d "sender_id=SMSlenzDEMO" \
  -d "contact=+9476XXXXXXX" \
  -d "message=Welcome to SMSlenz!"
PHP
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://mail.smslenz.lk/api/send-sms");
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query([
    'user_id'   => '12',
    'api_key'   => 'YOUR_API_KEY',
    'sender_id' => 'SMSlenzDEMO',
    'contact'   => '+9476XXXXXXX',
    'message'   => 'Welcome to SMSlenz!',
]));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);
curl_close($ch);

echo $response;
JavaScript
fetch("https://mail.smslenz.lk/api/send-sms", {
    method: "POST",
    headers: { "Content-Type": "application/json" },
    body: JSON.stringify({
        user_id: "12",
        api_key: "YOUR_API_KEY",
        sender_id: "SMSlenzDEMO",
        contact: "+9476XXXXXXX",
        message: "Welcome to SMSlenz!"
    })
})
    .then(res => res.json())
    .then(data => console.log(data))
    .catch(err => console.error(err));
Python
import requests

url = "https://mail.smslenz.lk/api/send-sms"
payload = {
    "user_id": "12",
    "api_key": "YOUR_API_KEY",
    "sender_id": "SMSlenzDEMO",
    "contact": "+9476XXXXXXX",
    "message": "Welcome to SMSlenz!"
}

response = requests.post(url, data=payload)
print(response.json())
Response

You will get a JSON response in a success attempt.

Content-Type: application/json

Body:

JSON
{
    "success": true,
    "message": "SMS sent successfully",
    "data": {
        "status": "success",
        "campaign_id": 42,
        "message": "Welcome to SMSlenz!",
        "sender_id": "SMSlenzDEMO",
        "pages": 1,
        "recipient_number": "9475XXXXXXX",
        "sms_credit_balance": "2,513.95",
        "charged_from": "main"
    }
}

sms_credit_balance is the remaining balance of the pool the sender ID draws from: its allocated credit when the sender has an active credit allocation, otherwise your main balance. charged_from tells you which (allocation or main).

Send Bulk SMS

POST

Use this endpoint directly to send SMS to multiple contact numbers.

Request

URL: https://mail.smslenz.lk/api/send-bulk-sms

Parameters
Key Required Value
user_id Required User ID from your settings page.
api_key Required API key from your settings page.
sender_id Required Your approved Sender ID. Use SMSlenzDEMO for testing. This one is case sensitive.
contacts Required The number of the recipients, Should be in the format of array
["+9476XXXXXXX","+9475XXXXXXX"].
message Required The message. Max: 1500 chars.
Sample Request Body (POST · JSON)
JSON
{
    "user_id": "12",
    "api_key": "YOUR_API_KEY",
    "sender_id": "SMSlenzDEMO",
    "contacts": ["+9476XXXXXXX", "+9475XXXXXXX"],
    "message": "Welcome to bulk sms API!"
}

This endpoint accepts POST only — send the body as JSON (Content-Type: application/json) or as regular form fields.

Code Examples
cURL
curl -X POST "https://mail.smslenz.lk/api/send-bulk-sms" \
  -H "Content-Type: application/json" \
  -d '{
    "user_id": "12",
    "api_key": "YOUR_API_KEY",
    "sender_id": "SMSlenzDEMO",
    "contacts": ["+9476XXXXXXX", "+9475XXXXXXX"],
    "message": "Welcome to bulk sms API!"
  }'
PHP
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://mail.smslenz.lk/api/send-bulk-sms");
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
    'user_id'   => '12',
    'api_key'   => 'YOUR_API_KEY',
    'sender_id' => 'SMSlenzDEMO',
    'contacts'  => ['+9476XXXXXXX', '+9475XXXXXXX'],
    'message'   => 'Welcome to bulk sms API!',
]));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);
curl_close($ch);

echo $response;
JavaScript
fetch("https://mail.smslenz.lk/api/send-bulk-sms", {
    method: "POST",
    headers: { "Content-Type": "application/json" },
    body: JSON.stringify({
        user_id: "12",
        api_key: "YOUR_API_KEY",
        sender_id: "SMSlenzDEMO",
        contacts: ["+9476XXXXXXX", "+9475XXXXXXX"],
        message: "Welcome to bulk sms API!"
    })
})
    .then(res => res.json())
    .then(data => console.log(data))
    .catch(err => console.error(err));
Python
import requests

url = "https://mail.smslenz.lk/api/send-bulk-sms"
payload = {
    "user_id": "12",
    "api_key": "YOUR_API_KEY",
    "sender_id": "SMSlenzDEMO",
    "contacts": ["+9476XXXXXXX", "+9475XXXXXXX"],
    "message": "Welcome to bulk sms API!"
}

response = requests.post(url, json=payload)
print(response.json())
Response

You will get a JSON response in a success attempt.

Content-Type: application/json

Body:

JSON
{
    "success": true,
    "message": "SMS sent successfully",
    "data": {
        "status": "success",
        "campaign_id": 43,
        "message": "Welcome to bulk sms API!",
        "sender_id": "SMSlenzDEMO",
        "pages": 1,
        "no_of_recipients": 2,
        "sms_credit_balance": "2,512.77",
        "charged_from": "main"
    }
}

sms_credit_balance is the remaining balance of the pool the sender ID draws from: its allocated credit when the sender has an active credit allocation, otherwise your main balance. charged_from tells you which (allocation or main).

Account Status

POSTGET

Use this endpoint to check the status of your account.

Request

URL: https://mail.smslenz.lk/api/account-status

Parameters
Key Required Value
user_id Required User ID from your settings page.
api_key Required API key from your settings page.
Sample Request Body (POST · JSON)
JSON
{
    "user_id": "12",
    "api_key": "YOUR_API_KEY"
}
Sample GET Request URL
URL
https://mail.smslenz.lk/api/account-status?user_id=12&api_key=YOUR_API_KEY
Code Examples
cURL
curl -X POST "https://mail.smslenz.lk/api/account-status" \
  -d "user_id=12" \
  -d "api_key=YOUR_API_KEY"
PHP
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://mail.smslenz.lk/api/account-status");
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query([
    'user_id' => '12',
    'api_key' => 'YOUR_API_KEY',
]));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);
curl_close($ch);

echo $response;
JavaScript
fetch("https://mail.smslenz.lk/api/account-status", {
    method: "POST",
    headers: { "Content-Type": "application/json" },
    body: JSON.stringify({
        user_id: "12",
        api_key: "YOUR_API_KEY"
    })
})
    .then(res => res.json())
    .then(data => console.log(data))
    .catch(err => console.error(err));
Python
import requests

url = "https://mail.smslenz.lk/api/account-status"
payload = {
    "user_id": "12",
    "api_key": "YOUR_API_KEY"
}

response = requests.post(url, data=payload)
print(response.json())
Response

You will get a JSON response in a success attempt.

Content-Type: application/json

Body:

JSON
{
    "success": true,
    "message": "Account status retrieved successfully",
    "data": {
        "status": "active",
        "sms_credit_balance": "2,515.72",
        "allocated_credit_total": "1,500.00",
        "sender_id_balances": [
            {
                "sender_id": "YOURBRAND",
                "allocated_balance": "1,500.00",
                "active": true
            }
        ],
        "active_plan": "Pay As You Go",
        "total_contacts": 3,115,
        "total_sender_ids": 6
    }
}

sms_credit_balance is your main balance. sender_id_balances lists sender IDs holding a credit allocation; a sender with an active allocation is charged only from its allocated balance.

Go to API Settings Page.

See something missing? Please contact us and let us know your concern.

We are always happy to help with integrations.

Go back to smslenz.lk Home Page