Analyze the exact message text
Calculate the encoding, encoded length and SMS segment count for the text you intend to send. This endpoint does not send an SMS, reserve a route or return a delivery-price quote. Submit the complete final text, including any footer, link or opt-out wording that your sending workflow adds.
Request
Authenticate using your enabled API account and its allowed source IP address. Keep credentials in server-side secret storage. Send a UTF-8 string in the text field; the example uses environment variables.
curl --silent --show-error --user "$API_USER:$API_PASSWORD" \
--data-urlencode 'text=Your message here' \
https://api.multitel.net/v3/smslengthForm-encoded input is supported. A JSON object such as {"text":"Your message here"} is also accepted when no form or query fields are supplied. Prefer POST so message text does not appear in a URL. If both form and query input are present, the form is used. Do not mix request formats.
Response
{
"status": {
"code": "200",
"msg": ""
},
"response": {
"charset": 0,
"encoding": "GSM-7",
"count": 1,
"parts": 1,
"chars": 17,
"units": 17,
"single_limit": 160,
"multipart_limit": 153
}
}| Field | Meaning |
|---|---|
| charset | 0 for GSM-7 or 2 for UTF-16. |
| encoding | GSM-7 or UTF-16. |
| parts, count | Two names for the calculated number of SMS segments. Both are zero for empty text. |
| units, chars | Two names for encoded units. They do not necessarily equal visible characters. |
| single_limit | Encoded-unit limit for a single segment with the selected encoding. |
| multipart_limit | Encoded-unit limit used for each segment after concatenation overhead. |
Encoding and segment limits
| Encoding | Single segment | Multipart segment |
|---|---|---|
| GSM-7 | 160 septets | 153 septets |
| UTF-16 | 70 code units | 67 code units |
GSM-7 extension characters such as ^, braces, brackets, backslash, vertical bar, tilde and the euro sign consume two septets. A character outside GSM-7 switches the complete message to UTF-16 counting. An emoji outside the basic multilingual plane uses two UTF-16 units; a visible emoji sequence can contain several code points.
For example, 160 ordinary GSM-7 letters fit one segment and 161 require two. Eighty ^ characters use 160 units and fit one segment; eighty-one use 162 units and require two. Thirty-five simple non-BMP emoji use 70 UTF-16 units and fit one segment; thirty-six use 72 units and require two. Combining marks and joined emoji can change those counts.
Errors and empty text
A missing text field, an array/object instead of a scalar value, or invalid UTF-8 returns API code 403. Read JSON status.code and status.msg as well as the HTTP status; this endpoint returns the code as a string. An empty string is valid and returns zero units and zero segments.
Use the result before sending
The reviewed calculator contains no message send, carrier call or account debit. Its result is an analysis of the submitted text, not a delivery guarantee or a final bill. Sending can have destination rates, carrier fees, campaign requirements and additional text transformations. Recalculate after changing the message, then use the approved sending workflow and current account pricing.