GetJobTemplate

Updated at:

Retrieves the details of a task template.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

paidlc:GetJobTemplate

get

*All Resource

*

None None

Request syntax

GET /api/v1/jobtemplates/{TemplateId} HTTP/1.1

Path Parameters

Parameter

Type

Required

Description

Example

TemplateId

string

Yes

The unique identifier of the task template.

tplmceolmf2****

Request parameters

Parameter

Type

Required

Description

Example

Version

string

No

The version number. If you do not specify this parameter, the default version is returned. If you specify a number, the specified version is returned. If you specify all, all versions are returned.

all

Response elements

Element

Type

Description

Example

object

The task template details.

TemplateId

string

The unique identifier of the task template.

tplmceolmf2****

TemplateName

string

The name of the task template.

job-template-example-1778047****

Description

string

The description of the task template.

job template description

Metadata

object

The custom key-value pair metadata defined by the user.

{}

UserId

string

The ID of the user who created the template.

20**************26

WorkspaceId

string

The ID of the workspace to which the template belongs.

4***9

TenantId

string

The ID of the tenant to which the template belongs.

142388383837****

DefaultVersion

integer

The default version number currently in use.

2

GmtCreateTime

string

The time when the template was created.

2026-01-08T14:17:55Z

GmtModifyTime

string

The time when the template was last modified.

2026-03-03T05:48:02Z

LastUsedTime

string

The time when the template was last used.

2026-09-03T11:30:00Z

ModifiedBy

string

The ID of the user who last modified the template.

20**************26

Versions

array<object>

The list of template version details. When a single version is queried, one element is returned. When all versions are queried, all elements are returned.

array<object>

The version details.

Version

integer

The version number.

2

Content

any

The template configuration content of this version in JSON format.

{\"WorkspaceId\":\"15****05\",\"JobType\":\"PyTorchJob\",\"UserCommand\":\"echo hello\",\"JobSpecs\":[{\"Type\":\"Worker\",\"PodCount\":1,\"Image\":\"dsw-registry-vpc.cn-hangzhou.cr.aliyuncs.com/pai/pytorch:2.8.0-gpu-py313-cu129-ubuntu22.04-3995b779-1764361782\",\"EcsSpec\":\"ecs.gn7i-c8g1.2xlarge\"}],\"ResourceType\":\"ECS\",\"_ResourcePaymentType\":\"PostPaid\",\"CredentialConfig\":{\"EnableCredentialInject\":false},\"Accessibility\":\"PRIVATE\",\"Settings\":{\"JobReservedMinutes\":0,\"Tags\":{}}}

Constraints

object

The field constraint rules. The key is a JSONPath expression, and the value is the constraint type.

{"JobSpecs[0].Image":"locked","UserCommand":"locked","JobType":"locked"}

CreatedBy

string

The ID of the user who created the version.

20**************26

GmtCreateTime

string

The time when the version was created.

2026-01-08T14:17:55Z

TotalCount

integer

The total number of versions. If a single version is queried, 1 is returned. If all versions are queried, the actual total number is returned.

100

RequestId

string

The ID of the request, which is used for diagnostics and troubleshooting.

473469C7-AA6F-4DC5-B3DB-A3DC0DE3****

Examples

Success response

JSON format

{
  "TemplateId": "tplmceolmf2****",
  "TemplateName": "job-template-example-1778047****",
  "Description": "job template description",
  "Metadata": {},
  "UserId": "20**************26",
  "WorkspaceId": "4***9",
  "TenantId": "142388383837****",
  "DefaultVersion": 2,
  "GmtCreateTime": "2026-01-08T14:17:55Z",
  "GmtModifyTime": "2026-03-03T05:48:02Z",
  "LastUsedTime": "2026-09-03T11:30:00Z",
  "ModifiedBy": "20**************26",
  "Versions": [
    {
      "Version": 2,
      "Content": "{\\\"WorkspaceId\\\":\\\"15****05\\\",\\\"JobType\\\":\\\"PyTorchJob\\\",\\\"UserCommand\\\":\\\"echo hello\\\",\\\"JobSpecs\\\":[{\\\"Type\\\":\\\"Worker\\\",\\\"PodCount\\\":1,\\\"Image\\\":\\\"dsw-registry-vpc.cn-hangzhou.cr.aliyuncs.com/pai/pytorch:2.8.0-gpu-py313-cu129-ubuntu22.04-3995b779-1764361782\\\",\\\"EcsSpec\\\":\\\"ecs.gn7i-c8g1.2xlarge\\\"}],\\\"ResourceType\\\":\\\"ECS\\\",\\\"_ResourcePaymentType\\\":\\\"PostPaid\\\",\\\"CredentialConfig\\\":{\\\"EnableCredentialInject\\\":false},\\\"Accessibility\\\":\\\"PRIVATE\\\",\\\"Settings\\\":{\\\"JobReservedMinutes\\\":0,\\\"Tags\\\":{}}}",
      "Constraints": {
        "test": "test",
        "test2": 1
      },
      "CreatedBy": "20**************26",
      "GmtCreateTime": "2026-01-08T14:17:55Z"
    }
  ],
  "TotalCount": 100,
  "RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3****"
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.