GetPromptTemplate - Get a prompt template
Retrieves a prompt template by template ID.
Try it out
You can call this operation in OpenAPI Explorer without calculating a signature. After a successful call, OpenAPI Explorer can automatically generate SDK code examples.
Authorization information
The following table describes the authorization information for this API operation. You can use this information in the Action element of a RAM policy statement to grant a RAM user or RAM role permission to call the operation. The columns are described as follows:
-
Action: a specific permission.
-
Access level: the access level of an action. Valid values: Write, Read, and List.
-
Resource type: the types of resources for which the action supports authorization:
- Required resource types are marked with an asterisk (*).
- Actions that do not support resource-level authorization use
All resources.
-
Condition key: a condition key defined by the cloud service.
-
Dependent action: an additional permission required to perform the action. The caller must also have permission to perform the dependent action.
| Action | Access level | Resource type | Condition key | Dependent action |
|---|---|---|---|---|
| sfm:GetPromptTemplate | get | *All resources * |
| None |
Endpoint
/{workspaceId}/promptTemplates/{promptTemplateId}Path parameters
workspaceIdstringRequiredThe workspace ID.
promptTemplateIdstringRequiredThe template ID.
Response fields
Schema of Response
contentstringThe template content.
namestringThe template name.
promptTemplateIdstringThe template ID.
requestIdstringThe request ID.
workspaceIdstringThe workspace ID.
variablesarrayThe list of template variables.
VariablesstringA template variable.
Response example
Sample success response
JSON format
{
"content": "请写一篇小红书种草笔记,增加丰富的emoji元素,结尾作总结,并加上相关标签。主题为:${theme}",
"name": "小红书文案助手",
"promptTemplateId": "6e49109bfeb94a39bb268f4e483ccxxx",
"requestId": "8C56C7AF-6573-19CE-B018-E05E1EDCF4C5",
"workspaceId": "llm-xxxxxxxxxxxx",
"variables": [
"theme"
]
}
Error codes
| HTTP status code | Error code | Error message | Description |
|---|---|---|---|
| 404 | PromptTemplate.TemplateNotFound | Prompt template not found. | The prompt template was not found. |
| 500 | PromptTemplate.InternalError | Prompt template service inner exception. | An internal error occurred in the prompt template service. |
For more error codes, see Error Center.