ListCostAllocationTags - AWS Billing and Cost Management

ListCostAllocationTags

Get a list of cost allocation tags. All inputs in the API are optional and serve as filters. By default, all cost allocation tags are returned.

Request Syntax

{ "MaxResults": number, "NextToken": "string", "Status": "string", "TagKeys": [ "string" ], "Type": "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.

MaxResults

The maximum number of objects that are returned for this request. By default, the request returns 100 results.

Type: Integer

Valid Range: Minimum value of 1. Maximum value of 1000.

Required: No

NextToken

The token to retrieve the next set of results. AWS provides the token when the response from a previous call has more results than the maximum page size.

Type: String

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

Pattern: [\S\s]*

Required: No

Status

The status of cost allocation tag keys that are returned for this request.

Type: String

Valid Values: Active | Inactive

Required: No

TagKeys

The list of cost allocation tag keys that are returned for this request.

Type: Array of strings

Array Members: Minimum number of 1 item. Maximum number of 100 items.

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

Pattern: [\S\s]*

Required: No

Type

The type of CostAllocationTag object that are returned for this request. The AWSGenerated type tags are tags that AWS defines and applies to support AWS resources for cost allocation purposes. The UserDefined type tags are tags that you define, create, and apply to resources.

Type: String

Valid Values: AWSGenerated | UserDefined

Required: No

Response Syntax

{ "CostAllocationTags": [ { "Status": "string", "TagKey": "string", "Type": "string" } ], "NextToken": "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.

CostAllocationTags

A list of cost allocation tags that includes the detailed metadata for each one.

Type: Array of CostAllocationTag objects

Array Members: Minimum number of 0 items. Maximum number of 100 items.

NextToken

The token to retrieve the next set of results. AWS provides the token when the response from a previous call has more results than the maximum page size.

Type: String

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

Pattern: [\S\s]*

Errors

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

InvalidNextTokenException

The pagination token is invalid. Try again without a pagination token.

HTTP Status Code: 400

LimitExceededException

You made too many calls in a short period of time. Try again later.

HTTP Status Code: 400

Examples

The following are sample requests and responses of the ListCostAllocationTags operations.

Example 1: List all user defined active tags

This example illustrates one usage of ListCostAllocationTags.

Sample Request

{ "Type": "UserDefined", "Status": "Active" }

Sample Response

{ "CostAllocationTags": [ { "TagKey": "tagA", "Type": "UserDefined", "Status": "Active" } ], "NextToken": null }

Example 2: List all tags by tag keys

This example illustrates one usage of ListCostAllocationTags.

Sample Request

{ "TagKeys": ["tagA", "tagB"] }

Sample Response

{ "CostAllocationTags": [ { "TagKey": "tagA", "Type": "UserDefined", "Status": "Active" }, { "TagKey": "tagB", "Type": "UserDefined", "Status": "Inactive" } ], "NextToken": null }

See Also

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