All docs

Send a Message

POST /v1/messages — send iMessage or SMS to any phone number.

Full endpoint reference for sending messages.

POST /v1/messages

Send an iMessage or SMS to any phone number.

Request Headers

| Header | Required | Value | |--------|----------|-------| | Authorization | Yes | Bearer tf_live_YOUR_KEY | | Content-Type | Yes | application/json |

Request Body

Send with raw body:

{
  "to": "+15551234567",
  "channel": "auto",
  "body": "Your order has shipped!"
}

Send with template:

{
  "to": "+15551234567",
  "channel": "auto",
  "template": "otp_verify",
  "data": {
    "code": "4821",
    "minutes": "10"
  }
}

Parameters

to string Required

Recipient phone number in E.164 format (e.g. +15551234567)

channel string

auto (default), imessage, or sms

body string Required

Message text. Required if template is not provided.

template string

Template name. Required if body is not provided.

data object

Template variables. Required if template has variables.

Response

202 Accepted
{
  "message_id": "01ABCDEF...",
  "status": "queued",
  "from": "+12025551234",
  "channel": "imessage",
  "estimated_delivery_ms": 2000
}

Channel Behavior

  • imessage — Forces iMessage. Fails if recipient doesn't have iMessage.
  • sms — Forces SMS delivery.

Error Responses

| Status | Code | Description | |--------|------|-------------| | 400 | VALIDATION_ERROR | Invalid request body | | 400 | INVALID_TEMPLATE | Template not found | | 400 | MISSING_TEMPLATE_VAR | Required template variable missing | | 401 | INVALID_API_KEY | Bad or missing API key | | 429 | RATE_LIMIT_EXCEEDED | Rate limit hit | | 503 | NO_PHONE_AVAILABLE | No phone available to send |

Examples

curl -X POST https://api.senderz.com/v1/messages \
  -H "Authorization: Bearer tf_live_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"to": "+15551234567", "channel": "auto", "body": "Hello!"}'
const res = await fetch('https://api.senderz.com/v1/messages', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer tf_live_YOUR_KEY',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    to: '+15551234567',
    channel: 'auto',
    body: 'Hello!',
  }),
})
const data = await res.json()