Skip to main content

Endpoint

Same as the Chat endpoint, but returns a streaming text response for progressive rendering. The widget uses this endpoint by default.

Authentication

Requires your publishable widget key in the Authorization header:

Request Body

The request body is identical to the Chat endpoint. All the same fields are accepted: message, user_id, user_token, session_id, company_id, context, custom_fields, conversation_history, behavior_context, and mode.

Response

The response is a chunked text/plain; charset=utf-8 stream. Read it like a regular ReadableStream and append chunks as they arrive. The full text accumulates over the stream. Action payloads (highlights, ticket creation, etc.) are interleaved in the stream as records framed by the ASCII record-separator character (\x1E):
If you only need the assistant’s text, strip any substring matching \x1E__ACTION(S)?__...\x1E from each chunk before rendering. The widget SDK does this for you.

Response Headers

The stream response includes metadata in custom headers: Transcripts are stored asynchronously after the stream completes.

Example

When to Use Streaming vs Non-Streaming