06 Line

SMS

Sending, long messages, encodings, delivery status, and receiving.

Sending

Sending is a REST call: POST /v1/sms.

curl -X POST https://api.06line.com/v1/sms \
  -H "Authorization: Bearer $SIXLINE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "line_id": "line_01jbq5a3x9e2k7m4t6v8r0c1yb",
    "to": "+33698765432",
    "text": "Your appointment is confirmed for tomorrow at 10:00.",
    "client_ref": "order-4821-confirmation"
  }'

The answer (201) is the message with status: "queued", its encoding and the number of segments it costs. Sending the same client_ref again answers 200 with the first message and sends nothing. Delivery is reported by the sms.status webhook; GET /v1/sms/{id} gives the current status at any time.

Encodings and long messages

A text is sent in GSM-7 when every character belongs to the GSM alphabet, otherwise the whole text switches to UCS-2. Long texts are split into segments that the recipient's phone joins back together; each segment is billed by the operator as one SMS.

EncodingOne SMSPer segment when splitMaximum (10 segments)
GSM-7160 characters1531,530
UCS-270 characters67670

What switches a text to UCS-2 is often invisible:

  • A single character outside the GSM alphabet changes the whole message: an emoji, œ, â, ê, î, ô, û, curly quotes ’ “ ”. é, è, à, ù are in GSM-7.
  • € [ ] { } ~ ^ | \ are in GSM-7 but count as 2 characters.
  • An emoji outside the basic plane counts as 2 UCS-2 characters.

A 161-character GSM-7 text is 2 segments; add one emoji and it becomes 3. Over 10 segments, the request fails with text_too_long and nothing is sent.

Status

StatusMeaning
queuedAccepted, waiting for the modem
sentEvery segment left for the network
deliveredThe network confirmed every segment
failedA segment failed; see error
receivedInbound message

Each change is sent to your sms.status webhook. Some networks never confirm delivery; the message then stays sent.

Receiving

Incoming messages reach your sms.received webhook, already reassembled. If a segment of a long message is still missing after 10 minutes, the message is delivered anyway with incomplete: true and the gap marked […].

History

History is a plain read, so it lives on the REST API: GET /v1/sms, newest first. Filter by line_id, by peer for the history with one contact, or both.

curl "https://api.06line.com/v1/sms?peer=%2B33698765432&limit=20" \
  -H "Authorization: Bearer $SIXLINE_API_KEY"

Pass next_cursor as before to get the next page. GET /v1/calls takes the same filters, so the full history with a contact is these two lists merged by date.

On this page