All Products
Search
Document Center

API Gateway:ListTagResources

Last Updated:Jul 31, 2025

Queries the visible resource tags.

Operation description

  • The Tag.N.Key and Tag.N.Value parameters constitute a key-value pair.
  • ResourceId.N must meet all the key-value pairs that are entered. If you enter multiple key-value pairs, resources that contain the specified key-value pairs are returned.
  • This operation is used to query resource tags based on conditions. If no relationship matches the conditions, an empty list is returned.
  • You can query both user tags and visible system tags.
  • In addition to the required parameters, you can also specify ResourceId.N to query the visible resource tags of a specified resource in a region.
  • You can also specify Tag.N.Key to query the visible keys of a specified key in a region.
  • At least one of ResourceId.N, Tag.N.Key, and Tag.N.Value exists.
  • You can query tags of the same type or different types in a single operation.
  • You can query all your user types and visible system tags.

Debugging

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • For mandatory resource types, indicate with a prefix of * .
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
apigateway:ListTagResourcesget
*ApiGroup
acs:apigateway:{#regionId}:{#accountId}:apigroup/{#ResourceId}
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
ResourceTypestringYes

The type of the resource.

Currently, tags are supported for API groups, plug-ins, and apps. Operations performed on APIs are based on the tags of API groups.

  • apiGroup
  • plugin
  • app
  • api
apiGroup
NextTokenstringNo

The token used to start the next query.

1d2db86sca4384811e0b5e8707e68181f
ResourceIdarrayNo

The ID of the resource.

Valid values of N: [1,50].

stringNo

The ID of the resource.

285bb759342649a1b70c2093a772e087
Tagarray<object>No

The tag of objects that match the lifecycle rule. You can specify multiple tags.

objectNo

The tag of objects that match the lifecycle rule. You can specify multiple tags.

KeystringNo

The key of the tag.

Valid values of N: [1,20].

env
ValuestringNo

The value of the tag. If the parameter has a value, a value is also required for the tag key of the same N in the corresponding tag.N.Key. Otherwise, an error is reported.

Valid values of N: [1,20].

product

Response parameters

ParameterTypeDescriptionExample
object
NextTokenstring

The token that determines the start point of the next query.

A NextToken value of -1 indicates that a next query does not exist.

1d2db86sca4384811e0b5e8707e68181f
RequestIdstring

The ID of the request.

2D69A58F-345C-4FDE-88E4-BF5189484043
TagResourcesarray<object>

The resource list.

TagResourceobject
TagValuestring

The value of the tag.

zhangsan
ResourceTypestring

The type of the resource.

apiGroup
ResourceIdstring

The ID of the resource.

285bb759342649a1b70c2093a772e087
TagKeystring

The key of the tag.

owner

Examples

Sample success responses

JSONformat

{
  "NextToken": "1d2db86sca4384811e0b5e8707e68181f",
  "RequestId": "2D69A58F-345C-4FDE-88E4-BF5189484043",
  "TagResources": {
    "TagResource": [
      {
        "TagValue": "zhangsan",
        "ResourceType": "apiGroup",
        "ResourceId": "285bb759342649a1b70c2093a772e087",
        "TagKey": "owner"
      }
    ]
  }
}

Error codes

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2024-11-14API Description UpdateView Change Details