Send a message
POST https://api.telrioz.com/api/v1/messages
One text to 1 to 1000 numbers, through a Gateway. It sends SMS or WhatsApp Generic, whichever the Gateway's Channel is. A 200 lists each number with its message ID, or the reason it was turned away: read rejected[], because a 200 does not mean every number went out. Then follow each message with GET /messages/{id} or a webhook.
Authentication
Send your key in the header Authorization: Bearer YOUR_API_KEY. See Authentication.
| Name | Type | Description |
|---|---|---|
torequired | string or string[] | One number, or a list of 1 to 1000 numbers. Write it as 6281234567890, +62 812-3456-7890 or 081234567890: spaces, dashes and brackets are ignored, a leading + is dropped, a leading 0 becomes 62, and the result must be 8 to 15 digits. A number given twice is sent once. A number we cannot read comes back in rejected[] as invalid_number, and the others still go out. The numbers times the text's parts may be at most 1000 segments. |
textrequired | string | The message. One part holds 160 GSM-7 characters; a character from the extension table (€ [ ] { } ^ ~ | \ and form feed) counts as 2. A text with any other character, such as an emoji or a non-Latin letter, is sent as UCS-2: 70 characters in one part, and an emoji counts as 2. A longer text is split into parts of 153 (GSM-7) or 67 (UCS-2) characters, and each part is charged as one segment. At most 10 parts. |
from | string | The Sender ID: 1 to 11 letters, digits, spaces or the characters . & -, or up to 15 digits. Anything else answers 400, on every Channel. Leave it out to send from the Gateway's Sender ID; it is required when the Gateway has none and its Channel takes one, and then it must be approved for the number's operator. A Channel that takes no Sender ID ignores a valid one: the upstream sends from its own number. |
gateway | string or integer | The ID of the Gateway to send through, as the dashboard shows it. Leave it out to send through your Default Gateway. It cannot be an OTP Gateway: those send through POST /otp. With a Gateway key, leave it out or give that Gateway's ID. The Gateway sets the Use case, Channel, Route and price, and must be active: a Gateway that is paused or deleted, named or behind a Gateway key, answers 400 invalid_request, |
Request examples
{
"to": "6281234567890",
"text": "Your order has shipped."
}{
"to": [
"6281234567890",
"081298765432"
],
"text": "Your order has shipped.",
"from": "ACME",
"gateway": "12"
}Limits
- 1000 numbers in one call.
- 10 parts in one text.
- 1000 segments in one call: the numbers times the text's parts.
- 10 requests a second per account, counted over all its keys.
See Limits.
Responses
200
The request was read. Each number is in accepted[] or in rejected[].
Fields of the 200 answer Name Type Description acceptedrequiredobject[]Each number that was taken.
accepted[].torequiredstringThe number, written as 62…
accepted[].idrequiredstringThe message ID, for GET /messages/{id} and the webhook.
accepted[].partsrequiredintegerHow many parts (segments) the text took.
rejectedrequiredobject[]Each number that was turned away, and why.
rejected[].torequiredstringThe number: as you gave it for invalid_number, else written as 62…
rejected[].reasonrequiredstringinvalid_number: Not a phone number we can read. Correct it and send again.insufficient_balance: The balance is too low for this message. Top up, then send again.throttled: More messages a second than the account's speed limit. Wait a moment and send again.sender_not_allowed: The Sender ID is not approved for this number's operator.no_route: There is no Route, or no price, for this number's operator yet. Contact Telrioz support.no_gateway: The Gateway was paused while the request was in flight. A Gateway that is paused before the request answers 400 for the whole call.unavailable: Telrioz could not take the message right now. If an id is given, check it before you send again; else try again in a few seconds.rejected[].idstringOnly when part of the message may have gone out (and been charged): the message ID. Check it with GET /messages/{id} instead of sending again.
accepted: Every number taken { "accepted": [ { "to": "6281234567890", "id": "c2b1f5e0-3a7e-4b8f-9d2c-1f0e6a5b4c3d", "parts": 1 } ], "rejected": [] }mixed: One number taken, one turned away { "accepted": [ { "to": "6281234567890", "id": "c2b1f5e0-3a7e-4b8f-9d2c-1f0e6a5b4c3d", "parts": 1 } ], "rejected": [ { "to": "12345", "reason": "invalid_number" } ] }400
invalid_request: The body is not JSON or a field is wrong; message says which. Read message, correct that field and send again.Error codes:
invalid_requestinvalid_request: The body is not JSON or a field is wrong; message says which. { "error": "invalid_request", "message": "to: 1–1000 numbers" }401
unauthorized: No Bearer key, or a key we do not know. Send the header Authorization: Bearer <key> with a key from Developers → Credentials.key_disabled: The key is switched off. Switch the key on in Developers → Credentials, or use another key.key_expired: The key is past its last day (WIB). Make a new key, or ask your admin to move the key's expiry date.Error codes:
unauthorized,key_disabled,key_expiredunauthorized: No Bearer key, or a key we do not know. { "error": "unauthorized" }key_disabled: The key is switched off. { "error": "key_disabled", "message": "This key is disabled" }key_expired: The key is past its last day (WIB). { "error": "key_expired", "message": "This key expired after 2026-10-31" }403
ip_not_allowed: The request is not from one of the key's allowed IPs. Ask your admin to add this IP to the key's Allowed IPs, or remove the limit.not_active: The account is not active yet. Sign in to the portal and set your password, and finish what the welcome email asks (verify your WhatsApp number, or top up), then try again.suspended: The account is suspended. Contact Telrioz support.Error codes:
ip_not_allowed,not_active,suspendedip_not_allowed: The request is not from one of the key's allowed IPs. { "error": "ip_not_allowed", "message": "Requests from 203.0.113.7 are not allowed with this key" }not_active: The account is not active yet. { "error": "not_active" }suspended: The account is suspended. { "error": "suspended" }429
The limit is 10 requests per second per account, counted over all its keys.
rate_limited: More than 10 requests a second on this account. Wait a second and send again; space calls out, or send many numbers in one call.Error codes:
rate_limitedrate_limited: More than 10 requests a second on this account. { "error": "rate_limited" }500
internal: Something failed on our side. Try again; if it keeps happening, contact Telrioz support.Error codes:
internalinternal: Something failed on our side. { "error": "internal" }