CreatePromptTemplate

Updated at:

Create a prompt template.

Operation description

This API does not currently support the creation of text-to-image prompt templates.

Try it now

You can run this API directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After a successful run, OpenAPI Explorer can automatically generate SDK code examples.

Debug

RAM authorization

The following table describes the authorization information of the API. You can use the Action element in RAM policy statements to grant RAM users or RAM roles the permission to call this API. Details are as follows:

  • Operation: the specific permission point.

  • Access level: the access level of each operation. Valid values: Write, Read, or List.

  • Resource type: the resource types supported for authorization in the operation. Details are as follows:

    • For required resource types, an asterisk (*) is added before them.
    • For operations that do not support resource-level authorization, All Resources is used.
  • Condition key: the condition keys defined by the cloud service itself.

  • Dependent operation: other permissions required to successfully perform the operation. The operator must have the permissions of the dependent operations for the operation to succeed.

OperationAccess levelResource typeCondition keyDependent operation
sfm:CreatePromptTemplatecreate
*All Resources
*
    None
None

Request syntax

POST /{workspaceId}/promptTemplates HTTP/1.1

Request parameters

NameTypeRequiredDescriptionExample
workspaceIdstringYes

Workspace ID.

llm-czal8nvvwb8d4xxx
namestringYes

Template name.

Xiaohongshu Copywriting Assistant
contentstringYes

Prompt template content.

Please write a Xiaohongshu recommendation post, add rich emoji elements, summarize at the end, and add relevant tags. The theme is: ${theme}

Response parameters

NameTypeDescriptionExample
object

Schema of Response

promptTemplateIdstring

Prompt template ID.

6e49109bfeb94a39bb268f4e483ccxxx
requestIdstring

Request ID.

FE9B6CBF-47E6-5D76-9C5D-B814DD5ABxxx

Examples

Success response

JSON format

{
  "promptTemplateId": "6e49109bfeb94a39bb268f4e483ccxxx",
  "requestId": "FE9B6CBF-47E6-5D76-9C5D-B814DD5ABxxx\n"
}

Error codes

HTTP status codeError codeError messageDescription
400PromptTemplate.ContentInvalidInput parameter Content is invalid.The format of the input parameter Content is invalid.
400PromptTemplate.NameInvalidInput parameter Name is invalid.The format of the input parameter Name is invalid.
500PromptTemplate.InternalErrorPrompt template service inner exception.Internal error of the prompt template service.

Visit Error Center for more error codes.