Phones
Lines
A line is what you send from and receive into; it sends through an ordered list of your channels and fails over on its own.
A channel is one connected number (a SIM in a phone today). A line is what your app sends from and receives into. A line sends through an ordered sender list of the account's channels: the first healthy one sends, and when it cannot (the phone is offline, the SIM is out of budget or keeps failing) queued messages move to the next one. Several lines can share a channel, so your CRM and your billing service can use the same SIM and still keep their conversations, rules, keys and webhooks apart.
Every account has one Direct line (kind: direct). Each number you verify joins it, and replies nobody else claims land
there. Lines you create are app lines.
Create one#
POST /v1/lines needs channels:write, which only an account-wide key holds:
curl -sS -X POST "$MYCOMM_URL/v1/lines" \
-H "Authorization: Bearer $MYCOMM_API_KEY" \
-H "Content-Type: application/json" \
-d '{"name": "Billing", "senders": [{"channel_id": "SIM_1_ID"}, {"channel_id": "SIM_2_ID"}]}'
The first sender is the primary and the rest are backups, unless you set role on an entry; a sender you mark
primary is moved to the front, so the primary is always tried first. A name is unique in the
account, ignoring case (409 NAME_TAKEN). Each sender in the answer carries healthy, whether it could send right now.
Change it#
PATCH /v1/lines/{id}changesname,reply_window_days(1 to 365, default 30),show_in_portalandsettings.PUT /v1/lines/{id}/sendersreplaces the whole sender list; the order you send is the order they are tried in. It firesline.sender_changed.GET /v1/lines/{id}/sendersreads it.
Use it#
- Give the app a key for this line with
line_ids: [id]. That key sees only this line's traffic and sends without naming a sender at all. - Send from it with
line_id. Addchannel_idonly to force one SIM: such a message issender_pinnedand never moves. - Replies come back to it. A reply on a channel the line wrote from within
reply_window_dayslands on this line. A channel that is in exactly one line besides the Direct line sends its other replies there; anything else goes to the Direct line. - Follow failover with the
line.failoverandline.no_senderevents, and per message insender_attempts. - Hand a conversation to another line with
POST /v1/conversations/{id}/handover. Its queued messages go with it: unpinned ones then send from the new line's senders (aline.failoverwith reasonsender_removedwhen their SIM is not one of them); pinned ones keep their SIM.
Archive it#
DELETE /v1/lines/{id} archives an app line (the Direct line answers 422 LINE_IS_DIRECT). Sends from it are refused
(LINE_ARCHIVED), reply routing skips it and its open conversations move to the Direct line; keys limited to it keep read
access. POST /v1/lines/{id}/unarchive brings it back.