Start a streaming chat session with the Greenflash AI agent.
Requires a Growth or Enterprise plan.
The response is a Server-Sent Events (SSE) stream (Content-Type: text/event-stream).
Each event follows the format:
event: <type>
data: <json>
Event types:
tool_call — The agent is invoking a tool. Data: {"step": 1, "toolName": "...", "displayName": "..."}tool_result — A tool returned its result. Data: {"step": 1, "toolName": "...", "displayName": "..."}text_delta — A chunk of the agent’s text response. Concatenate all deltas to build the full message. Data: {"text": "..."}done — The stream completed successfully. Data: {"conversationId": "...", "status": "complete", "usage": {"toolCalls": N, "tools": ["..."]}}error — An error occurred during processing. Data: {"error": "...", "code": "..."}Multi-turn conversations: Pass previous messages in the messages array and reuse the conversationId returned in the done event.
Rate limits: This endpoint is rate-limited per tenant (requests/hour) and subject to token usage limits.
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
The current user question to send to the AI agent.
1 - 4000Prior conversation history (NOT including the current question). Used for multi-turn context.
50Stable identifier for multi-turn conversations. If omitted, a new ID is generated.
128Free-form hint injected into the system prompt for this turn only.
2000Scope the chat to a specific product. If omitted, the agent can access all products.
SSE stream of chat events (text/event-stream). See endpoint description for event format.
Example SSE stream:
event: tool_call
data: {"step":1,"toolName":"getConversations","displayName":"Searching conversations"}
event: tool_call
data: {"step":2,"toolName":"getUserRanking","displayName":"Ranking users by metrics"}
event: tool_result
data: {"step":1,"toolName":"getConversations","displayName":"Searching conversations"}
event: tool_result
data: {"step":2,"toolName":"getUserRanking","displayName":"Ranking users by metrics"}
event: text_delta
data: {"text":"Based on your"}
event: text_delta
data: {"text":" conversation data, the top complaints"}
event: text_delta
data: {"text":" from enterprise customers this week are..."}
event: done
data: {"conversationId":"conv-abc-123","status":"complete","usage":{"toolCalls":2,"tools":["getConversations","getUserRanking"]}}