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
| Name | In | Type | Required | Description |
|---|---|---|---|---|
Idempotency-Key | header | string | no | Request 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. |
to | body | string | yes | Destination number in E.164 format, for example +14155550123. |
text | body | string | yes | Message text, 1 to 1600 characters. |
from | body | string | no | Sender 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. |
provider | body | string | no | telnyx or twilio. Picks the connected account of that provider. When omitted, the account whose connection test passed is preferred, newest first. |
Request
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.
{
"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"
}| Name | Type | Description |
|---|---|---|
id | uuid or null | Id of the message record in the account history. |
provider | string | telnyx or twilio. |
provider_message_id | string | Message id at the provider. |
status | string | Status reported by the provider, lower case with underscores (for example queued). |
segments | integer or null | Number of SMS segments, when the provider reports it. |
from | string or null | Sender number; null when a Twilio Messaging Service picked it. |
to | string | Destination number. |
amount_micros | integer | Fee charged in micro-USD. |
request_id | string | The request id: the Idempotency-Key you sent, or the generated one. |
Common reasons:
| Status | Reason | When |
|---|---|---|
| 400 | bad_to, bad_from | A number is not in E.164 format. |
| 400 | bad_text | text is empty or longer than 1600 characters. |
| 400 | byoc_from_required | No from in the request and none saved with the credential. |
| 400 | bad_request_id | The Idempotency-Key has a character or length outside the rules. |
| 402 | insufficient_balance | The balance does not cover the fee. |
| 403 | byoc_line_key_required | The key is not a tunnel key. |
| 403 | trust_too_low | The account is below trust level Z1. |
| 403 | byoc_destination_not_allowed | The destination is outside the trust level, or a premium-rate number. |
| 403 | service_off | SMS is switched off for this account or key in the panel. |
| 409 | byoc_not_configured | No Telnyx or Twilio account is connected. |
| 409 | duplicate_request | This request id was already used. Send a new id to retry. |
| 409 | request_in_flight | A request with this id is still running. |
| 429 | rate_limited | The key exceeded its requests-per-minute limit. |
| 422 | provider_rejected | The provider refused the message. |
Error 403
{"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"}}