Sending SMS Messages
Send SMS messages to one or multiple recipients using the LightSMS API.
Quick Startβ
Endpoint:
GET https://www.lightsms.com/external/get/send.php
Required Parameters:
| Parameter | Type | Description |
|---|---|---|
login | string | Your LightSMS login |
signature | string | MD5 hash signature |
phone | string | Recipient phone number(s) |
text | string | SMS message text |
sender | string | Approved sender name |
timestamp | integer | UTC timestamp |
Optional Parameters:
| Parameter | Type | Description |
|---|---|---|
sendingTime | string | Schedule delivery (format: YYYY-MM-DD HH:MM) |
return | string | Response format: json or xml |
Single SMS Exampleβ
Send an SMS to one recipient:
Requestβ
curl "https://www.lightsms.com/external/get/send.php?login=YourLogin&signature=generated_signature&phone=37061234567&text=Hello!&sender=YourSender×tamp=1732809600&return=json"
Response (JSON)β
{
"37061234567": {
"error": "0",
"id_sms": "4092112510348380960001",
"cost": "0.0144",
"count_sms": "1"
}
}
Response (XML)β
<?xml version="1.0" encoding="utf-8"?>
<response>
<phones>
<phone phone="37061234567" error="0" id_sms="4092112510348380960001" cost="0.0144" count_sms="1" />
</phones>
</response>
Multiple Recipientsβ
Send SMS to multiple recipients by separating phone numbers with commas.
Maximum 100 phone numbers per request.
Exampleβ
curl "https://www.lightsms.com/external/get/send.php?login=YourLogin&signature=generated_signature&phone=37061234567,37062345678,37063456789&text=Hello%20everyone!&sender=YourSender×tamp=1732809600&return=json"
Responseβ
{
"37061234567": {
"error": "0",
"id_sms": "4092112510348380960001",
"cost": "0.0144",
"count_sms": "1"
},
"37062345678": {
"error": "0",
"id_sms": "4092112510348380960002",
"cost": "0.0144",
"count_sms": "1"
},
"37063456789": {
"error": "0",
"id_sms": "4092112510348380960003",
"cost": "0.0144",
"count_sms": "1"
}
}
Scheduled SMSβ
Schedule SMS delivery for a future date and time.
Exampleβ
curl "https://www.lightsms.com/external/get/send.php?login=YourLogin&signature=generated_signature&phone=37061234567&text=Reminder&sender=YourSender×tamp=1732809600&sendingTime=2024-05-30%2014:06&return=json"
Format: YYYY-MM-DD HH:MM
Example: 2024-05-30 14:06
The time is in your account's configured timezone (usually local time).
Character Limitsβ
Standard SMS (GSM-7 encoding)β
- Single SMS: 160 characters
- Multi-part SMS: 153 characters per part
Supported characters:
A-Z a-z 0-9 @ Β£ $ Β₯ Γ¨ Γ© ΓΉ Γ¬ Γ² Γ Γ ΓΈ Γ
Γ₯ Ξ _ Ξ¦ Ξ Ξ Ξ© Ξ Ξ¨ Ξ£ Ξ Ξ
Γ Γ¦ Γ Γ ! " # Β€ % & ' ( ) * + , - . / : ; < = > ? Β‘ Γ Γ Γ Γ Β§ ΒΏ Γ€ ΓΆ Γ± ΓΌ Γ
Unicode SMS (Special characters/emojis)β
- Single SMS: 70 characters
- Multi-part SMS: 67 characters per part
Examples: Cyrillic, Arabic, Chinese, emojis (π π β€οΈ)
The system automatically detects if your message requires Unicode encoding based on the characters used.
PHP Exampleβ
<?php
function sendSMS($login, $apiKey, $phone, $text, $sender) {
// Get timestamp
$timestamp = file_get_contents('https://www.lightsms.com/external/get/timestamp.php');
$timestamp = trim($timestamp);
// Prepare parameters
$params = [
'login' => $login,
'phone' => $phone,
'text' => $text,
'sender' => $sender,
'timestamp' => $timestamp,
'return' => 'json'
];
// Create signature
ksort($params);
$signature = md5(implode($params) . $apiKey);
$params['signature'] = $signature;
// Make request
$url = 'https://www.lightsms.com/external/get/send.php?' . http_build_query($params);
$response = file_get_contents($url);
return json_decode($response, true);
}
// Usage
$result = sendSMS(
'YourLogin',
'your_api_key',
'37061234567',
'Hello from LightSMS!',
'YourSender'
);
print_r($result);
?>
Python Exampleβ
import requests
import hashlib
from urllib.parse import urlencode
def send_sms(login, api_key, phone, text, sender):
# Get timestamp
timestamp_response = requests.get('https://www.lightsms.com/external/get/timestamp.php')
timestamp = timestamp_response.text.strip()
# Prepare parameters
params = {
'login': login,
'phone': phone,
'text': text,
'sender': sender,
'timestamp': timestamp,
'return': 'json'
}
# Create signature
sorted_params = sorted(params.items())
param_string = ''.join([str(value) for key, value in sorted_params])
signature = hashlib.md5((param_string + api_key).encode()).hexdigest()
params['signature'] = signature
# Make request
url = f'https://www.lightsms.com/external/get/send.php?{urlencode(params)}'
response = requests.get(url)
return response.json()
# Usage
result = send_sms(
'YourLogin',
'your_api_key',
'37061234567',
'Hello from LightSMS!',
'YourSender'
)
print(result)
JavaScript Exampleβ
const crypto = require('crypto');
const axios = require('axios');
async function sendSMS(login, apiKey, phone, text, sender) {
// Get timestamp
const timestampResponse = await axios.get('https://www.lightsms.com/external/get/timestamp.php');
const timestamp = timestampResponse.data.trim();
// Prepare parameters
const params = {
login,
phone,
text,
sender,
timestamp,
return: 'json'
};
// Create signature
const sortedKeys = Object.keys(params).sort();
const paramString = sortedKeys.map(key => params[key]).join('');
const signature = crypto.createHash('md5').update(paramString + apiKey).digest('hex');
params.signature = signature;
// Make request
const queryString = new URLSearchParams(params).toString();
const url = `https://www.lightsms.com/external/get/send.php?${queryString}`;
const response = await axios.get(url);
return response.data;
}
// Usage
sendSMS(
'YourLogin',
'your_api_key',
'37061234567',
'Hello from LightSMS!',
'YourSender'
).then(result => {
console.log(result);
});
Response Fieldsβ
| Field | Type | Description |
|---|---|---|
error | string | Error code (0 = success) |
id_sms | string | Unique SMS identifier for tracking |
cost | string | Cost in your account currency |
count_sms | string | Number of SMS parts sent |
Common Errorsβ
Error Code 8: Invalid sender nameβ
Problem: The sender name is not valid
Solutions:
- Use only approved sender names
- Register sender names through Lists > Senders in LightSMS platform
- Wait for administration approval
Error Code 9: Sender name not registeredβ
Problem: The sender name hasn't been registered
Solutions:
- Register the sender name first
- Use an already approved sender
Error Code 11: Forbidden words in textβ
Problem: Message contains prohibited content
Solutions:
- Remove inappropriate words or abbreviations
- Contact support if you believe this is an error
Error Code 13: Phone in blacklistβ
Problem: Recipient's number is blacklisted
Solutions:
- Check if recipient opted out
- Remove from blacklist if added by mistake
- Use blacklist search endpoint
Error Code 32: Not enough moneyβ
Problem: Insufficient account balance
Solutions:
- Add funds to your Paysera account
- Check balance using the balance endpoint