Preview encoding, segments, cost, and policy
/api/v1/messages/previewRequest body
fromstringrequiredAn approved number in E.164 format, or an approved sender name such as ACMEDENTAL. A sender name is one-way and sends only to UK and Irish numbers.
tostringrequiredOne recipient in E.164 format.
bodystringThe text. Send either body or template_id.
template_idstring · uuidAn active template. Line renders it with variables before it counts segments.
variablesobjectA value for every {{variable}} in the template.
send_atstring · date-timeSchedule the send, up to 35 days ahead. Include an offset, such as Z or +01:00. Credits are reserved at acceptance and released if the send is canceled.
expires_atstring · date-timeDo not send after this time. A message still waiting then ends as expired and its credits are released.
client_referencestringmetadataobjectmax_segmentsintegerReject the send when the encoded body exceeds this limit. The service maximum is 10.
max_creditsnumberReject the send when the estimate exceeds this decimal credit ceiling.
Responses
200A non-sending preview with the rendered body and a policy result.curl -X POST 'https://staging.useline.io/api/v1/messages/preview' \
-H "Authorization: Bearer $LINE_API_KEY" \
-H 'Content-Type: application/json' \
-d '{
"from": "+447700900123",
"to": "+447700900456",
"body": "Hi Sam, your engineer arrives between 10 and 12 tomorrow."
}'