Help Center/ Organizations/ API Reference/ APIs/ Others/ Querying Effective Policies
Updated on 2024-10-21 GMT+08:00

Querying Effective Policies

Function

This API is used to query the effective policy of a specific type for the specified account. This API cannot be used to query the information about service control policies. This API can be called only from the organization's management account or a delegated administrator account.

Debugging

You can debug this API through automatic authentication in API Explorer or use the SDK sample code generated by API Explorer.

URI

GET https://{endpoint}/v1/organizations/entities/effective-policies

Table 1 Query Parameters

Parameter

Mandatory

Type

Description

entity_id

Yes

String

Unique ID of an account. Currently, the effective policy of the root and organizational units cannot be queried.

policy_type

Yes

String

Name of a policy type. Currently, the value tag_policy is available.

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Security-Token

No

String

Security token (session token) of your temporary security credentials. If a temporary security credential is used, this header is required.

Response Parameters

Status code: 200

Table 3 Response body parameters

Parameter

Type

Description

last_updated_at

String

Time when the effective policy is mostly updated.

policy_content

String

Content of the effective policy.

policy_type

String

Name of a policy type. Currently, the value tag_policy is available.

entity_id

String

Unique ID of the root, OU, or account.

Example Requests

Querying effective policies

POST https://{endpoint}/v1/organizations/entities/effective-policies

Example Responses

Status code: 200

Successful.

{
  "last_updated_at" : "2023-01-11T11:00:00Z",
  "policy_content" : "{\"tags\":{\"color\":{\"tag_value\":[],\"tag_key\":\"Color\",\"enforced_for\":[\"iam:policy\"]},\"key_string\":{\"tag_value\":[\"AA\",\"BB\",\"cc\"],\"tag_key\":\"key_String\",\"enforced_for\":[\"iam:policy\"]},\"project\":{\"tag_value\":[\"Maintenance\",\"Escalations\"],\"tag_key\":\"Project\"}}}",
  "policy_type" : "tag_policy",
  "entity_id" : "c2acfcdf5fc7461a88f20094963e56c8"
}

Status Codes

Status Code

Description

200

Successful.

Error Codes

See Error Codes.