全部产品
Search
文档中心

资源管理:ListTagResources - 查询资源标签列表

更新时间:Aug 28, 2026

查询多个云产品的多个云资源绑定的标签列表。

接口说明

支持标签的云服务,请参见支持标签的云服务

调试

您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。

调试

授权信息

下表是API对应的授权信息,可以在RAM权限策略语句的Action元素中使用,用来给RAM用户或RAM角色授予调用此API的权限。具体说明如下:

  • 操作:是指具体的权限点。

  • 访问级别:是指每个操作的访问级别,取值为写入(Write)、读取(Read)或列出(List)。

  • 资源类型:是指操作中支持授权的资源类型。具体说明如下:

    • 对于必选的资源类型,用前面加 * 表示。

    • 对于不支持资源级授权的操作,用全部资源表示。

  • 条件关键字:是指云产品自身定义的条件关键字。

  • 关联操作:是指成功执行操作所需要的其他权限。操作者必须同时具备关联操作的权限,操作才能成功。

操作

访问级别

资源类型

条件关键字

关联操作

tag:ListTagResources

get

*全部资源

*

请求参数

名称

类型

必填

描述

示例值

RegionId

string

地域 ID。取值:

cn-hangzhou

NextToken

string

下一个查询开始的 Token。

caeba0bbb2be03f84eb48b699f0a****

PageSize

integer

分页时每页显示的数据行数。

最大值:1000。默认值:50。

50

Tags

string

标签键和标签值,键值对取值范围:1~10。

如果指定多个标签,则会查询同时绑定了该多个标签的资源。

约束如下:

  • 标签键取值范围:1~128 个字符。

  • 标签值取值范围:1~128 个字符。

  • 区分大小写。

  • 同一个资源上的同一个标签键只能对应一个标签值。如果您尝试添加已有标签键,则对应的标签值会更新为新值。

{"k1":"v1","k2":"v2"}

Category

string

标签类型。取值:

  • Custom:自定义标签。

  • System:系统标签。

  • All:全部标签。

默认值:All。

Custom

ResourceARN

array

资源 ARN(Aliyun Resource Name)。

N 的取值范围:1~50。

资源 ARN 的格式:arn:acs:${ProductCode}:${Region}:${Account}:${ResourceType}/${ResourceId}。各字段含义如下:

  • ProductCode:云服务 code。从 ListSupportResourceTypes 返回参数中获取。

  • Region:资源所属的地域 ID。支持使用星号(*)表示当前地域。

  • Account:资源所属的阿里云账号(主账号)ID。支持使用星号(*)表示当前登录的阿里云账号(主账号)。

  • ResourceType:资源类型。从 ListSupportResourceTypes 返回参数中获取。

  • ResourceId:资源 ID。

说明

ResourceARN 支持传递资源组、操作审计和资源管理的ProductCodeResourceType

arn:acs:ecs:cn-hangzhou:123456789****:instance/i-bp15hr53jws84akg****

string

资源 ARN(Aliyun Resource Name)。

arn:acs:ecs:cn-hangzhou:123456789****:instance/i-bp15hr53jws84akg****

返回参数

名称

类型

描述

示例值

object

返回参数。

NextToken

string

根据NextToken判断是否具备下一个查询开始的 Token。取值:

  • 如果NextToken为空,即"NextToken": "",表示没有下一个。

  • 如果NextToken有值,则该值就是下一个查询开始的 Token。

caeba0bbb2be03f84eb48b699f0a****

RequestId

string

请求 ID。

014738E0-3C7F-47D8-8FB9-469500C6F387

TagResources

array<object>

资源绑定的标签信息。

array<object>

资源绑定的标签信息。

ResourceARN

string

资源 ARN。

arn:acs:ecs:cn-hangzhou:123456789****:instance/i-bp15hr53jws84akg****

Tags

array<object>

标签信息。

object

标签信息。

Key

string

标签键。

k1

Value

string

标签值。

v1

Category

string

标签类型。取值:

  • Custom:自定义标签。

  • System:系统标签。

Custom

示例

正常返回示例

