Building your own app? Use the SMS Localhost REST API to send messages programmatically. Perfect for transactional SMS, OTP verification, or custom workflows.
Getting Your API Key
- Go to API Keys in your dashboard sidebar
- Enter a name for the key (e.g. "My App")
- Click Create
- Copy the key immediately — it's shown only once!
Security: Never share your API key or commit it to version control. Use environment variables in your application.
Send an SMS — Code Examples
cURL
curl -X POST https://sms.localhost.co.zw/api/sms/send/ \
-H "X-API-Key: your-api-key-here" \
-H "Content-Type: application/json" \
-d '{
"to": "263771234567",
"sender": "ACME",
"message": "Hello from the API!"
}'
-H "X-API-Key: your-api-key-here" \
-H "Content-Type: application/json" \
-d '{
"to": "263771234567",
"sender": "ACME",
"message": "Hello from the API!"
}'
Python
import requests
response = requests.post(
"https://sms.localhost.co.zw/api/sms/send/",
headers={"X-API-Key": "your-api-key-here"},
json={
"to": "263771234567",
"sender": "ACME",
"message": "Hello from the API!",
}
)
print(response.json())
response = requests.post(
"https://sms.localhost.co.zw/api/sms/send/",
headers={"X-API-Key": "your-api-key-here"},
json={
"to": "263771234567",
"sender": "ACME",
"message": "Hello from the API!",
}
)
print(response.json())
JavaScript (Node.js)
const response = await fetch(
"https://sms.localhost.co.zw/api/sms/send/",
{
method: "POST",
headers: {
"X-API-Key": "your-api-key-here",
"Content-Type": "application/json",
},
body: JSON.stringify({
to: "263771234567",
sender: "ACME",
message: "Hello from the API!",
}),
}
);
const data = await response.json();
console.log(data);
"https://sms.localhost.co.zw/api/sms/send/",
{
method: "POST",
headers: {
"X-API-Key": "your-api-key-here",
"Content-Type": "application/json",
},
body: JSON.stringify({
to: "263771234567",
sender: "ACME",
message: "Hello from the API!",
}),
}
);
const data = await response.json();
console.log(data);
For full API documentation including webhooks, delivery status callbacks, and bulk sending, visit the API Docs page.