Chat API
The Chat API lets you send messages to agents and retrieve conversation history programmatically. Use it to build integrations, automate agent interactions, or retrieve session data for analysis.
Endpoints
Section titled “Endpoints” POST
/api/chat/message 🔒 Auth required Send a message to an agent and receive a complete response.
This endpoint routes your message to the appropriate agent and returns the full response synchronously.
Request body
Section titled “Request body”{ "message": "Summarize the top competitor moves from last week.", "agentId": "550e8400-e29b-41d4-a716-446655440000"}| Field | Required | Description |
|---|---|---|
message | Yes | The message text to send |
agentId | No | Target a specific agent by ID. If omitted, the platform routes to the most relevant agent based on context. |
Response
Section titled “Response”{ "response": "Here's a summary of key competitor moves last week:\n\n**LogiQ** announced...", "agentId": "550e8400-e29b-41d4-a716-446655440000", "agentName": "Nova", "sessionId": "7f3a2b1c-...", "inputTokens": 3840, "outputTokens": 612, "durationMs": 4210} GET
/api/chat/history 🔒 Auth required Retrieve conversation history for a session or agent.
Query parameters
Section titled “Query parameters”| Parameter | Type | Description |
|---|---|---|
agentId | string | Filter history to a specific agent |
sessionId | string | Retrieve history for a specific session |
limit | integer | Messages to return (default: 50, max: 200) |
offset | integer | Pagination offset |
Response
Section titled “Response”{ "data": [ { "id": "msg-uuid-...", "role": "assistant", "content": "Here's a summary...", "agentId": "550e8400-...", "agentName": "Nova", "inputTokens": 3840, "outputTokens": 612, "createdAt": "2026-03-17T10:00:04Z" }, { "id": "msg-uuid-...", "role": "user", "content": "Summarize the top competitor moves from last week.", "createdAt": "2026-03-17T10:00:00Z" } ], "pagination": { "total": 47, "limit": 50, "offset": 0, "hasMore": false }} POST
/api/chat/feedback 🔒 Auth required Submit a satisfaction rating for an agent response.
Request body
Section titled “Request body”{ "messageId": "msg-uuid-...", "rating": 5, "comment": "Concise and accurate summary."}| Field | Required | Description |
|---|---|---|
messageId | Yes | ID of the assistant message being rated |
rating | Yes | Integer 1–5 |
comment | No | Optional free-text feedback |
Returns 200 OK on success.
WebSocket streaming
Section titled “WebSocket streaming”For real-time streaming, connect via WebSocket:
wss://api.agenfleet.ai/api/chat/ws?token=<jwt>Once connected, send a message frame:
{ "message": "What's the status of the Q1 campaign?", "agentId": "550e8400-e29b-41d4-a716-446655440000"}The server streams response chunks as they are generated, then sends a final frame with token counts and metadata.