← Back to Home

NEXSMS Messaging API

Developer guide for sending SMS messages through NEXSMS

🚀 Quick Start
Start sending SMS messages with NEXSMS in minutes

1. Get Your API Keys

Contact admin to create a client account and receive your API keys.

Base URL: https://your-nexsms-domain.com/api

2. Authentication

Include your API keys in the headers for all requests:

x-public-key: YOUR_PUBLIC_KEY
x-secret-key: YOUR_SECRET_KEY

3. Send Your First Message

Use the /api/messages/send endpoint to send SMS messages:

POST /api/messages/send
Content-Type: application/json
POSTSend SMS Message
/api/messages/send

Request Body:

{
  "to": "+1234567890",
  "body": "Hello from NEXSMS!",
  "scheduledAt": "2026-03-16T10:30:00.000Z"
}

Note: Phone numbers are not stored or managed server-side. Always provide the destination number in the to field for each request.

Response:

{
  "success": true,
  "data": {
    "messageId": 10234,
    "status": "queued",
    "remainingQuota": 9
  }
}

Request constraints: body must be 800 characters or fewer. Rate limit is 10 requests per minute per client.

cURL Example:

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, failed, or expired) 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.

HTTP Status Codes

Success Codes

  • 200 - OK
  • 201 - Created

Error Codes

  • 400 - Bad Request
  • 401 - Unauthorized
  • 403 - Forbidden
  • 404 - Not Found
  • 429 - Rate Limited
  • 500 - Internal Server Error
Code Examples
Implementation examples in popular programming languages
// Send SMS using fetch API
const sendSMS = async (to, body, scheduledAt) => {
  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, body, scheduledAt })
  });
  
  return await response.json();
};

// Usage
sendSMS('+1234567890', 'Hello from NEXSMS!')
  .then(result => console.log('Message sent:', result))
  .catch(error => console.error('Error:', error));