Skip to main content

Stream persisted canonical message and turn replacements using SSE

GET 

/api/v2/chat-sessions/:session_id/turns/:turn_id/events

Persisted message.updated and turn.updated replacements are replayed in ordinal order. Event IDs are opaque UUIDs, not sortable cursors. Send the last processed ID in Last-Event-ID, or use after as a query fallback. A cursor not found in this turn returns HTTP 410 before streaming; a malformed UUID returns HTTP 400. The server does not emit stream.reset.

Private document turns can also emit docx.operation notifications containing document text. The authenticated pending-operation queue, not SSE delivery, determines which operations still need to be applied.

The default heartbeat is an SSE comment every 15 seconds while idle. Polling for committed events defaults to 0.25 seconds. These intervals are configurable. After a complete, failed, or cancelled turn, the stream drains remaining persisted events and closes. The terminal turn.updated contains the authoritative full turn. Clients must clear the loading state from it and recover via session GET if disconnected. Active delivery is independent of client connection lifetime. No enforced event-retention expiry or terminal-stream TTL is currently implemented.

Request​

Responses​

Open SSE stream. data is one JSON object matching the schema named by the SSE event field. Intermediaries must not buffer or transform it.

Response Headers
    X-Contract-Version

    Version of the gaius-api-contracts release the backend runs (legalgpt-contracts), sent on every response. Clients compare it with the @legalgpt/contracts version they were built with; both packages share one version per contract.

    Cache-Control

    Prevents storage and intermediary transformation of the event stream.

    X-Accel-Buffering

    Deployment-specific hint used by nginx to disable response buffering.

    Content-Language

    Language selected for outgoing generic tool-status labels and known HTTP/timeline error text. HTTP reason-phrase titles remain language-neutral.