Update AI Prompt

Updates the specified AI prompt. Built-in prompts registered by an app cannot be updated.

Required Permissions

Requires the MEMBER role or higher.

HTTP Request

PUT /api/sonar/ai/prompts/:guid
cURL Example
curl -H "Authorization: Bearer <API_KEY>" \
     -d name="qna-default" \
     -d type="qna" \
     -d description="Updated description" \
     -d prompt="prompt: |
  You are a helpful assistant.
" \
     -X PUT \
     https://HOSTNAME/api/sonar/ai/prompts/a1b2c3d4-e5f6-7890-abcd-ef1234567890
Request Parameters
Path Parameters
KeyTypeDescriptionNotes
guidStringPrompt GUID36 characters
Request Body Parameters
KeyRequiredTypeDescriptionNotes
nameYesStringPrompt name
descriptionNoStringPrompt description
typeYesStringPrompt typeOne of plan, action, qna
promptYesStringPrompt contentYAML format

Success Response

{}

Error Responses

A required parameter is missing

HTTP status code 400

{
  "error_code": "null-argument",
  "error_msg": "name 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."
}
Prompt does not exist

HTTP status code 500

{
  "error_code": "illegal-state",
  "error_msg": "prompt not found: a1b2c3d4-e5f6-7890-abcd-ef1234567890"
}
Updating a built-in prompt registered by an app

HTTP status code 500

{
  "error_code": "illegal-argument",
  "error_msg": "app builtin prompt"
}
Permission denied

HTTP status code 500

{
  "error_code": "illegal-state",
  "error_msg": "no-permission"
}