Preview message cost
Prices a message before you send it, without sending anything. It splits text into segments for the chosen channel and returns the segment count, the price per segment and the total in your account currency.
curl --request GET \
--url https://api.vobiz.ai/api/v1/sms/messages/cost-preview \
--header 'X-Auth-ID: <api-key>' \
--header 'X-Auth-Token: <api-key>'from vobiz import Vobiz
client = Vobiz(api_key="MA_XXXXXXXX", auth_token="YOUR_AUTH_TOKEN")
client.sms.messages.preview_message_cost(
from_="+14155550100",
to="+14155550123",
)
const options = {
method: 'GET',
headers: {'X-Auth-ID': '<api-key>', 'X-Auth-Token': '<api-key>'}
};
fetch('https://api.vobiz.ai/api/v1/sms/messages/cost-preview', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"channel": "sms",
"segmentCount": 2,
"unitCost": 0.01,
"totalCost": 0.02,
"currency": "USD"
}{
"error": "from and to are required"
}{
"error": "missing or invalid credentials"
}{
"error": "internal error"
}Authorizations
Your Vobiz account Auth ID (MA_XXXXXXXX).
Your Vobiz account Auth Token.
Query Parameters
Required. The sender you plan to use: one of your numbers in E.164 format, or the senderName of your RCS sender when channel is rcs. It determines the route the message is priced on.
Required. One recipient number in E.164 format, for example +14155550123. Its destination country determines the price.
Channel to price: sms, mms or rcs. Defaults to sms.
sms, mms, rcs The message body to segment and price, URL-encoded. Pass the exact text you plan to send: the segment count depends on its length and on whether it fits the GSM-7 character set. Defaults to an empty string.
Response
Segment count and cost.
An estimate of what a message costs before you send it: how many segments the text splits into, and the price per segment and in total.
Channel the estimate is for: sms, mms or rcs, matching the channel you requested.
"sms"
Number of segments the text splits into. A GSM-7 SMS fits 160 characters in one segment and 153 per segment when split; text with other characters uses UCS-2 (70 and 67).
2
Price of one segment, in currency.
0.01
Estimated price of the message to one recipient, in currency: unitCost multiplied by segmentCount.
0.02
ISO 4217 code of the currency the prices are in, for example USD.
"USD"
ISO 3166-1 alpha-2 code of the destination country, for example US. Omitted when the destination country is not resolved.
"US"
Was this page helpful?
curl --request GET \
--url https://api.vobiz.ai/api/v1/sms/messages/cost-preview \
--header 'X-Auth-ID: <api-key>' \
--header 'X-Auth-Token: <api-key>'from vobiz import Vobiz
client = Vobiz(api_key="MA_XXXXXXXX", auth_token="YOUR_AUTH_TOKEN")
client.sms.messages.preview_message_cost(
from_="+14155550100",
to="+14155550123",
)
const options = {
method: 'GET',
headers: {'X-Auth-ID': '<api-key>', 'X-Auth-Token': '<api-key>'}
};
fetch('https://api.vobiz.ai/api/v1/sms/messages/cost-preview', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"channel": "sms",
"segmentCount": 2,
"unitCost": 0.01,
"totalCost": 0.02,
"currency": "USD"
}{
"error": "from and to are required"
}{
"error": "missing or invalid credentials"
}{
"error": "internal error"
}