Help Center/ ModelArts/ API Reference/ Training Management/ Creating a Training Job Tag
Updated on 2026-07-24 GMT+08:00

Creating a Training Job Tag

Function

This API is used to add tags to an existing training job.

This API is used when you need to classify, mark, or manage a training job. You can add one or more tags to a specified training job using this API. If the key of the added tag already exists, the value of the tag is overwritten. Before using this API, ensure that the training job exists and you have the required permission. After the tag is added, you can view the tag information in the training job list. If the training job does not exist or you do not have the required permission, the API will return an error message.

Debugging

You can debug this API through automatic authentication in API Explorer or use the SDK sample code generated by API Explorer.

Authorization Information

Each account has all the permissions required to call all APIs, but IAM users must be assigned the required permissions.

  • If you are using role/policy-based authorization, see Permissions Policies and Supported Actions for details on the required permissions.
  • If you are using identity policy-based authorization, the following identity policy-based permissions are required.

    Action

    Access Level

    Resource Type (*: required)

    Condition Key

    Alias

    Dependencies

    modelarts:trainJob:update

    Write

    trainJob *

    g:ResourceTag/<tag-key>

    -

    -

    -

    • modelarts:poolType

    • modelarts:poolId

URI

POST /v2/{project_id}/modelarts-training-job/{training_job_id}/tags/create

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Definition: User project ID. For details, see Obtaining a Project ID and Name.

Constraints: N/A

Range: N/A

Default Value: N/A

training_job_id

Yes

String

Definition: Training job ID. For details, see Obtaining Training Jobs.

Constraints: N/A

Range: N/A

Default Value: N/A

Request Parameters

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

tags

Yes

Array of TmsTag objects

Definition: TMS tags.

Constraints: N/A

Table 3 TmsTag

Parameter

Mandatory

Type

Description

key

Yes

String

Definition: Key of a TMS tag.

Constraints: The value can contain at most 128 characters and cannot start or end with sys. Only letters, digits, spaces, and special characters (_.:=+-@) are allowed.

Range: N/A

Default Value: N/A

value

No

String

Definition: Value of a TMS tag.

Constraints: The value can contain at most 255 characters. Only letters, digits, spaces, and special characters (_.:/=+-@) are allowed.

Range: N/A

Default Value: N/A

Response Parameters

Status code: 204

Table 4 Response body parameters

Parameter

Type

Description

tags

Array of TmsTagResp objects

Definition: TMS tags.

Table 5 TmsTagResp

Parameter

Type

Description

key

String

Definition: Key of a TMS tag.

Range: N/A

value

String

Definition: Value of a TMS tag.

Range: N/A

Example Requests

Create a training job tag. The TMS tags have been configured by setting the keys to 111 and k3, and the corresponding values are set to k3 and v2.

POST    https://{endpoint}/v2/{project_id}/modelarts-training-job/{training_job_id}/tags/create

{
  "tags" : [ {
    "key" : "111",
    "value" : "v2"
  }, {
    "key" : "k3",
    "value" : "v2"
  } ]
}

Example Responses

Status code: 204

Added.

{
  "tags" : [ {
    "key" : "111",
    "value" : "v2"
  }, {
    "key" : "k3",
    "value" : "v2"
  } ]
}

Status Codes

Status Code

Description

204

Added.

Error Codes

See Error Codes.