Skip to main content
POST
Stream chat state

Authorizations

Authorization
string
header
required

API key authentication. Send Authorization: Api-Key <YOUR_API_KEY>.

Body

application/json

Chat request. Provide input to send a new message, or omit it together with a chatId to retrieve the current thread state.

activeBranchName
string

Development branch name to run queries against. Uses the main branch if omitted.

chatId
string

Chat thread ID. If omitted, a new thread is created automatically. Should match the previously returned chatId carried on the __cutoff__ message.

images
object[]
input
string

User's message/question. If omitted, returns the current thread state for the provided chatId.

isDefaultBranch
boolean

Whether activeBranchName is the default branch. Defaults to true when not set.

messageId
string

Client-provided identifier in the format <timestamp>-message (13+ digit Unix milliseconds). Makes requests idempotent.

Pattern: ^\d{13,}-message$
sessionSettings
object

Response

Newline-delimited stream of chat message / state / error objects (served as Content-Type: application/json). Each line is a JSON object of the schema below.

content
string

Message content. Streamed incrementally for assistant messages when isDelta is true.

error
string

Present only on error lines ({ "error": "<message>" }). When set, the line carries no message fields.

graphPath
string[]

Agent graph node path, e.g. ["cube_data_analyst_agent"] or ["final"].

id
string

Unique message identifier. Sentinel values: __cutoff__ (initial marker, carries the chatId under state) and __state__ (final thread state snapshot). Absent on error lines.

isDelta
boolean

Whether this is an incremental update to a previously sent message with the same id.

isInProcess
boolean

Whether the message is still being generated.

role
enum<string>
Available options:
user,
assistant
sort
number

Message ordering sequence.

state
object

Streaming state. Carries { isStreaming, chatId } on the __cutoff__ message and { messages: [...] } on the __state__ message.

thinking
string

Agent's internal reasoning. Only present in development mode.

toolCall
object

Present when the message represents a tool invocation or its result.