Skip to main content
POST
Stream Chat with Lexi
This endpoint consumes AI credits (typically 1 - 5 credits per request depending on tool usage). If the workspace balance is insufficient, the API returns 402 insufficient_credits immediately, before any events are streamed.

Request

This is the streaming counterpart to POST /v1/lexi/chat. The response is a text/event-stream that emits incremental events as Lexi reasons through the prompt and uses tools. Because the request is a POST, you must use a fetch-based SSE client - the browser’s EventSource only supports GET.

Headers

string
Optional UUID to deduplicate retries within 24 hours. Credits are charged only on the first successful stream.

Body Parameters

string
required
User message to send to Lexi. Maximum 12,000 characters.
string
Optional conversation UUID. When omitted, a new conversation is created and its ID is emitted in the first text event’s conversation_id metadata.
object
Optional page / entity context: contact_id, deal_id, matter_id, company_id, page.
boolean
default:"true"
When false, Lexi will not invoke any CRM tools and will respond purely from the conversation context.

Event Types

The stream terminates with the literal line data: [DONE] followed by a newline, consistent with the OpenAI SSE convention.

Response Format

Responses include X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, and X-Request-ID headers on the initial HTTP response.

Errors

Errors surface as a single event: error in the SSE stream when they occur after the HTTP headers have been sent, with the same code / message payload as JSON responses. Clients should therefore handle both HTTP-level and in-stream error events.