All Products
Search
Document Center

Resource Management:ListTagResources

Last Updated:Aug 28, 2026

Queries the tags bound to multiple cloud resources across multiple cloud services.

Operation description

For cloud services that support tags, see Cloud services that support tags.

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

tag:ListTagResources

get

*All Resource

*

None None

Request parameters

Parameter

Type

Required

Description

Example

RegionId

string

Yes

The region ID. Valid values:

cn-hangzhou

RegionId

string

Yes

The token for the next query.

cn-hangzhou

NextToken

string

No

The number of entries per page.

Maximum value: 1000. Default value: 50.

caeba0bbb2be03f84eb48b699f0a****

PageSize

integer

No

The tag keys and tag values. You can specify 1 to 10 key-value pairs.

If you specify multiple tags, the system queries resources that are bound to all the specified tags.

Limits:

  • A tag key must be 1 to 128 characters in length.

  • A tag value must be 1 to 128 characters in length.

  • Tag keys and tag values are case-sensitive.

  • Each tag key on a resource can have only one tag value. If you add a tag that has the same key as an existing tag, the new tag value overwrites the existing tag value.

50

Tags

string

No

The tag type. Valid values:

  • Custom: custom tag.

  • System: system tag.

  • All: all tags.

Default value: All.

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

Category

string

No

The Alibaba Cloud Resource Name (ARN) of the resource.

Valid values of N: 1 to 50.

The resource ARN format: arn:acs:${ProductCode}:${Region}:${Account}:${ResourceType}/${ResourceId}. The following list describes the fields:

  • ProductCode: the cloud service code. You can obtain the value from the response of ListSupportResourceTypes.

  • Region: the region ID of the resource. You can use an asterisk (*) to indicate the current region.

  • Account: the Alibaba Cloud account ID. You can use an asterisk (*) to indicate the current Alibaba Cloud account.

  • ResourceType: the resource type. You can obtain the value from the response of ListSupportResourceTypes.

  • ResourceId: the resource ID.

Note

ResourceARN supports the ProductCode and ResourceType values of Resource Group, ActionTrail, and Resource Management.

Custom

ResourceARN

array

No

The Alibaba Cloud Resource Name (ARN) of a resource.

Valid values of N: 1 to 50.

ARN format: arn:acs:${ProductCode}:${Region}:${Account}:${ResourceType}/${ResourceId} Fields:

  • ProductCode: the service code. You can set this field to a value obtained from the response of the ListSupportResourceTypes operation.

  • Region: the region ID of the resource. You can set this field to an asterisk (*) to indicate the current region.

  • Account: the ID of the Alibaba Cloud account to which the resource belongs. You can set this field to an asterisk (*) to indicate the current Alibaba Cloud account.

  • ResourceType: the resource type. You can set this field to a value obtained from the response of the ListSupportResourceTypes operation.

  • ResourceId: the ID of the resource.

Note

You can set ProductCode and ResourceType in ResourceARN to values defined in Resource Group, ActionTrail, or Resource Center.

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

string

No

The ARN of the resource.

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

For more information about common request parameters, see Common parameters.

Response elements

Element

Type

Description

Example

object

The response parameters.

NextToken

string

Indicates whether a next token exists. Valid values:

  • If NextToken is empty ("NextToken": ""), no next page exists.

  • If NextToken has a value, the value is the token for the next query.

caeba0bbb2be03f84eb48b699f0a****

RequestId

string

The request ID.

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

TagResources

array<object>

The tags bound to the resources.

array<object>

The tags bound to the resources.

ResourceARN

string

The resource ARN.

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

Tags

array<object>

The tag information.

object

The tag information.

Key

string

The tag key.

k1

Value

string

The tag value.

v1

Category

string

The type of the tag. Valid values:

  • Custom

  • System

Custom

Examples

Success response

JSON format

{
  "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"
        }
      ]
    }
  ]
}

Error codes

HTTP status code

Error code

Error message

Description

400 InvalidResourceARN.Account The Account specified in the ResourceARN parameter does not match the actual account, specifically: %s. The Account in the ResourceARN do not match the actual user, namely: %s
400 InvalidResourceARN.FormatError The format of parameter ResourceARN: %s is not valid, for the correct format, you can refer to the Recommend. The ResourceARN format does not conform to the specification. For the correct format, please refer
400 InvalidResourceARN.Region The Region specified in the ResourceARN parameter does not match the RegionId parameter, specifically: %s. The Region in the ResourceARN does not match the parameter RegionId. They are: %s
400 InvalidParameter.TagKey The TagKey parameter is invalid. The following TagKeys are invalid: %s. Illegal tag keys exist in the parameter. Illegal tag keys are as follows: %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. The region parameter is illegal.
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. The Tag.N.Key contains duplicate keys.
403 InvalidParameter.Category The specified Category is invalid. Valid values are Custom and System. The specified Category is invalid. Valid values are Custom and System.
403 MissingParameter.ResourceIds You must specify ResourceIds. You must specify ResourceIds.
403 NoPermission.Operator The user is not authorized to operate on the specified resource. 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. 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. Some keys cannot be modified because the user does not have permission.
403 NoPermissionKey.Operator You are not authorized to operate the tag key. You are not authorized to operate the tag key.
403 NumberExceed.ResourceIds The maximum number of ResourceIds is exceeded. The maximum number of ResourceIds is exceeded.
403 NumberExceed.Tags The maximum number of Tags is exceeded. The maximum number of Tags is exceeded.
403 QuotaExceed.TagsPerResource The maximum number of tags for each resource is exceeded. The maximum number of tags for each resource is exceeded.
403 Invalid.NextToken The parameter NextToken is invalid. The parameter NextToken is invalid.
403 InvalidParameter.TagValue The Tag.N.Value parameter is invalid. The Tag.N.Value parameter is invalid.
403 InvalidParameter.ResourceType The ResourceType parameter is invalid. The ResourceType parameter is invalid.
404 Missing.TagKey Tag.N.Value has been specified and you must specify Tag.N.Key. Tag.N.Value has been specified and you must specify Tag.N.Key.
404 MissingParameter.AliUid You must specify AliUid. You must specify AliUid.
404 MissingParameter.Bid You must specify Bid. You must specify Bid.
404 MissingParameter.RegionId You must specify RegionId. You must specify RegionId.
404 MissingParameter.RemoveNum You must specify RemoveNum. You must specify RemoveNum.
404 MissingParameter.ResourceIdARN You must specify ResourceIdARN. You must specify ResourceIdARN.
404 MissingParameter.TagKey You must specify TagKey. You must specify TagKey.
404 MissingParameter.Tags You must specify Tags. You must specify Tags.
404 NoMatch.RemoveNum The specified DataNum does not match the deleted number. The specified DataNum does not match the deleted number.

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.