Calculate billable segments before sending.
Visible character count is not the same as encoded message size. One character can change the alphabet, multipart capacity and total campaign cost.
What the API measures
TextPreflight identifies GSM-7 or UCS-2 encoding, counts encoded units, applies the selected sender profile and reports the exact number of billable segments. Add recipient count and your own per-segment price to estimate campaign spend.
| Encoding/profile | Single part | Multipart |
|---|---|---|
| GSM-7 standard | 160 septets | 153 per part |
| UCS-2 standard | 70 units | 67 per part |
| Toll-free US/CA profile | 160 / 70 | 152 / 66 |
Analyze a campaign
curl -X POST \
https://textpreflight.kadircoteli.workers.dev/api/v1/sms/analyze \
-H "Content-Type: application/json" \
-H "Authorization: Bearer TPF-YOUR-LICENSE-KEY" \
-d '{"text":"Your delivery is ready.","recipients":10000,"unitPrice":0.0075,"currency":"USD"}'
The result includes encoding, units, segment count, remaining capacity, billable segments and estimated cost. Billing can vary by route and provider, so use your current contract price and the relevant profile.
Use it as a pre-send gate
- Analyze the final rendered message, not only the template.
- Test the longest realistic personalization values.
- Apply the correct sender profile.
- Review unexpected UCS-2 and segment growth.
- Require approval when forecast cost exceeds your threshold.
The calculation happens before the delivery request, so one integration can protect multiple messaging routes.
Test a real message.
Use the free analyzer, then add the same check to your application.