Help Center/ ModelArts/ API Reference/ Model Inference/ Service Tag Management/ Querying Tags of a Type of Resources
Updated on 2026-07-24 GMT+08:00

Querying Tags of a Type of Resources

Function

This API is used to obtain tags of a type of resources (for example, a specified service) in the current project. For example, in resource management and monitoring, you can query tags to learn about the classification and attributes of each type of resources. By calling this API, you can obtain the tag list of a specified service in all workspaces. The workspace tag data that you do not have the permission to obtain is filtered out and not returned. You must have sufficient permissions and the target resource must exist. After the query is successful, the tag list of the specified service is returned. If the query fails, error information is returned. Common exceptions include permission verification errors, resource non-existence errors, and parameter verification errors.

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::listTags

    List

    -

    -

    modelarts:tag:list

    -

URI

GET /v2/{project_id}/modelarts-service-v2/tags

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

Project ID.

Default Value

N/A

Table 2 Query Parameters

Parameter

Mandatory

Type

Description

workspace_id

No

String

Definition

Workspace ID. workspaceId will be set to null.

Constraints

N/A

Range

N/A

Default Value

N/A

Request Parameters

Table 3 Request header parameters

Parameter

Mandatory

Type

Description

Content-Type

Yes

String

Definition

Message body type or format.

Constraints

N/A

Range

  • application/json

  • application/json;charset=utf-8

Default Value

N/A

X-Auth-Token

Yes

String

Definition

User token. It can be obtained by calling the IAM API used to obtain a user token. The value of X-Subject-Token in the response header is the user token. For details about how to obtain the token, see Obtaining a User Token Through Password Authentication.

Constraints

N/A

Range

N/A

Default Value

N/A

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

tags

Array of CombineTmsTags objects

Definition

Data structure of merged tags with the same key.

Table 5 CombineTmsTags

Parameter

Type

Description

key

String

Definition

Tag key.

Range

N/A

values

Array of strings

Definition

Merged tag values with the same key.

Range

N/A

Status code: 400

Table 6 Response body parameters

Parameter

Type

Description

error_code

String

  • Definition: ModelArts error code.

Range: N/A.

error_msg

String

Definition: Error message.

Range: N/A.

Status code: 401

Table 7 Response body parameters

Parameter

Type

Description

error_code

String

  • Definition: ModelArts error code.

Range: N/A.

error_msg

String

Definition: Error message.

Range: N/A.

Status code: 403

Table 8 Response body parameters

Parameter

Type

Description

error_code

String

  • Definition: ModelArts error code.

Range: N/A.

error_msg

String

Definition: Error message.

Range: N/A.

Example Requests

This API is used to query tags of a type of resources.

https://{endpoint}/v2/{project_id}/modelarts-service-v2/tags

Example Responses

Status code: 200

All tags of the specified resource type in the project are returned.

{
  "tags" : [ {
    "key" : "model_version",
    "values" : [ "0.1", "0.2" ]
  }, {
    "key" : "conda_version",
    "values" : [ "10.2", "11.0" ]
  } ]
}

Status Codes

Status Code

Description

200

All tags of the specified resource type in the project are returned.

400

Invalid parameter.

401

Authentication failed.

403

Insufficient permissions.

Error Codes

See Error Codes.