Skip to main content
This reference describes the response-chat-widget server and the contracts its browser client uses. Replace https://api.example.com with your API deployment. The widget can also call a custom backend through endpoint and request-mapping props. The hosted ResponseCX v2 loader and browser Chat Desk are documented in Widget to desk. Their routes and enforcement settings are separate from this standalone server.

Authentication

When STATESET_WIDGET_AUTH_SECRET is configured, widget tokens are required unless tokenless compatibility is explicitly enabled. Analytics/reporting readers still require verified tenant identity. STATESET_THREAD_TOKEN_REQUIRED=true also denies legacy conversations without a capability. See authentication and recovery.

Chat and streaming

POST /api/chat creates a conversation when appropriate or continues the named thread. POST /api/threads/{id}/messages uses the same reply pipeline. Newly issued capabilities arrive once as threadToken in JSON or a leading SSE thread event. Preserve the returned thread and message IDs; feedback targets the server’s stored message ID. SSE frames are separated by blank lines:
A valid final [DONE] event with no error events is required for server-side completed-stream replay. A human-controlled conversation may instead return JSON with empty reply and liveChat.accepted: true, even if stream: true was requested. Continue polling that thread for operator replies; do not treat the empty acknowledgement as an AI answer.

Errors and recovery

Responses carry x-request-id. Common failures include invalid body (400), widget identity failure (401/403), thread_forbidden (403), thread/execution conflicts (409), oversized JSON or attachment (413), and rate limiting (429 with Retry-After). Error bodies can include error, type, message, requestId or route-specific detail; they do not all share a single identical shape. A stream can report an error after HTTP headers have been sent. Use a stable clientMessageId for retries. Completed responses within the 256 KiB capture limit replay for ten minutes; an uncertain outcome returns message_outcome_unknown and requires a conversation read and effect reconciliation before another action. Thread history reads remain rate-limited, including polls. Reporting defaults to fail-open; RESPONSE_OUTBOX_STRICT=true makes a configured durable reporting enqueue part of successful acknowledgement.

Routes and next steps

Chat

JSON/SSE sends, capabilities and execution conflicts.

Native operator inbox

Claims, human replies and private notes.

Public sessions

Deployment-bound issuance and loader renewal.

Site administration

Draft, publish, install, versions, rollback and MCP.
Account-specific eligibility flows are omitted. OAuth discovery and MCP use their own protocols; this operation count excludes OPTIONS preflight. Retired generic examples /analytics and /chat-widget/settings are replaced here by the implemented /api/analytics and /api/widget/settings. Custom backends may still expose their own paths.
Last modified on November 13, 2026