Help Center/ ModelArts/ API Reference/ Model Training/ Training Job Management (New Version)/ Obtaining the Training Job Resource List (Filtering by Tag)
Updated on 2026-09-01 GMT+08:00

Obtaining the Training Job Resource List (Filtering by Tag)

Function

This API is used to obtain the list of training job resources in a project based on criteria such as tags and resource names, and return the tag information of each job.

This API applies to the following scenario: When you need to filter training jobs by tag or resource name for resource classification management or batch operations, you can use this API to obtain the list of job resources that meet the filter criteria. Before using this API, ensure that you have the permission to view tags. After the query is complete, the platform returns the list and total number of job resources that meet the filter criteria. If the tag format is invalid, the tag key is duplicate, or you do not have the required permissions, an error message is returned.

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, no identity policy-based permission required for calling this API.

URI

POST /v2/{project_id}/modelarts-training-job/resource-instances/filter

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

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

Constraints: N/A

Range: The value can contain 1 to 64 characters. Only letters, digits, and hyphens (-) are allowed.

Default Value: N/A

Table 2 Query Parameters

Parameter

Mandatory

Type

Description

limit

No

Integer

Definition: Number of resources returned on each page.

Constraints: N/A

Range: 1 to 1000.

Default Value: 1000

offset

No

Integer

Definition: Offset of pagination query.

Constraints: N/A

Range: greater than or equal to 0

Default Value: 0

Request Parameters

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

workspace_id

No

String

Definition: Workspace ID. If no workspace is created, the default value is 0. If a workspace has been created and used, use the actual value.

Constraints: N/A

Range: N/A

Default Value: 0

tags

No

Array of MutiValueTag objects

Definition: Tag filter criteria. Jobs are filtered by tag key-value pair. Multiple values under the same key are in the OR relationship, and different keys are in the AND relationship.

Constraints: The values under the same key must be unique, and different keys must be unique.

Range: N/A

without_any_tag

No

Boolean

Definition: Specifies whether to obtain jobs that have no tags.

Constraints: If this parameter is set to true, the tag filter criteria are ignored.

Range:

  • true: Only jobs without tags are obtained.

  • false: Filter jobs by tags.

Default Value: false

matches

No

Array of Match objects

Definition: Resource name.

Constraints: Only one matching item is supported, and the key must be resource_name.

Range: N/A

Table 4 MutiValueTag

Parameter

Mandatory

Type

Description

key

No

String

Definition: Tag key.

Range: 1 to 128 characters. Only letters, digits, and special characters (_.:=+-@) are allowed. The value cannot start with sys.

values

No

Array of strings

Definition: List of values for the key. The relationship between multiple values is OR.

Constraints: The values under the same key must be unique. A maximum of 10 values are allowed.

Range: 0 to 255 characters. Only letters, digits, and special characters (_.:/=+-@) are allowed.

Table 5 Match

Parameter

Mandatory

Type

Description

key

No

String

Definition: Search field name.

Range: resource_name.

value

No

String

Definition: Search keyword. Fuzzy match by resource name is supported.

Range: 1 to 255 characters.

Response Parameters

Status code: 200

Table 6 Response body parameters

Parameter

Type

Description

resources

Array of ResourceInstance objects

Definition: List of training job resources that meet the search criteria.

Range: N/A

total_count

Integer

Definition: Total number of training jobs that meet the search criteria.

Range: N/A

Table 7 ResourceInstance

Parameter

Type

Description

resource_detail

Object

Definition: Resource details. Currently, this parameter is left blank.

Range: N/A

workspace_id

String

Definition: Workspace ID.

Range: N/A

resource_id

String

Definition: Training job ID.

Range: N/A

resource_name

String

Definition: Training job name.

Range: N/A

tags

Array of TmsTagResp objects

Definition: List of tags of the training job. If a job has no tag, an empty array is returned.

Range: N/A

Table 8 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

  • Obtain the resource list of training jobs whose tag key is test and value is 1122 in the project.

    POST https://{endpoint}/v2/{project_id}/modelarts-training-job/resource-instances/filter?limit=10&offset=0
    
    {
      "tags" : [ {
        "key" : "test",
        "values" : [ "1122" ]
      } ]
    }
  • {
      "without_any_tag" : true
    }

Example Responses

Status code: 200

Query succeeded.

{
  "resources" : [ {
    "resource_detail" : { },
    "workspace_id" : "0",
    "resource_id" : "3faf5c03-aaa1-4cbe-879d-24b05d997347",
    "resource_name" : "trainjob--py14-108",
    "tags" : [ {
      "key" : "test",
      "value" : "1122"
    }, {
      "key" : "k2",
      "value" : "v2"
    } ]
  } ],
  "total_count" : 1
}

Status Codes

Status Code

Description

200

Query succeeded.

Error Codes

See Error Codes.