Contact admin to create a client account and receive your API keys.
https://your-nexsms-domain.com/apiInclude your API keys in the headers for all requests:
Use the /api/messages/send endpoint to send SMS messages:
{
"to": "+1234567890",
"body": "Hello from NEXSMS!",
"deviceId": "optional-device-id"
}Note: Phone numbers are not stored or managed server-side. Always provide the destination number in the to field for each request.
{
"success": true,
"messageId": "msg_123456789",
"message": "Message queued for sending"
}curl -X POST https://your-domain.com/api/messages/send -H "Content-Type: application/json" -H "x-public-key: YOUR_PUBLIC_KEY" -H "x-secret-key: YOUR_SECRET_KEY" -d '{
"to": "+1234567890",
"body": "Hello from NEXSMS!"
}'The device processes queued messages and sends SMS using the providedto number; no phone number registry exists on the server.
Devices fetch queued messages via /api/device/messages/pending and report status (sent or failed) via /api/device/messages/[messageId]/status. A device is considered online if it has attempted a poll in the last 4 minutes. When no device is specified, the server selects an active device and prioritizes devices that are online.
limit: Number of logs to retrieve (1-100, default: 20){
"success": true,
"logs": [
{
"id": "msg_123456789",
"to": "+1234567890",
"body": "Hello from NEXSMS!",
"status": true,
"sentAt": "2024-01-15T10:30:00Z",
"deviceId": "device_abc123",
"createdAt": "2024-01-15T10:29:45Z"
}
],
"count": 1
}200 - OK201 - Created400 - Bad Request401 - Unauthorized403 - Forbidden404 - Not Found429 - Rate Limited500 - Internal Server Error// Send SMS using fetch API
const sendSMS = async (to, message) => {
const response = await fetch('https://your-domain.com/api/messages/send', {
method: 'POST',
headers: {
'X-Public-Key': 'YOUR_PUBLIC_KEY',
'X-Secret-Key': 'YOUR_SECRET_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({ to, message })
});
return await response.json();
};
// Usage
sendSMS('+1234567890', 'Hello from NEXSMS!')
.then(result => console.log('Message sent:', result))
.catch(error => console.error('Error:', error));