Create AI chat

Sends a question to the AI in the specified conversation.

Required Permissions

Available to any authenticated user. You can only send questions to conversations you created.

HTTP Request

POST /api/sonar/ai/conversations/:guid/chats
cURL Example
curl -H "Authorization: Bearer <API_KEY>" \
     -d question="Show me the recent login failure records." \
     -X POST \
     https://HOSTNAME/api/sonar/ai/conversations/a1b2c3d4-e5f6-7890-abcd-ef1234567890/chats
Request Parameters
Path Parameters
KeyTypeDescriptionNotes
guidStringConversation identifier36-character GUID
Request Body Parameters
KeyRequiredTypeDescriptionNote
questionYesStringQuestion content
modeNoStringConversation mode

Success Response

{
  "guid": "b2c3d4e5-f6a7-8901-bcde-f12345678901"
}
  • guid (String): GUID of the created chat message

Error Responses

Required argument is missing

HTTP status code 400

{
  "error_code": "null-argument",
  "error_msg": "question should be not null"
}
guid is not a valid GUID

HTTP status code 400

{
  "error_code": "invalid-param-type",
  "error_msg": "guid should be guid type."
}
The question is empty

HTTP status code 400

{
  "error_code": "invalid-argument",
  "error_msg": "question must exist"
}
Conversation does not exist or the requester is not the owner

HTTP status code 500

{
  "error_code": "illegal-state",
  "error_msg": "conversation not found: a1b2c3d4-e5f6-7890-abcd-ef1234567890"
}