API docs for iMessage and SMS lines

A REST API with signed webhooks, live events and an MCP server. Create a key in the app and send your first message with one request.

Webhooks are signed and retried up to 6 times.

Send a first message in 3 steps

1

Create an API key

In the app, open Developers, then API keys. The key is shown once; keep it in your secrets.

sh.env
LINES_KEY=sk_live_…f3a9
# scopes: messages:read, messages:send
2

Send a message

POST to /v1/messages with an Idempotency-Key. The answer is 202 with the message id.

jssend.js
await fetch(API + "/v1/messages", {
  method: "POST", headers,
  body: JSON.stringify({ to, text })
})
3

Receive the reply

Add a webhook URL. Replies, receipts and reactions arrive signed, retried until you answer 2xx.

httpPOST /hooks/lines
X-Signature: t=1795382…,v1=9c1f…

{ "type": "message.received",
  "data": { "message": { … } } }

Webhooks and live events

The same event JSON goes to your webhook and to the live stream at /v1/events. Webhooks are stored first and retried for about 10 minutes.

Check X-Signature: an HMAC-SHA256 of the timestamp and raw body with your secret. Reject anything older than 5 minutes.

  • message.received

    Someone texted the line: text, attachments and the chat.

  • message.sent · delivered · read

    Each step of a message you sent. Read receipts come from iMessage.

  • message.fallback

    iMessage couldn't reach them, so the message went as SMS.

  • message.failed

    It couldn't be sent, with a reason such as recipient_not_allowed.

  • message.reaction

    A reaction was added to or removed from a message.

  • draft.created · approved · rejected

    An agent's draft and what the team did with it.

  • profile.online · offline

    The line started or stopped working.

MCP server for agents

Point Claude Code, Cursor or any MCP client that sends a header at /mcp with an API key. Each tool is an API call with that key, so its limits apply.

jsonmcp.json
{ "mcpServers": { "lines": {
  "url": "https://api.clyxmail.com/mcp",
  "headers": { "Authorization": "Bearer sk_live_…" }
} } }
  • list_chats · read_messages · search_messages

    Read the line's conversations and search them.

  • send_message · react · set_typing · mark_read

    Act in a chat. A drafts-only key makes a draft instead.

  • list_drafts

    See what is waiting for a person to approve.

  • place_call · transfer_call · hangup_call

    Start and steer calls on the same number.

  • Approving drafts

    Not a tool on purpose: a person approves in the app.

Errors that say what to fix

Every error has a code and a sentence on what to do. Calls use the same keys, scopes and events as messages.

Calling covers the US and Canada; emergency numbers are refused on every path.

  • 429 rate_limited

    The key's sends per hour are used up.

  • 403 recipient_not_allowed

    The number isn't on this key's list.

  • 403 draft_only_key

    This key can make drafts, not send.

  • 402 payment_required

    Billing needs attention; reading still works.

  • 409 idempotency_key_reused

    Same key, different body: nothing was sent.

  • 503 line_unavailable

    The line is having trouble; queued sends wait 15 minutes.