Preview how a message will be segmented and calculate character count with encoding details.SMS Live Mode Only: All SMS endpoints require a live mode API key (sk_live_*).
Preview Message Segments#
Preview how a message will be segmented and calculate character count with encoding details.Endpoint: POST /v1/sms/preview| Field | Type | Required | Description |
|---|
message_body | string | Yes | Message text to preview |
template_id | string | No | Template ID to use for preview |
params | object | No | Template parameters for preview |
{
"data": {
"message_body": "Hello! This is a test message with special characters: émojis 😀",
"character_count": 66,
"segments": 1,
"encoding": "UCS-2",
"max_length_per_segment": 70,
"estimated_cost": "1 credit"
}
}
Encoding Types#
GSM-7: Standard 7-bit encoding (up to 160 characters per segment)
UCS-2: Unicode encoding for special characters and emojis (up to 70 characters per segment)
Character Limits#
1 segment: up to 160 characters
2 segments: up to 306 characters
3 segments: up to 459 characters
1 segment: up to 70 characters
2 segments: up to 134 characters
3 segments: up to 201 characters
Automatic Detection: The API automatically detects which encoding to use based on your message content. If your message contains special characters or emojis, UCS-2 encoding will be used.