PlatformXeDocs
Get API Key

Send SMS

API reference for sending transactional SMS messages.

Send a transactional SMS through the PlatformXe multi-provider fallback chain.

Endpoint

POST /api/v1/messaging/sms

Scope: messaging:send

Request body

FieldTypeRequiredDescription
tostringYesRecipient phone number in E.164 format (e.g. +2348012345678)
messagestringYesSMS body text (max 1600 characters)
regionCodestringNoISO 3166-1 alpha-2 country code for routing optimization (e.g. NG). Default: auto-detected from phone number

Messages longer than 160 characters are automatically split into multipart SMS. Each segment counts toward your usage quota.

Response

{
  "success": true,
  "data": {
    "success": true,
    "messageId": "sms_abc123def456",
    "provider": "primary"
  }
}
FieldTypeDescription
successbooleantrue when a provider in the fallback chain accepted the message
messageIdstringUnique message identifier for tracking (present on success)
providerstringThe position in the fallback chain that handled delivery: primary, fallback_1, fallback_2, ...; none when every provider failed. It never names a provider.
errorstringPresent when success is false. One line covering every provider tried, in order: provider 1: <reason>; provider 2: <reason>. Each reason is the first line of that provider's error with phone numbers, email addresses, URLs, keys and credentials redacted. Provider names are never included.

Examples

curl

curl -X POST https://api.platformxe.com/api/v1/messaging/sms \
  -H "Content-Type: application/json" \
  -H "x-api-key: pxk_live_your_api_key_here" \
  -H "x-idempotency-key: otp-login-12345" \
  -d '{
    "to": "+2348012345678",
    "message": "Your verification code is 482910. It expires in 10 minutes.",
    "regionCode": "NG"
  }'

SDK

import { PlatformXeClient } from '@caldera/platformxe-sdk';

const px = new PlatformXeClient({ apiKey: 'pxk_live_your_api_key_here' });

const result = await px.sms.send({
  to: '+2348012345678',
  message: 'Your verification code is 482910. It expires in 10 minutes.',
  regionCode: 'NG',
});

console.log(result.data.messageId);
// "sms_abc123def456"

if (!result.data.success) console.warn(result.data.error);
// e.g. "provider 1: rejected the number; provider 2: circuit open"

Error responses

CodeDescription
BAD_REQUESTMissing or invalid fields (e.g. invalid phone number format)
FORBIDDENAPI key does not have the messaging:send scope
RATE_LIMITEDRate limit exceeded for this API key
PROVIDER_ERRORAll providers in the fallback chain failed