Skip to content

Send a message

POST
/v1/Accounts/{auth_id}/Messages
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.

auth_id
required
string

Your account’s Auth ID

The message to send

Media type application/json
object
body

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.

string
<= 1600 characters

Example

Your appointment is confirmed for 10:30 tomorrow.
channel
required

Channel to send on. One of sms, whatsapp, facebook (Messenger) or viber.

string
Allowed values: sms whatsapp facebook viber

Example

sms
from

Sender. 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.

string

Example

+15555550100
hasAttachment

Set to true to send the files in mediaFileContents. Attachments are refused on sms, and on WhatsApp numbers that are not connected through Meta.

boolean

Example

false
mediaFileContents

Files 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.

Array<object>
object
fileId
required

Your own identifier for the file. Required; not sent to the recipient.

string

Example

file-0001
fileName
required

File name shown to the recipient (used for documents).

string

Example

invoice.pdf
fileUrl
required

Public HTTPS URL the provider downloads the file from.

string format: uri

Example

https://example.com/files/invoice.pdf
mimeType
required

MIME type. It decides how the file is sent: image/, video/ and audio/* as media of that kind, anything else as a document.

string

Example

application/pdf
size
required

File size in bytes. Must be above 0.

integer
>= 1

Example

48213
text

Caption text stored with the file in the conversation history.

string

Example

Your invoice
statusCallback

Validated (it must be a URL when present) but not used: no status callback is sent for messages sent through this endpoint.

string format: uri

Example

https://example.com/sms/status
statusCallbackMethod

Validated (GET or POST, any case, when present) but not used.

string
Allowed values: GET POST

Example

POST
to
required

Recipient. 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.

string

Example

+15555550123

Sent: the message resource

Media type application/json
object
account_sid

Auth ID of the account that sent the message.

string
api_version

Always empty.

string
body

Message text, as given in the request.

string
date_created

When the message was created, RFC 3339.

string
date_sent

When the message was handed to the provider, RFC 3339.

string
date_updated

When the message was last updated, RFC 3339 (the send time).

string
direction

Always outbound-api.

string
error_code

Always empty: a refused send is answered with a 400 instead.

string
error_message

Always empty.

string
from

Sender, as given in the request.

string
messaging_service_sid

Always empty.

string
num_media

Number of attachments sent, as a string.

string
num_segments

Number of segments, as a string. Always “1” in the send response.

string
price

Per-message rate of the route, as a decimal string, in price_unit. “0” when the channel has no rate.

string
price_unit

Currency of price: USD.

string
sid

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.

string
status

Status at the time of the response: sent (accepted by the provider).

string
subresource_uris

Related resources.

object
media

Path for the message’s media. Not served.

string
to

Recipient, as given in the request.

string
uri

Path of this message’s record.

string

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

Media type application/json
object
message

Why the request was refused, for example a validation message such as “validation failed on field ‘to’, condition: required”, or the provider’s error.

string
status

Always failed.

string

Example

{
"message": "Insufficient Balance - Recharge Account!!",
"status": "failed"
}

Missing or wrong credentials (body: "Authentication failed")

Media type application/json
string

Example generated

example