All Products
Search
Document Center

Alibaba Cloud Model Studio:ListPromptTemplates

Last Updated:Dec 23, 2025

Obtains a list of prompt templates.

Debugging

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • For mandatory resource types, indicate with a prefix of * .
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
sfm:ListPromptTemplateslist
*All Resources
*
    none
none

Request syntax

GET /{workspaceId}/promptTemplates HTTP/1.1

Request parameters

ParameterTypeRequiredDescriptionExample
workspaceIdstringYes

The workspace ID.

llm-us9hjmt32nysdxxx
namestringNo

The keyword that is used to search for templates.

typestringNo

The type of the template. Valid values: · System · Custom

System
maxResultsintegerNo

The maximum number of returned entries.

10
nextTokenstringNo

The token that determines the start position of the query. Set this parameter to the value of the NextToken parameter that is returned from the last call.

dc270401186b433f975d7e1faaa34e0e

Response parameters

ParameterTypeDescriptionExample
object

Schema of Response

maxResultsinteger

The maximum number of returned entries.

10
nextTokenstring

The token that determines the start position of the next query.

dc270401186b433f975d7e1faaa34e0e
promptTemplatesarray<object>

The templates.

PromptTemplatesobject
contentstring

The template content

namestring

The template name.

promptTemplateIdstring

The template ID.

d6935b7efbe34d11b13df9307151cf8c
typestring

The template type.

"System"
variablesarray

The variables of the template.

Variablesstring

The template variable.

"theme"
requestIdstring

The request ID.

FE9B6CBF-47E6-5D76-9C5D-B814DD5AB071
totalCountinteger

The total number of entries returned.

15
workspaceIdstring

The workspace ID.

llm-us9hjmt32nysdxxx

Examples

Sample success responses

JSONformat

{
  "maxResults": 10,
  "nextToken": "dc270401186b433f975d7e1faaa34e0e",
  "promptTemplates": [
    {
      "content": "",
      "name": "",
      "promptTemplateId": "d6935b7efbe34d11b13df9307151cf8c",
      "type": "System",
      "variables": [
        "theme"
      ]
    }
  ],
  "requestId": "FE9B6CBF-47E6-5D76-9C5D-B814DD5AB071",
  "totalCount": 15,
  "workspaceId": "llm-us9hjmt32nysdxxx\n"
}

Error codes

HTTP status codeError codeError messageDescription
400PromptTemplate.MaxResultsInvalidInput parameter MaxResults is invalid.The input parameter maxResults format is invalid.
400PromptTemplate.NameInvalidInput parameter Name is invalid.The format of the input parameter Name is invalid.
400PromptTemplate.NextTokenInvalidInput parameter NextToken is invalid.The input nextToken is invalid.
400PromptTemplate.TypeInvalidInput parameter type is invalid.input type format is invalid
500PromptTemplate.InternalErrorPrompt template service inner exception.prompt template service internal exception

For a list of error codes, visit the Service error codes.