JSON格式

{
  "NextToken": "caeba0bbb2be03f84eb48b699f0a****",
  "RequestId": "014738E0-3C7F-47D8-8FB9-469500C6F387",
  "TagResources": [
    {
      "ResourceARN": "arn:acs:ecs:cn-hangzhou:123456789****:instance/i-bp15hr53jws84akg****",
      "Tags": [
        {
          "Key": "k1",
          "Value": "v1",
          "Category": "Custom"
        }
      ]
    }
  ]
}

错误码

HTTP status code

错误码

错误信息

描述

400 InvalidResourceARN.Account The Account specified in the ResourceARN parameter does not match the actual account, specifically: %s. ResourceARN中的Account与实际用户不吻合,分别是:%s
400 InvalidResourceARN.FormatError The format of parameter ResourceARN: %s is not valid, for the correct format, you can refer to the Recommend. ResourceARN的格式不符合规范,正确的格式请参考错误诊断。
400 InvalidResourceARN.Region The Region specified in the ResourceARN parameter does not match the RegionId parameter, specifically: %s. ResourceARN中的Region与参数RegionId不匹配,它们分别是:%s
400 InvalidParameter.TagKey The TagKey parameter is invalid. The following TagKeys are invalid: %s. 参数中存在不合法的标签键,不合法的标签键如下:%s
400 InvalidParameter.Tags The Tags parameter cannot be empty, and JSON parsing should adhere to the format of a Map.
400 InvalidParameter.RegionId %s. 地域参数不合法。
400 Throttling You have exceeded the maximum traffic. To increase the limit, submit a ticket. 你的请求量太大,被流控。请降低请求频率后重试。
403 Duplicate.TagKey The Tag.N.Key contains duplicate keys. 参数包含重复标签键。
403 InvalidParameter.Category The specified Category is invalid. Valid values are Custom and System. 标签类型非法,合法值为Custom,System。
403 MissingParameter.ResourceIds You must specify ResourceIds. 资源列表参数不可为空。
403 NoPermission.Operator The user is not authorized to operate on the specified resource. 该用户没有权限操作。
403 NoPermission.SystemTag The user does not have permission to operate the system tag. 该用户没有权限操作此系统标签。
403 NoPermissionKey.Category Some keys cannot be modified because the user does not have permission. 某些key的标签类型没有操作权限。
403 NoPermissionKey.Operator You are not authorized to operate the tag key. 该用户没有操作此标签键权限。
403 NumberExceed.ResourceIds The maximum number of ResourceIds is exceeded. 资源列表参数数量超限。
403 NumberExceed.Tags The maximum number of Tags is exceeded. 标签参数数量超限。
403 QuotaExceed.TagsPerResource The maximum number of tags for each resource is exceeded. 每个资源上的标签数量有限制,目前有资源已经超限。
403 Invalid.NextToken The parameter NextToken is invalid. NextToken参数非法。
403 InvalidParameter.TagValue The Tag.N.Value parameter is invalid. 标签值参数非法。
403 InvalidParameter.ResourceType The ResourceType parameter is invalid. 资源类型参数非法。
404 Missing.TagKey Tag.N.Value has been specified and you must specify Tag.N.Key. 一对键值对,对应的TagValue缺失相同N的TagKey。
404 MissingParameter.AliUid You must specify AliUid. 缺失用户UID参数。
404 MissingParameter.Bid You must specify Bid. bid参数不可为空。
404 MissingParameter.RegionId You must specify RegionId. 缺少RegionId参数。
404 MissingParameter.RemoveNum You must specify RemoveNum. 删除数量参数缺失。
404 MissingParameter.ResourceIdARN You must specify ResourceIdARN. 缺少ResourceIdARN参数。
404 MissingParameter.TagKey You must specify TagKey. 标签键参数不可为空。
404 MissingParameter.Tags You must specify Tags. 缺少参数Tags。
404 NoMatch.RemoveNum The specified DataNum does not match the deleted number. 删除数量参数不匹配。

访问错误中心查看更多错误码。

变更历史

更多信息,参考变更详情