API

SMS API

Send SMS messages through the Trunx API.

All phone numbers must be in E.164 format (e.g. +14155551234). Requests with non-E.164 numbers will return a 400 error.

SMS content is automatically scanned for compliance before sending. Messages that violate carrier or regulatory policies will be rejected.

Send SMS

POST /api/sms

Send an outbound SMS message.

Request body

FieldTypeRequiredDescription
fromstringYesSender phone number in E.164 format
tostringYesDestination phone number in E.164 format
messagestringYesMessage body (1-1600 characters)
curl -X POST https://api.trunx.io/api/sms \
  -H "Authorization: Bearer tk_live_..." \
  -H "Content-Type: application/json" \
  -d '{
    "from": "+14155559876",
    "to": "+14155551234",
    "message": "Your appointment is confirmed for tomorrow at 2pm."
  }'
const res = await fetch("https://api.trunx.io/api/sms", {
  method: "POST",
  headers: {
    "Authorization": "Bearer tk_live_...",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    from: "+14155559876",
    to: "+14155551234",
    message: "Your appointment is confirmed for tomorrow at 2pm.",
  }),
});
const data = await res.json();
import requests

res = requests.post(
    "https://api.trunx.io/api/sms",
    headers={"Authorization": "Bearer tk_live_..."},
    json={
        "from": "+14155559876",
        "to": "+14155551234",
        "message": "Your appointment is confirmed for tomorrow at 2pm.",
    },
)
data = res.json()

Response

{
  "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "status": "queued"
}

Inbound SMS

Inbound messages are delivered via webhooks. Configure a webhook with the sms.received event to receive incoming messages in real time.

The webhook payload includes the sender, recipient, message body, and timestamp. See the Webhooks page for setup instructions.

{
  "event": "sms.received",
  "data": {
    "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "from": "+14155551234",
    "to": "+14155559876",
    "message": "Yes, I'll be there.",
    "direction": "inbound",
    "created_at": "2026-03-09T16:05:00.000Z"
  }
}

On this page