GetTagKeys - Resource Groups Tagging API
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).


Returns all tag keys currently in use in the specified Amazon Region for the calling account.

This operation supports pagination, where the response can be sent in multiple pages. You should check the PaginationToken response parameter to determine if there are additional results available to return. Repeat the query, passing the PaginationToken response parameter value as an input to the next request until you recieve a null value. A null value for PaginationToken indicates that there are no more results waiting to be returned.

Request Syntax

{ "PaginationToken": "string" }

Request Parameters

For information about the parameters that are common to all actions, see Common Parameters.

The request accepts the following data in JSON format.


Specifies a PaginationToken response value from a previous request to indicate that you want the next page of results. Leave this parameter empty in your initial request.

Type: String

Length Constraints: Minimum length of 0. Maximum length of 2048.

Pattern: [\s\S]*

Required: No

Response Syntax

{ "PaginationToken": "string", "TagKeys": [ "string" ] }

Response Elements

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.


A string that indicates that there is more data available than this response contains. To receive the next part of the response, specify this response value as the PaginationToken value in the request for the next page.

Type: String

Length Constraints: Minimum length of 0. Maximum length of 2048.

Pattern: [\s\S]*


A list of all tag keys in the Amazon account.

Type: Array of strings

Length Constraints: Minimum length of 1. Maximum length of 128.

Pattern: [\s\S]*


For information about the errors that are common to all actions, see Common Errors.


The request processing failed because of an unknown error, exception, or failure. You can retry the request.

HTTP Status Code: 500


The request failed because of one of the following reasons:

  • A required parameter is missing.

  • A provided string parameter is malformed.

  • An provided parameter value is out of range.

  • The target ID is invalid, unsupported, or doesn't exist.

  • You can't access the Amazon S3 bucket for report storage. For more information, see Additional Requirements for Organization-wide Tag Compliance Reports in the Amazon Organizations User Guide.

  • The partition specified in an ARN parameter in the request doesn't match the partition where you invoked the operation. The partition is specified by the second field of the ARN.

HTTP Status Code: 400


The request failed because the specified PaginationToken has expired. A PaginationToken is valid for a maximum of 15 minutes.

HTTP Status Code: 400


The request failed because it exceeded the allowed frequency of submitted requests.

HTTP Status Code: 400



This example illustrates one usage of GetTagKeys.

Sample Request

POST / HTTP/1.1 Host: Accept-Encoding: identity Content-Length: 2 X-Amz-Target: ResourceGroupsTaggingAPI_20170126.GetTagKeys X-Amz-Date: 20170421T214126Z User-Agent: aws-cli/1.11.79 Python/2.7.9 Windows/7 botocore/1.5.42 Content-Type: application/x-amz-json-1.1 Authorization: AUTHPARAMS {}

Sample Response

HTTP/1.1 200 OK x-amzn-RequestId: 462f0799-26db-11e7-a88c-a74e0c5622c9 Content-Type: application/x-amz-json-1.1 Content-Length: 79 Date: Fri, 21 Apr 2017 21:41:27 GMT { "PaginationToken": "", "TagKeys": [ "Example", "Example1", "Example2" ] }

See Also

For more information about using this API in one of the language-specific Amazon SDKs, see the following: