Authentication
Bearer token for authentication
Body
Array of message objects containing the conversation history
The role of the message sender (user or assistant)
Array of content parts for the message
The type of part (text, file, etc.)
The text content (required when type is text)
The ID of the AI agent to chat with
Optional UUID for the conversation thread. If not provided, a new one will be generated
Optional UUID to link this conversation to an upstream conversation
Controls whether the response is streamed. Set to false for non-streaming responses
Response
Array of message objects containing the conversation, including the AI’s response
The role of the message sender (user or assistant)
Array of content parts for the message
The type of part (text, tool-invocation, tool-result, etc.)
The text content (when type is text)
Optional array of tool calls made by the assistant
The conversation thread ID (returned in headers)
Examples
Examples
curl -X POST https://api.example.com/chat \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-H "X-Stream-Response: false" \
-d '{
"messages": [
{
"role": "user",
"parts": [{"type": "text", "text": "Hello, how are you?"}]
}
],
"agentId": 123
}'
Error Codes
Unauthorized - Invalid or missing authentication
Not Found - Agent or organization not found
Bad Request - Invalid request body
Internal Server Error - Unexpected error occurred