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.
| Encoding | One SMS | Per segment when split | Maximum (10 segments) |
|---|---|---|---|
| GSM-7 | 160 characters | 153 | 1,530 |
| UCS-2 | 70 characters | 67 | 670 |
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
| Status | Meaning |
|---|---|
queued | Accepted, waiting for the modem |
sent | Every segment left for the network |
delivered | The network confirmed every segment |
failed | A segment failed; see error |
received | Inbound 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.