Sending
Send SMS and MMS, handle opt-outs, and look up numbers
Sending
Send a message from an SMS-enabled number with sendSms (POST /v1/sms/messages). Include text, mediaUrls (which makes it an MMS), or both; at least one is required. Both numbers are normalized to E.164, so from matches regardless of formatting and replies thread into the same inbox conversation. Read replies via the inbox endpoints, or get them pushed with the message.received webhook.
Send an SMS
const { data } = await zernio.sms.sendSms({
body: {
from: '+14155551234',
to: '+13105559999',
text: 'Your order has shipped!',
}
});
console.log(data.id, data.status);response = client.sms.send_sms(
from_='+14155551234',
to='+13105559999',
text='Your order has shipped!',
)
print(response['id'], response['status'])curl -X POST "https://zernio.com/api/v1/sms/messages" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"from": "+14155551234", "to": "+13105559999", "text": "Your order has shipped!"}'US numbers must have an approved carrier registration before you can send. Sending from an unregistered (or still-pending) US number returns a 403 at send time, the message is blocked before it reaches the carrier.
Send an MMS
Add mediaUrls to attach images. Pass text too for a caption, or omit it to send media only.
curl -X POST "https://zernio.com/api/v1/sms/messages" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"from": "+14155551234",
"to": "+13105559999",
"text": "Here is your receipt",
"mediaUrls": ["https://example.com/receipt.png"]
}'Idempotency. Send an Idempotency-Key header to make retries safe: the same key and body replays the original response instead of sending a second message; the same key with a different body returns 422; a key still in flight returns 409.
Opt-outs
Recipients who reply STOP are opted out by the carrier, and further sends to them are blocked. Read the list with listSmsOptOuts (GET /v1/sms/opt-outs) so your own suppression list stays in sync.
Look up a number
lookupSmsNumber (GET /v1/sms/lookup) returns a number's carrier and line type (mobile, landline, VoIP). Use it to skip landlines before sending, or to validate input.
curl "https://zernio.com/api/v1/sms/lookup?number=%2B13105559999" \
-H "Authorization: Bearer YOUR_API_KEY"