Skip to main content
This guide walks through a production-shaped outbound send: auth, body fields, idempotency, and how to interpret the response.

Prerequisites

  • A workspace with a live line.
  • A Messages API key with comms_send.
  • A phone number you control for testing (to in E.164).

Request

Fields

FieldRequiredNotes
toOne of to / conversation_idE.164, e.g. +12125550147
conversation_idOne of to / conversation_idContinue an existing thread
bodyYesPlain text for SMS / iMessage
channelNo"sms" or "imessage" when you want to prefer one
idempotency_keyNoSame as header; either works

Auth

Missing or invalid key → 401. Missing comms_send403 with { "error": "missing comms_send scope" }.

Response

Accepted

202 — Comms accepted the message for delivery.

Duplicate

200 — Same idempotency key already processed. No second send.
Treat 202 and duplicate 200 as success for your queue / job runner.

Idempotency

Use a stable key derived from your business event:
If your worker crashes after the POST but before recording success, the retry hits the same key and Comms returns the original result. Full detail: Idempotency.

Channels

ValueBehavior
omittedComms picks the best path for that recipient
"imessage"Prefer iMessage when available
"sms"Force SMS
Not every recipient can receive iMessage. Prefer omitting channel unless you have a product reason.

Continuing a thread

First touch:
Later replies in the same conversation (using an id you stored):

Checklist for production

Inject COMMS_API_KEY from your secret store. Never embed it in a frontend bundle.
Derive it from the domain event so retries are safe.
Persist message.id and HTTP status so support can trace a send without reading phone logs.
Back off using retry_after when present. See Errors & rate limits.