Skip to content

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.


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.

{
"message": "Summarize the top competitor moves from last week.",
"agentId": "550e8400-e29b-41d4-a716-446655440000"
}
FieldRequiredDescription
messageYesThe message text to send
agentIdNoTarget a specific agent by ID. If omitted, the platform routes to the most relevant agent based on context.
{
"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.

ParameterTypeDescription
agentIdstringFilter history to a specific agent
sessionIdstringRetrieve history for a specific session
limitintegerMessages to return (default: 50, max: 200)
offsetintegerPagination offset
{
"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.

{
"messageId": "msg-uuid-...",
"rating": 5,
"comment": "Concise and accurate summary."
}
FieldRequiredDescription
messageIdYesID of the assistant message being rated
ratingYesInteger 1–5
commentNoOptional free-text feedback

Returns 200 OK on success.


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.