Skip to content
Panel

API Reference Endpoints

SMS

Send an SMS from a tunnel through your own Telnyx or Twilio account, billed per message.

A tunnel can send SMS through a Telnyx or Twilio account that you connect in the panel at mot3r.com/panel (Phone & SMS). The message goes out from your provider account with your provider credential; the API adds a per-message fee from the prepaid balance, shown in Balance and usage under the meter sms_byoc.message. Sending needs a tunnel key and an account at trust level Z1 or higher. Error responses use the envelope described in Errors.

#Send an SMS

POST /v1/byoc/sms

Sends one SMS to a phone number in E.164 format. The fee is reserved before the provider is called and charged only when the provider accepts the message; a provider failure releases the reservation.

Authentication: tunnel key only. The account must be at trust level Z1 (destinations in the USA and Canada) or Z2 (international destinations). A test key gets 403 byoc_line_key_required; a root key is refused with 401 invalid_credential. Premium-rate numbers (+1900, +1976, +979) are refused at every trust level.

Parameters

NameInTypeRequiredDescription
Idempotency-KeyheaderstringnoRequest id, 1 to 128 characters: letters, digits, ., _, : or -. The same id is never sent or charged twice. When omitted, X-Request-Id is used; when both are missing, a random id is generated. Recommended for every send.
tobodystringyesDestination number in E.164 format, for example +14155550123.
textbodystringyesMessage text, 1 to 1600 characters.
frombodystringnoSender number in E.164 format. Defaults to the from number saved with the credential. A Twilio credential with a Messaging Service SID can send without a number.
providerbodystringnotelnyx or twilio. Picks the connected account of that provider. When omitted, the account whose connection test passed is preferred, newest first.

Request

bash
curl -sS -X POST https://api.mot3r.com/v1/byoc/sms \
  -H "Authorization: Bearer mot_lk_live_xxxxxxxxxxxx" \
  -H "content-type: application/json" \
  -H "Idempotency-Key: order-1042-sms" \
  -d '{"to":"+14155550123","text":"Your order 1042 has shipped.","provider":"twilio"}'

Response 200

The response carries the header x-request-id with the request id that was used.

JSON
{
  "id": "3f2b8c1e-7a4d-4e5b-9c6f-1d2e3a4b5c6d",
  "provider": "twilio",
  "provider_message_id": "SM0123456789abcdef0123456789abcdef",
  "status": "queued",
  "segments": 1,
  "from": "+14155550100",
  "to": "+14155550123",
  "amount_micros": 1000,
  "request_id": "order-1042-sms",
  "measured_at": "2026-10-16T15:40:00.000Z"
}
NameTypeDescription
iduuid or nullId of the message record in the account history.
providerstringtelnyx or twilio.
provider_message_idstringMessage id at the provider.
statusstringStatus reported by the provider, lower case with underscores (for example queued).
segmentsinteger or nullNumber of SMS segments, when the provider reports it.
fromstring or nullSender number; null when a Twilio Messaging Service picked it.
tostringDestination number.
amount_microsintegerFee charged in micro-USD.
request_idstringThe request id: the Idempotency-Key you sent, or the generated one.

Common reasons:

StatusReasonWhen
400bad_to, bad_fromA number is not in E.164 format.
400bad_texttext is empty or longer than 1600 characters.
400byoc_from_requiredNo from in the request and none saved with the credential.
400bad_request_idThe Idempotency-Key has a character or length outside the rules.
402insufficient_balanceThe balance does not cover the fee.
403byoc_line_key_requiredThe key is not a tunnel key.
403trust_too_lowThe account is below trust level Z1.
403byoc_destination_not_allowedThe destination is outside the trust level, or a premium-rate number.
403service_offSMS is switched off for this account or key in the panel.
409byoc_not_configuredNo Telnyx or Twilio account is connected.
409duplicate_requestThis request id was already used. Send a new id to retry.
409request_in_flightA request with this id is still running.
429rate_limitedThe key exceeded its requests-per-minute limit.
422provider_rejectedThe provider refused the message.

Error 403

JSON
{"error":{"status":403,"reason":"byoc_destination_not_allowed","message":"This number is outside your trust level: Z1 reaches the USA and Canada, Z2 reaches international numbers.","trust":"Z1","required":"Z2"}}