LineDevelopers

Start a conversation

POST/api/channels/webchat/session

Opens a conversation for a visitor and returns a session token plus the transcript so far, including the assistant's greeting.

Widget public key, from an authorised domain

Request body

Identifies the widget and the visitor, plus optional attribution.

keystringrequired

The widget's public key.

visitorIdstringrequired

Your own stable identifier for this visitor. Reuse it to resume their conversation.

pageUrlstring · uri
referrerstring · uri
utmobject

Campaign parameters stored against the conversation.

Responses

200The session token and the transcript so far.
400key or visitorId is missing.
403The Origin is not on the widget's allowed-domains list.
404No enabled widget matches that key.
429Rate limited. Back off and retry.
curl -X POST 'https://staging.useline.io/api/channels/webchat/session' \
  -H 'Origin: https://example.com' \
  -H 'Content-Type: application/json' \
  -d '{
    "key": "pk_live_2f8c…",
    "visitorId": "b6e1f0c2-4f0a-4f7c-9a1d-2c2f7c5f9b10",
    "pageUrl": "https://example.com/pricing"
  }'