All Products
Search
Document Center

Resource Management:ListPolicies

Last Updated:Mar 30, 2026

Queries a list of tag policies.

Operation description

If you use the Tag Policy feature in single-account mode, you can use the current logon account to call this API operation to query all tag policies that are created for the account. If you use the Tag Policy feature in multi-account mode, you can use the management account of a resource directory to call this API operation to query all tag policies that are created for the resource directory. For more information about the modes of the Tag Policy feature, see Modes of the Tag Policy feature.

This topic provides an example on how to call the API operation to query all tag policies that are created for the current logon account. In this example, the Tag Policy feature in single-account mode is used. The response shows that two tag policies are created.

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:ListPolicies

get

*All Resource

*

None None

Request parameters

Parameter

Type

Required

Description

Example

RegionId

string

No

The region ID. Set the value to cn-shanghai.

cn-shanghai

MaxResult

integer

No

The number of entries to return on each page.

Default value: 50. Maximum value: 1000.

50

NextToken

string

No

The token that is used to start the next query.

caeba0bbb2be03f84eb48b699f0a****

PolicyIds

array

No

The ID of a tag policy. This parameter specifies a filter condition for the query.

string

No

The ID of a tag policy. This parameter specifies a filter condition for the query.

p-557cb141331f41c7****

PolicyNames

array

No

The name of a tag policy. This parameter specifies a filter condition for the query.

string

No

The name of a tag policy. This parameter specifies a filter condition for the query.

test

UserType

string

No

The mode of the Tag Policy feature. This parameter specifies a filter condition for the query. Valid values:

  • USER: single-account mode

  • RD: multi-account mode

For more information about the modes of the Tag Policy feature, see Modes of the Tag Policy feature.

Note

The value of this parameter is not case-sensitive.

USER

For information about common request parameters, see Common parameters.

Response elements

Element

Type

Description

Example

object

The response parameters.

RequestId

string

The ID of the request.

72477CFF-5B24-5E30-9861-3DD9C4BD46E5

NextToken

string

Indicates whether the next query is required.

  • If the value of this parameter is empty ("NextToken": ""), all results are returned, and the next query is not required.

  • If the value of this parameter is not empty, the next query is required, and the value is the token used to start the next query.

caeba0bbb2be03f84eb48b699f0a****

PolicyList

array<object>

The tag policies.

object

The tag policies.

PolicyName

string

The name of the tag policy.

example

PolicyDesc

string

The description of the tag policy.

This is a tag policy example.

PolicyContent

string

The document of the tag policy.

{\"tags\":{\"CostCenter\":{\"tag_value\":{\"@@assign\":[\"Beijing\",\"Shanghai\"]},\"tag_key\":{\"@@assign\":\"CostCenter\"}}}}

PolicyId

string

The ID of the tag policy.

p-de62a0bf400e4b69****

UserType

string

The mode of the Tag Policy feature. Valid values:

  • USER: single-account mode

  • RD: multi-account mode

For more information about the modes of the Tag Policy feature, see Modes of the Tag Policy feature.

USER

Examples

Success response

JSON format

{
  "RequestId": "72477CFF-5B24-5E30-9861-3DD9C4BD46E5",
  "NextToken": "caeba0bbb2be03f84eb48b699f0a****",
  "PolicyList": [
    {
      "PolicyName": "example",
      "PolicyDesc": "This is a tag policy example.",
      "PolicyContent": "{\\\"tags\\\":{\\\"CostCenter\\\":{\\\"tag_value\\\":{\\\"@@assign\\\":[\\\"Beijing\\\",\\\"Shanghai\\\"]},\\\"tag_key\\\":{\\\"@@assign\\\":\\\"CostCenter\\\"}}}}",
      "PolicyId": "p-de62a0bf400e4b69****",
      "UserType": "USER"
    }
  ]
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.