Help Center/ Workspace/ API Reference/ Workspace APIs/ OU/ Querying Users in an OU
Updated on 2025-07-14 GMT+08:00

Querying Users in an OU

Function

Queries users in an OU.

Debugging

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

URI

GET /v2/{project_id}/ou-users

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID.

Table 2 Query Parameters

Parameter

Mandatory

Type

Description

ou_dn

Yes

String

Domain name address of the OU.

user_name

No

String

Username. Fuzzy search is supported.

has_existed

No

Boolean

Whether the user exists.

limit

No

Integer

Limits the quantity of returned desktops in pagination query. If this parameter is not specified, all desktops that meet the search criteria are returned.

offset

No

Integer

Where the pagination query starts. The value starts from 0.

Request Parameters

Table 3 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

No

String

User token.

It can be obtained by calling the IAM API used to obtain a user token. The value of X-Subject-Token in the response header is the user token.

Content-Type

Yes

String

MIME type of the request body, for example, application/json.

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

user_infos

Array of AdOuUserInfo objects

OU object.

total_count

Integer

Number of users.

enable_create_count

Integer

Number of users that can be created.

Table 5 AdOuUserInfo

Parameter

Type

Description

user_name

String

Name.

expired_time

String

Expiration time. The value –1 means never expiring.

has_existed

Boolean

Whether the user exists in the user list.

Status code: 400

Table 6 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

encoded_authorization_message

String

Encrypted detailed reason for rejection. You can call the API decode-authorization-message of STS to decrypt the reason.

Status code: 401

Table 7 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

encoded_authorization_message

String

Encrypted detailed reason for rejection. You can call the API decode-authorization-message of STS to decrypt the reason.

Status code: 403

Table 8 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

encoded_authorization_message

String

Encrypted detailed reason for rejection. You can call the API decode-authorization-message of STS to decrypt the reason.

Status code: 404

Table 9 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

encoded_authorization_message

String

Encrypted detailed reason for rejection. You can call the API decode-authorization-message of STS to decrypt the reason.

Status code: 405

Table 10 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

encoded_authorization_message

String

Encrypted detailed reason for rejection. You can call the API decode-authorization-message of STS to decrypt the reason.

Status code: 500

Table 11 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

encoded_authorization_message

String

Encrypted detailed reason for rejection. You can call the API decode-authorization-message of STS to decrypt the reason.

Status code: 503

Table 12 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

encoded_authorization_message

String

Encrypted detailed reason for rejection. You can call the API decode-authorization-message of STS to decrypt the reason.

Example Requests

None

Example Responses

Status code: 200

Queries OU information.

{
  "user_infos" : [ {
    "user_name" : "wksmanager",
    "expired_time" : "2022-12-17 00:00:00",
    "has_existed" : false
  }, {
    "user_name" : "wksmanager",
    "expired_time" : "-1",
    "has_existed" : false
  } ],
  "total_count" : 2
}

Status Codes

Status Code

Description

200

Queries OU information.

400

The request cannot be understood by the server due to malformed syntax.

401

Authentication failed.

403

No operation permissions.

404

No resources found.

405

The method specified in the request is not allowed.

500

An internal service error occurred. For details, see the error code description.

503

Service unavailable.

Error Codes

See Error Codes.