Help Center/ Organizations/ API Reference/ APIs/ Others/ Querying Resource Instances by Resource Type and Tag
Updated on 2026-07-29 GMT+08:00

Querying Resource Instances by Resource Type and Tag

Function

This API is used to query the list of resource instances by resource type and tag.

Debugging

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

Authorization Information

Each account has all the permissions required to call all APIs, but IAM users must be assigned the required permissions.

  • If you are using role/policy-based authorization, see Permissions Policies and Supported Actions for details on the required permissions.
  • If you are using identity policy-based authorization, the following identity policy-based permissions are required.

    Action

    Access Level

    Resource Type (*: required)

    Condition Key

    Alias

    Dependencies

    organizations:resources:listByTag

    List

    -

    -

    -

    -

URI

POST /v1/organizations/{resource_type}/resource-instances/filter

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

resource_type

Yes

String

Definition

Resource type. It can be organizations:policies, organizations:ous, organizations:accounts, or organizations:roots.

Constraints

Mandatory

Range

Enumerated values: organizations:policies, organizations:ous, organizations:accounts, and organizations:roots.

Default Value

No default value

Table 2 Query Parameters

Parameter

Mandatory

Type

Description

limit

No

Integer

Definition

Maximum number of results on a page.

Constraints

N/A

Range

1 to 1000

Default Value

No default value

offset

No

String

Definition

Pagination marker.

Constraints

Mandatory

Range

The value must comply with the regular expression [0-9]+.

Default Value

None

Request Parameters

Table 3 Request header parameters

Parameter

Mandatory

Type

Description

X-Security-Token

No

String

Definition

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

Constraints

N/A

Range

The value contains 0 to 32,768 characters.

Default Value

No default value

Table 4 Request body parameters

Parameter

Mandatory

Type

Description

without_any_tag

No

Boolean

Definition

Whether to search without any tag. If this parameter is set to true, all resources without tags are queried.

Constraints

None

Range

Boolean value: true or false

Default Value

None

tags

No

Array of TagsDTO objects

Definition

Tags included. A maximum of 10 tag keys are allowed for each query operation. Each tag key can have up to 10 tag values. The structure must be included. The tag key cannot be left blank or set to an empty string. Each key must be unique, and each value for a key must be unique. Resources that contain all tags are returned. The relationship between tag keys is AND, while the relationship between tag values under the same key is OR. If no tag filtering criteria is specified, all data is returned.

Constraints

N/A

Range

0 to 20 tags

Default Value

No default value

matches

No

Array of Match objects

Definition

Search field. key indicates the field to be matched, for example, organizational-unit. value indicates the value to be matched. The key is a fixed dictionary value and cannot contain duplicate keys or unsupported keys.

Constraints

None

Range

None

Default Value

None

Table 5 TagsDTO

Parameter

Mandatory

Type

Description

key

Yes

String

Definition

Key. It contains a maximum of 127 Unicode characters. It cannot be left blank.

Constraints

Mandatory

Range

The value must comply with the regular expression ^((?!sys|\s)[\p{L}\p{Z}\p{N}.:=+-@]*[\p{L}\p{N}.:=+-@])$.

The value contains 1 to 128 characters.

Default Value

None

values

Yes

Array of strings

Definition

Value list. Each value contains a maximum of 255 Unicode characters.

Constraints

Mandatory

Range

0 to 10 values

Default Value

None

Table 6 Match

Parameter

Mandatory

Type

Description

key

Yes

String

Definition

Key.

Constraints

Mandatory

Range

None

Default Value

None

value

Yes

String

Definition

Value. Each value contains a maximum of 255 Unicode characters.

Constraints

Mandatory

Range

None

Default Value

None

Response Parameters

Status code: 200

Table 7 Response body parameters

Parameter

Type

Description

resources

Array of ResourceDTO objects

Definition

Resource information list.

Constraints

Mandatory

Range

None

Default Value

None

total_count

Integer

Definition

Total number of records.

Constraints

Mandatory

Range

None

Default Value

None

Table 8 ResourceDTO

Parameter

Type

Description

resource_id

String

Definition

Resource ID.

Constraints

Mandatory

Range

None

Default Value

None

resource_name

String

Definition

Resource name.

Constraints

None

Range

None

Default Value

None

tags

Array of Match objects

Definition

List of resource tags.

Constraints

Mandatory

Range

N/A

Default Value

No default value

Table 9 Match

Parameter

Type

Description

key

String

Definition

Key.

Constraints

Mandatory

Range

None

Default Value

None

value

String

Definition

Value. Each value contains a maximum of 255 Unicode characters.

Constraints

Mandatory

Range

None

Default Value

None

Example Requests

Querying the list of resource instances by resource type and tag

POST https://{endpoint}/v1/organizations/{resource_type}/resource-instances/filter

{
  "without_any_tag" : true,
  "tags" : [ {
    "key" : "string",
    "values" : [ "string" ]
  } ],
  "matches" : [ {
    "key" : "string",
    "value" : "string"
  } ]
}

Example Responses

Status code: 200

Successful

{
  "resources" : [ {
    "resource_id" : "string",
    "resource_name" : "string",
    "tags" : [ {
      "key" : "string",
      "value" : "string"
    } ]
  } ],
  "total_count" : 0
}

Status Codes

Status Code

Description

200

Successful

Error Codes

See Error Codes.