SMS API Documentation
Welcome to the OnlineSMSService API. Our RESTful API allows you to integrate SMS capabilities directly into your applications, websites, or software. Whether you need to send OTPs, transactional alerts, or promotional campaigns, our API delivers with high reliability and speed.
Interactive API Playground
Want to test our API without writing code? Use our interactive playground to send test messages and see real-time responses.
Open API Playground →Authentication
All API requests must be authenticated using your unique API Key. You can pass the API Key either as a query parameter or in the request body.
Base URL
All API requests should be made to:
Send SMS
Send a single text message to one or more recipients.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| apikey | String | Yes | Your unique API Key |
| sender | String | Yes | 6-char Sender ID (e.g., ONLSMS) |
| numbers | String | Yes | Comma-separated mobile numbers (e.g., 919876543210) |
| message | String | Yes | URL-encoded message content |
Success Response
Code Examples
$apiKey = 'YOUR_API_KEY';
$numbers = '919876543210';
$message = urlencode('Your OTP is 1234');
$sender = 'ONLSMS';
$url = "https://api.onlinesmsservice.com/send?apikey={$apiKey}&numbers={$numbers}&sender={$sender}&message={$message}";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
import requests
url = "https://api.onlinesmsservice.com/send"
params = {
"apikey": "YOUR_API_KEY",
"numbers": "919876543210",
"message": "Your OTP is 1234",
"sender": "ONLSMS"
}
response = requests.post(url, data=params)
print(response.json())
const axios = require('axios');
const params = new URLSearchParams();
params.append('apikey', 'YOUR_API_KEY');
params.append('numbers', '919876543210');
params.append('message', 'Your OTP is 1234');
params.append('sender', 'ONLSMS');
axios.post('https://api.onlinesmsservice.com/send', params)
.then(response => {
console.log(response.data);
})
.catch(error => {
console.error(error);
});
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
public class SendSMS {
public static void main(String[] args) {
try {
String apiKey = "YOUR_API_KEY";
String message = "Your OTP is 1234";
String numbers = "919876543210";
String sender = "ONLSMS";
String url = "https://api.onlinesmsservice.com/send?apikey=" + apiKey +
"&message=" + message + "&sender=" + sender + "&numbers=" + numbers;
URL obj = new URL(url);
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
} catch (Exception e) {
e.printStackTrace();
}
}
}
curl -X POST https://api.onlinesmsservice.com/send \
-d "apikey=YOUR_API_KEY" \
-d "numbers=919876543210" \
-d "message=Your OTP is 1234" \
-d "sender=ONLSMS"
Error Codes
| Code | Description |
|---|---|
| 101 | Invalid API Key |
| 102 | Insufficient Balance |
| 103 | Sender ID not approved |
| 104 | Invalid Mobile Number |
Webhooks
Use webhooks to receive real-time updates about message delivery statuses directly to your server URL.
Setting Up
1. Go to Dashboard > Settings > Webhooks
2. Enter your callback URL (e.g., https://yourdomain.com/sms-callback)
3. Select the events you want to subscribe to (e.g., Delivery Reports)
Payload Format
We send a POST request to your URL with a JSON body:
PHP Example Handler
$json = file_get_contents('php://input');
$data = json_decode($json, true);
if ($data['event'] === 'message.delivered') {
$messageId = $data['data']['message_id'];
$status = $data['data']['status'];
// Update your database
}
http_response_code(200); // Always return 200 OK
Developer FAQ
How quickly can we integrate the SMS API?
Most teams complete first integration within a few hours by testing in sandbox-like conditions and then moving to live credentials.
Can we separate OTP and marketing traffic in one account?
Yes. You can configure sender identities, message templates, and route preferences by workflow type.
Is there guidance for delivery debugging?
Yes. Use message IDs, delivery reports, and webhook logs to isolate template issues, operator filtering, and API payload errors quickly.