Quick Start
Send your first message with Lineserve in minutes.
Step 1: Get Your API Key
If you haven't already, get your API key from your Lineserve Dashboard.
Step 2: Send a Test SMS
Using cURL
curl -X POST https://api.lineserve.com/v1/sms/send \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"to": "+254712345678",
"message": "Hello from Lineserve!",
"sender_id": "LINESERVE"
}'
Using JavaScript (Node.js)
const axios = require('axios');
async function sendSMS() {
try {
const response = await axios.post('https://api.lineserve.com/v1/sms/send', {
to: '+254712345678',
message: 'Hello from Lineserve!',
sender_id: 'LINESERVE'
}, {
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
}
});
console.log('Message sent successfully:', response.data);
} catch (error) {
console.error('Error sending message:', error.response.data);
}
}
sendSMS();
Using Python
import requests
url = "https://api.lineserve.com/v1/sms/send"
headers = {
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json"
}
payload = {
"to": "+254712345678",
"message": "Hello from Lineserve!",
"sender_id": "LINESERVE"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
tip
Remember to replace YOUR_API_KEY
with your actual API key and use a valid phone number in the to
field.
Step 3: Check Delivery Status
You can check the delivery status of your message using the message ID returned in the response:
curl -X GET https://api.lineserve.com/v1/sms/status/MESSAGE_ID \
-H "Authorization: Bearer YOUR_API_KEY"
Next Steps
Now that you've sent your first message, explore the full capabilities of our SMS API in the Bulk SMS API documentation.