Get AI Prompt
Retrieves the details of the specified AI prompt.
Required Permissions
Requires the MEMBER role or higher.
HTTP Request
GET /api/sonar/ai/prompts/:guid
cURL Example
curl -H "Authorization: Bearer <API_KEY>" \
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 |
Success Response
{
"prompt": {
"guid": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"app_code": null,
"app_built_in": null,
"name": "qna-default",
"description": "Default Q&A prompt",
"enabled": true,
"type": "qna",
"prompt": "prompt: |\n You are a helpful assistant.\n",
"token_count": 128,
"rev": 1,
"created": "2024-09-15 14:30:00+0900",
"updated": "2024-09-15 14:30:00+0900"
}
}
- prompt (Object): AI prompt details
- guid (String): Prompt GUID
- app_code (String): Code of the app that registered the prompt (
nullif not registered by an app) - app_built_in (Boolean): Whether the prompt is built into the app (
nullif not registered by an app) - name (String): Prompt name
- description (String): Prompt description
- enabled (Boolean): Enabled state
- type (String): Prompt type (
plan,action, orqna) - prompt (String): Prompt definition in YAML format
- token_count (32-bit integer): Token count of the prompt
- rev (32-bit integer): Prompt revision number
- created (String): Creation timestamp
- updated (String): Update timestamp
Error Responses
guid is missing
HTTP status code 400
{
"error_code": "null-argument",
"error_msg": "guid 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 200
{
"prompt": null
}
Permission denied
HTTP status code 500
{
"error_code": "illegal-state",
"error_msg": "no-permission"
}