curl --request POST \
--url https://collectwiseapi.com/text/segments \
--header 'Content-Type: application/json' \
--header 'collectwise_key: <api-key>' \
--data '
{
"message": "Hi Jane, your balance is $430.10. Reply STOP to opt out."
}
'{
"encoding": "GSM-7",
"characterCount": 57,
"gsm7Length": 57,
"segmentCount": 1,
"maxCharsPerSegment": 160,
"messageSizeBits": 399
}{
"error": "Provide either message or templateId"
}{
"error": "Too many requests"
}Calculate SMS Segments
Returns how many SMS segments a message will use, matching the Twilio segment calculator. Provide either a raw message, or a templateId with variables (the template is rendered first, then counted). This endpoint does not send anything.
curl --request POST \
--url https://collectwiseapi.com/text/segments \
--header 'Content-Type: application/json' \
--header 'collectwise_key: <api-key>' \
--data '
{
"message": "Hi Jane, your balance is $430.10. Reply STOP to opt out."
}
'{
"encoding": "GSM-7",
"characterCount": 57,
"gsm7Length": 57,
"segmentCount": 1,
"maxCharsPerSegment": 160,
"messageSizeBits": 399
}{
"error": "Provide either message or templateId"
}{
"error": "Too many requests"
}Authorizations
Active, unexpired API key belonging to an active organization. Optional organization/key signing and organization IP restrictions also apply; see API Access.
Headers
Required together with x-cw-signature when signing is enabled for this key or organization. POST /security/verify also requires signing whenever a usable secret exists. Canonical Unix seconds, within ±300 seconds. See API Access for CW1 signing.
^(0|[1-9][0-9]*)$CW1 HMAC-SHA256 signature: v1= followed by 64 lowercase hex digits. Use the decoded 32-byte signing secret and exact request bytes. See API Access.
^v1=[0-9a-f]{64}$Body
Response
Segment usage for the message.
Encoding the message is sent with. Any non-GSM-7 character (emoji, smart quotes, most CJK) forces the whole message to UCS-2.
GSM-7, UCS-2 Number of characters in the message.
Number of SMS segments the message will use.
Max characters per segment for the chosen encoding (160 GSM-7, 70 UCS-2).
Length in GSM-7 units (extended characters such as { } [ ] ~ \ | ^ € cost 2).
Total message size in bits.
