Quickstart
5 Min Read
Sending Your First Bulk SMS with BlackSMS API
Learn how to format a JSON request to hit the BlackSMS endpoint `/v1/bulk-sms` and check delivery responses. Ensure your auth token is passed in header headers.
Code Example: PHP cURL
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://blacksms.in/api/v1/bulk-sms",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
"mobile" => "919876543210",
"message" => "Your message goes here",
"dlt_template_id" => "120716189578240"
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer YOUR_API_KEY",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
curl_close($curl);
echo $response;
Security
8 Min Read
Configuring Safe OTP SMS Flow & Retries
Verify login requests cleanly. This tutorial showcases how to implement rate limits (max 3 OTP requests per IP per hour) and verify codes securely on your server node.
Code Example: Node.js Express
const express = require('express');
const axios = require('axios');
const app = express();
app.post('/send-otp', async (req, res) => {
const { phone } = req.body;
const otpCode = Math.floor(100000 + Math.random() * 900000);
try {
const response = await axios.post('https://blacksms.in/api/v1/bulk-sms', {
mobile: phone,
message: `Your authentication OTP code is ${otpCode}. Valid for 5 minutes.`,
dlt_template_id: '120716189578240'
}, {
headers: { 'Authorization': 'Bearer YOUR_API_KEY' }
});
// Store otpCode securely in session or Redis cache
res.json({ success: true, message: 'OTP Sent successfully' });
} catch (error) {
res.status(500).json({ error: error.message });
}
});
SDK Libraries
Download official SDK wrappers to integrate BlackSMS API directly in your projects.
Need Live Help?
Our developer support engineers are available 24/7/365 to debug code integrations or setup routing parameters.