Queries groups.

Usage notes

This topic provides an example on how to query the groups in the directory d-00fc2p61****. The returned result shows that the directory contains three groups. The groups group1 and group2 are synchronized from an external identity provider (IdP). The group TestGroup is manually created in CloudSSO.


You can call this operation up to 100 times per second per account. This operation is globally limited to 100 times per second across all accounts. If the number of the calls per second exceeds a limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limits when you call this operation.


OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes ListGroups

The operation that you want to perform. Set the value to ListGroups.

DirectoryId String Yes d-00fc2p61****

The ID of the directory.

NextToken String No K1c3o9K7pFxoTtxH1Nm7MMLb7zrDGvftYBQBPDVv7AD3a8yhRb3Mk8L9ivmN6bFSjfkZNTAg3h4****

The token to return for the next page. If this is your first time to call this operation, you do not need to specify NextToken.

When you call this operation for the first time, if the total number of entries to return exceeds the value of MaxResults, the entries are truncated. Only the entries that match the value of MaxResults are returned, and the excess entries are not returned. In this case, the value of the response parameter IsTruncated is true, and NextToken is returned. In the next call, you can use the value of NextToken and maintain the settings of the other request parameters to query the excess entries. You can repeat the call until the value of IsTruncated becomes false. This way, all entries are returned.

MaxResults Integer No 10

The number of entries to return on each page.

Valid values: 1 to 100.

Default value: 10.

Filter String No GroupName eq testgroup

The filter condition.

Specify the value in the <Attribute> <Operator> <Value> format. The value is not case sensitive. You can set <Attribute> only to GroupName and <Operator> only to eq or sw. The value eq indicates Equals. The value sw indicates Starts With.

For example, if you set Filter to GroupName sw test, the operation queries the groups whose names start with test. If you set Filter to GroupName eq testgroup, the operation queries the group whose name is testgroup.

ProvisionType String No Manual

The type of the group. The type can be used to filter groups. Valid values:

  • Manual: The group is manually created.
  • Synchronized: The group is synchronized from an external identity provider (IdP).

For more information about common request parameters, see Common parameters.

Response parameters

Parameter Type Example Description
NextToken String K1c3o9K7pFxoTtxH1Nm7MMLb7zrDGvftYBQBPDVv7AD3a8yhRb3Mk8L9ivmN6bFSjfkZNTAg3h4****

The token that is returned for the next page.

Note This parameter is returned only when the IsTruncated parameter is set to true.
RequestId String 768F908D-A66A-5A5D-816C-20C93CBBFEE3

The ID of the request.

Groups Array of Group

The groups.

GroupName String TestGroup

The name of the group.

Description String This is a group.

The description of the group.

CreateTime String 2021-11-01T02:38:27Z

The time when the group was created.

ProvisionType String Manual

The type of the group. Valid values:

  • Manual: The group is manually created.
  • Synchronized: The group is synchronized from an external IdP.
UpdateTime String 2021-11-01T02:38:27Z

The time when the information about the group was modified.

GroupId String g-00jqzghi2n3o5hkh****

The ID of the group.

MaxResults Integer 10

The number of entries returned per page.

TotalCounts Integer 3

The total number of entries returned.

IsTruncated Boolean false

Indicates whether the queried entries are truncated. Valid values:

  • true: The queried entries are truncated.
  • false: The queried entries are not truncated.


Sample requests

&<Common request parameters>

Sample success responses

XML format

HTTP/1.1 200 OK

			<Description>This is a group.</Description>

JSON format

HTTP/1.1 200 OK

  "RequestId" : "768F908D-A66A-5A5D-816C-20C93CBBFEE3",
  "Groups" : [ {
    "GroupName" : "group1",
    "Description" : "",
    "CreateTime" : "2021-06-30T08:52:17Z",
    "ProvisionType" : "Synchronized",
    "UpdateTime" : "2021-07-09T03:27:23Z",
    "GroupId" : "g-00dd217ozcicxqz0****"
  }, {
    "GroupName" : "group2",
    "Description" : "",
    "CreateTime" : "2021-07-09T03:26:48Z",
    "ProvisionType" : "Synchronized",
    "UpdateTime" : "2021-07-09T03:26:48Z",
    "GroupId" : "g-00e2fbulf91zlsuu****"
  }, {
    "GroupName" : "TestGroup",
    "Description" : "This is a group.",
    "CreateTime" : "2021-11-01T02:38:27Z",
    "ProvisionType" : "Manual",
    "UpdateTime" : "2021-11-01T02:38:27Z",
    "GroupId" : "g-00jqzghi2n3o5hkh****"
  } ],
  "MaxResults" : 10,
  "TotalCounts" : 3,
  "IsTruncated" : false

Error codes

For a list of error codes, visit the API Error Center.