Conversations and message replies (streaming/synchronous)
Conversation and synchronous
Send a message to the AI and receive a response.
curl -X POST \
'https://api.maiagent.ai/api/v1/chatbots/{chatbot_id}/completions/' \
-H 'Authorization: Api-Key YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"conversation": "string|null",
"message": {
"content": "string",
"attachments": []
},
"is_streaming": boolean
}'
Parameters:
chatbot_id
(path parameter): chatbot IDconversation
(request body): optional conversation ID to continue a conversationmessage.content
(request body): content of the message to sendmessage.attachments
(request body): array of attachments (if any)is_streaming
(request body): whether to use streaming responses
Response (non-streaming):
{
"content": "string",
"conversationId": "string"
}
Response (streaming):
The server-sent event format is as follows:
data: {
"content": "string",
"conversation_id": "string",
"done": boolean
}
Notes:
For streaming responses, the server will send multiple events containing partial content until the response is complete
The conversation ID returned in the response can be used to continue the conversation in subsequent requests
Integration results
Last updated
Was this helpful?