Agent Chat API
Interact with AI agent workflows through a chat interface. Create sessions, send messages with streaming responses, and manage conversation history.
Create Session
/api/agent-chat/sessionsCreate a new chat session with an AI agent workflow
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
workflowId | UUID | Yes | The AI agent workflow to chat with |
teamId | UUID | Yes | Team context |
title | string | No | Optional session title (auto-generated if omitted) |
{
"workflowId": "uuid",
"teamId": "uuid",
"title": "Customer support conversation"
}Response
{
"id": "uuid",
"workflowId": "uuid",
"title": "Customer support conversation",
"createdAt": "2026-02-17T10:00:00.000Z",
"messages": []
}List Sessions
/api/agent-chat/sessionsList chat sessions with optional search
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
teamId | UUID | Yes | Team to list sessions for |
workflowId | UUID | No | Filter by agent workflow |
search | string | No | Search session titles and messages |
page | integer | No | Page number (default: 0) |
size | integer | No | Page size (default: 20) |
Response
{
"content": [
{
"id": "uuid",
"workflowId": "uuid",
"title": "Customer support conversation",
"messageCount": 12,
"createdAt": "2026-02-17T10:00:00.000Z",
"lastMessageAt": "2026-02-17T10:15:00.000Z"
}
],
"totalElements": 8,
"totalPages": 1,
"number": 0,
"size": 20
}Get Session
/api/agent-chat/sessions/:idGet a session with its full message history
Response
{
"id": "uuid",
"workflowId": "uuid",
"title": "Customer support conversation",
"createdAt": "2026-02-17T10:00:00.000Z",
"messages": [
{
"id": "uuid",
"role": "user",
"content": "How do I reset my password?",
"createdAt": "2026-02-17T10:01:00.000Z"
},
{
"id": "uuid",
"role": "assistant",
"content": "You can reset your password by...",
"createdAt": "2026-02-17T10:01:03.000Z",
"tokenUsage": { "input": 45, "output": 128 }
}
]
}Send Message
/api/agent-chat/sessions/:id/messagesSend a message and receive a streaming AI response
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
content | string | Yes | The message text to send |
{
"content": "How do I reset my password?"
}Response (Server-Sent Events)
The response is streamed using Server-Sent Events (SSE). Each event contains a chunk of the AI agent's response:
event: message
data: {"type": "chunk", "content": "You can "}
event: message
data: {"type": "chunk", "content": "reset your password "}
event: message
data: {"type": "chunk", "content": "by visiting the settings page."}
event: message
data: {"type": "done", "tokenUsage": {"input": 45, "output": 128}}Streaming
Content-Type: text/event-stream. Use an SSE client (e.g. EventSource) or read the stream manually. The final event has type: "done" to signal completion.Update Session Title
/api/agent-chat/sessions/:idUpdate the title of a chat session
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
title | string | Yes | New session title |
{
"title": "Password reset help"
}Response
{
"id": "uuid",
"title": "Password reset help",
"updatedAt": "2026-02-17T10:20:00.000Z"
}Delete Session
/api/agent-chat/sessions/:idDelete a chat session and all its messages
Permanently removes the session and all associated messages. This action cannot be undone.
Response
{
"message": "Session deleted successfully"
}Clear Session Messages
/api/agent-chat/sessions/:id/clearClear all messages in a session while keeping the session
Removes all messages from the session but keeps the session itself intact. Useful for resetting a conversation without creating a new session.
Response
{
"message": "Session messages cleared",
"sessionId": "uuid"
}Error Codes
| Status | Meaning |
|---|---|
400 | Invalid request body or missing required fields |
403 | User does not have access to this team or session |
404 | Session or workflow not found |
422 | Workflow is not an AI agent workflow or is inactive |