Queries tag keys.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes ListTagKeys

The operation that you want to perform. Set the value to ListTagKeys.

RegionId String Yes cn-hangzhou

The region ID of the resource.

NextToken String No caeba0bbb2be03f84eb48b699f0a****

The token used to start the next query.

PageSize Integer No 50

The number of tag keys to return on each page.

Maximum value: 1000. Default value: 50.

Category String No Custom

The type of the tag. Valid values:

  • Custom
  • System
  • All

Default value: All.

ResourceType String No ALIYUN::ECS::INSTANCE

The type of the resource. For more information about supported resource types, see Types of resources that support tag API operations.

Response parameters

Parameter Type Example Description
Keys Array

The information of the tag keys.

Key
Category String Custom

The type of the tag. Valid values:

  • Custom
  • System
Key String k1

The tag key.

NextToken String caeba0bbb2be03f84eb48b699f0a****

The token used to start the next query.

If the value of this parameter is empty, all results are returned.

RequestId String DC09A6AA-2713-4E10-A2E9-E6C5C43A8842

The ID of the request.

Examples

Sample requests

https://tag.aliyuncs.com/?Action=ListTagKeys
&RegionId=cn-hangzhou
&<Common request parameters>

Sample success responses

XML format

<ListTagKeysResponse>
      <NextToken></NextToken>
      <RequestId>DC09A6AA-2713-4E10-A2E9-E6C5C43A8842</RequestId>
      <Keys>
            <Key>
                  <Category>custom</Category>
                  <Key>team</Key>
            </Key>
            <Key>
                  <Category>custom</Category>
                  <Key>k1</Key>
            </Key>
            <Key>
                  <Category>custom</Category>
                  <Key>k2</Key>
            </Key>
      </Keys>
</ListTagKeysResponse>

JSON format

{
    "NextToken": "",
    "RequestId": "DC09A6AA-2713-4E10-A2E9-E6C5C43A8842",
    "Keys": {
        "Key": [
            {
                "Category": "custom",
                "Key": "team"
            },
            {
                "Category": "custom",
                "Key": "k1"
            },
            {
                "Category": "custom",
                "Key": "k2"
            }
        ]
    }
}

Error codes

HTTP status code Error code Error message Description
403 Invalid.NextToken The parameter NextToken is invalid. The error message returned because the value of the NextToken parameter is invalid.
403 NoPermission.Operator The user is not authorized to operate on the specified resource. The error message returned because you are not authorized to perform the operation.
403 InvalidParameter.Category The specified Category is invalid. Valid values are Custom and System. The error message returned because the value of the Category parameter is invalid. The value can be Custom or System.
403 InvalidParameter.ResourceType The ResourceType parameter is invalid. The error message returned because the value of the ResourceType parameter is invalid.

For a list of error codes, visit the API Error Center.