cURL SMS API Integration
Complete cURL code examples for integrating with the SecureSMSC SMS API using cURL.
Fast Integration
Get started in minutes with simple REST API calls
Global Reach
Send SMS to 200+ countries worldwide
Secure
Enterprise-grade SSL/TLS encryption
Reliable
99.9% uptime with delivery tracking
Quick Start: Get your API key from the dashboard to begin integration.
Installation
Install the required dependencies:
Terminal
# cURL comes pre-installed on most systems
Send Single SMS
cURL
curl -X POST "https://whitelabled.securesmsc.com/api/v2/sms/send" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"sender_id": "SENDER",
"recipient": "1234567890",
"message": "Hello from cURL!",
"route": "transactional"
}'
Send Bulk SMS
cURL
curl -X POST "https://whitelabled.securesmsc.com/api/v2/sms/send-bulk" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"sender_id": "SENDER",
"recipients": ["1234567890", "0987654321"],
"message": "Bulk message!",
"route": "promotional"
}'
Check SMS Status
cURL
curl -X GET "https://whitelabled.securesmsc.com/api/v2/sms/status/MESSAGE_ID" \
-H "Authorization: Bearer YOUR_API_KEY"
Check Balance
cURL
curl -X GET "https://whitelabled.securesmsc.com/api/v2/balance" \
-H "Authorization: Bearer YOUR_API_KEY"
Shell Script with Error Handling
Bash Script
#!/bin/bash
API_KEY="YOUR_API_KEY"
API_URL="https://whitelabled.securesmsc.com/api/v2"
send_sms() {
local recipient=$1
local message=$2
response=$(curl -s -w "\n%{http_code}" -X POST "$API_URL/sms/send" \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d "{
\"sender_id\": \"SENDER\",
\"recipient\": \"$recipient\",
\"message\": \"$message\",
\"route\": \"transactional\"
}")
http_code=$(echo "$response" | tail -n1)
body=$(echo "$response" | head -n-1)
if [ "$http_code" -eq 200 ]; then
echo "Success: $body"
return 0
else
echo "Error ($http_code): $body"
return 1
fi
}
# Usage
send_sms "1234567890" "Hello from Bash!"