Send a message
const url = 'https://api.siprtc.io/v1/Accounts/example/Messages';const options = { method: 'POST', headers: {Authorization: 'Basic <credentials>', 'Content-Type': 'application/json'}, body: '{"body":"Your appointment is confirmed for 10:30 tomorrow.","channel":"sms","from":"+15555550100","hasAttachment":false,"mediaFileContents":[{"fileId":"file-0001","fileName":"invoice.pdf","fileUrl":"https://example.com/files/invoice.pdf","mimeType":"application/pdf","size":48213,"text":"Your invoice"}],"statusCallback":"https://example.com/sms/status","statusCallbackMethod":"GET","to":"+15555550123"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.siprtc.io/v1/Accounts/example/Messages \ --header 'Authorization: Basic <credentials>' \ --header 'Content-Type: application/json' \ --data '{ "body": "Your appointment is confirmed for 10:30 tomorrow.", "channel": "sms", "from": "+15555550100", "hasAttachment": false, "mediaFileContents": [ { "fileId": "file-0001", "fileName": "invoice.pdf", "fileUrl": "https://example.com/files/invoice.pdf", "mimeType": "application/pdf", "size": 48213, "text": "Your invoice" } ], "statusCallback": "https://example.com/sms/status", "statusCallbackMethod": "GET", "to": "+15555550123" }'Sends one outbound message on the channel you choose: sms, whatsapp, facebook (Messenger) or viber. The message is handed to the provider before the call returns, so a 201 means the provider accepted it; the response status is sent, and later delivery updates are recorded on the message record (see Get a message).
from must belong to the account: for sms a phone number of the account or of its parent account, or a registered alphanumeric sender ID; for whatsapp a WhatsApp number of the account; for facebook a connected Facebook page ID; for viber the webhook SID of a connected Viber bot. The SMS route (Twilio, Plivo, Movider, an SMPP vendor, Sinch or CM) follows from the sender.
SMS and WhatsApp sends need an account balance of at least 0.10 USD and a valid E.164 to; price in the response is the route’s per-message rate in USD and num_segments is always “1”. The message is added to the account’s conversation history, joining the open conversation with the same recipient and sender if there is one.
A facebook send returns 201 with every field empty and creates no message record. A disabled account also gets 201 with an empty body, and nothing is sent. Every refusal (validation, unknown sender, balance, invalid number, provider error) is a 400 with {"status":"failed","message":...}.
The message is sent from the account whose credentials you use; the {auth_id} in the path is used only when the request carries no authenticated identity.
Authorizations
Section titled “ Authorizations ”Parameters
Section titled “ Parameters ”Path Parameters
Section titled “ Path Parameters ”Your account’s Auth ID
Request Bodyrequired
Section titled “ Request Bodyrequired ”The message to send
object
Message text, at most 1600 characters. Required unless hasAttachment is
true. When it is sent with attachments on WhatsApp (up to 1024 characters) or
Viber it becomes the caption of the first attachment that can carry one;
otherwise it is sent as a separate text message first.
Example
Your appointment is confirmed for 10:30 tomorrow.Channel to send on. One of sms, whatsapp, facebook (Messenger) or viber.
Example
smsSender. For sms a phone number of the account (or of its parent account)
or one of the account’s registered alphanumeric sender IDs (case-sensitive).
For whatsapp a WhatsApp number of the account. For facebook the ID of a
Facebook page connected to the account. For viber the webhook SID of a
Viber bot connected to the account.
Example
+15555550100Set to true to send the files in mediaFileContents. Attachments are
refused on sms, and on WhatsApp numbers that are not connected through Meta.
Example
falseFiles to send when hasAttachment is true. At least one is required then,
and every entry needs fileId, fileName, fileUrl, mimeType and a
size above 0.
object
Your own identifier for the file. Required; not sent to the recipient.
Example
file-0001File name shown to the recipient (used for documents).
Example
invoice.pdfPublic HTTPS URL the provider downloads the file from.
Example
https://example.com/files/invoice.pdfMIME type. It decides how the file is sent: image/, video/ and audio/* as media of that kind, anything else as a document.
Example
application/pdfFile size in bytes. Must be above 0.
Example
48213Caption text stored with the file in the conversation history.
Example
Your invoiceValidated (it must be a URL when present) but not used: no status callback is sent for messages sent through this endpoint.
Example
https://example.com/sms/statusValidated (GET or POST, any case, when present) but not used.
Example
POSTRecipient. For sms and whatsapp a phone number in E.164 format (a missing
leading + is added); it must be a valid number. For facebook the
recipient’s page-scoped ID (PSID). For viber the Viber user ID.
Example
+15555550123Responses
Section titled “ Responses ”Sent: the message resource
object
Auth ID of the account that sent the message.
Always empty.
Message text, as given in the request.
When the message was created, RFC 3339.
When the message was handed to the provider, RFC 3339.
When the message was last updated, RFC 3339 (the send time).
Always outbound-api.
Always empty: a refused send is answered with a 400 instead.
Always empty.
Sender, as given in the request.
Always empty.
Number of attachments sent, as a string.
Number of segments, as a string. Always “1” in the send response.
Per-message rate of the route, as a decimal string, in price_unit. “0” when the channel has no rate.
Currency of price: USD.
Message ID: the provider’s ID for the message (for example a WhatsApp wamid. ID or a Twilio SID) or one generated by SIPRTC. Use it to fetch the message record.
Status at the time of the response: sent (accepted by the provider).
Related resources.
object
Path for the message’s media. Not served.
Recipient, as given in the request.
Path of this message’s record.
Example
{ "account_sid": "AC000000000000000000", "api_version": "", "body": "Your appointment is confirmed for 10:30 tomorrow.", "date_created": "2026-11-26T10:30:00Z", "date_sent": "2026-11-26T10:30:00Z", "date_updated": "2026-11-26T10:30:00Z", "direction": "outbound-api", "error_code": "", "error_message": "", "from": "+15555550100", "messaging_service_sid": "", "num_media": "0", "num_segments": "1", "price": "0.0075", "price_unit": "USD", "sid": "SM00000000000000000000000000000000", "status": "sent", "subresource_uris": { "media": "/v1/Accounts/AC000000000000000000/Messages/SM00000000000000000000000000000000/Media" }, "to": "+15555550123", "uri": "/v1/Accounts/AC000000000000000000/Messages/SM00000000000000000000000000000000"}Refused: invalid body, unknown sender, insufficient balance, invalid number or a provider error
object
Why the request was refused, for example a validation message such as “validation failed on field ‘to’, condition: required”, or the provider’s error.
Always failed.
Example
{ "message": "Insufficient Balance - Recharge Account!!", "status": "failed"}Missing or wrong credentials (body: "Authentication failed")
Example generated
example