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
| Key | Type | Description | Notes |
|---|---|---|---|
| guid | String | Prompt GUID | 36 characters |
Request Body Parameters
| Key | Required | Type | Description | Notes |
|---|---|---|---|---|
| name | Yes | String | Prompt name | |
| description | No | String | Prompt description | |
| type | Yes | String | Prompt type | One of plan, action, qna |
| prompt | Yes | String | Prompt content | YAML 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"
}