Chat (widget)
These are the public endpoints the chat widget uses. They need no token — they are scoped by site_key + session_id. The main chat endpoint streams the AI reply via Server-Sent Events.
POST
/api/v1/chat/stream PublicSend a visitor message and stream the AI answer as text/event-stream (SSE). Each event is a JSON chunk; a final event carries conversation_id.
Request body
{
"site_key": "sk_…",
"session_id": "sess_…",
"message": "Do you ship to Canada?",
"lang": "en",
"message_id": "m_abc"
}Response
data: {"type":"chunk","content":"Yes, "}
data: {"type":"chunk","content":"we do."}
data: {"type":"done","meta":{"conversation_id":50}}GET
/api/v1/chat/history PublicConversation history for a session.
Response
{ "success": true, "messages": [ … ] }POST
/api/v1/chat/email PublicSave the visitor’s email to the conversation.
Request body
{ "site_key": "sk_…", "session_id": "sess_…", "email": "[email protected]" }Response
{ "success": true, "message": "Email saved" }POST
/api/v1/chat/contact PublicSave a contact (email and/or phone, optional name).
Request body
{ "site_key": "sk_…", "session_id": "sess_…", "email": "[email protected]", "phone": "+1…", "name": "Jane" }Response
{ "success": true, "message": "Contact saved" }GET
/api/v1/chat/operator-messages PublicNew operator messages and the current mode (ai | operator).
Response
{ "success": true, "messages": [ … ], "mode": "operator" }GET
/api/v1/chat/block-status PublicWhether the visitor is blocked.
Response
{ "success": true, "blocked": false }GET
/api/v1/chat/pending-proactive PublicPending proactive (nudge) messages for the session.
Response
{ "success": true, "messages": [ … ] }POST
/api/v1/chat/upload-image PublicUpload an image from the widget (multipart field image).
Response
{ "success": true, "url": "https://cdn…" }POST
/api/v1/chat/rate PublicRate the conversation (1–5).
Request body
{ "site_key": "sk_…", "session_id": "sess_…", "score": 5 }Response
{ "success": true }POST
/api/v1/chat/rate/comment PublicAdd a comment to a rating.
Request body
{ "site_key": "sk_…", "session_id": "sess_…", "comment": "Great!" }Response
{ "success": true }