查询用户列表接口
将 <BASE_URL> 替换为所在企业环境的 API 域名。
- Scope:
admin.v1.user-directory.read - 权限项:用户与部门信息读取(
user-directory) - 权限类型:读取
- 接口:GET
/api/openapi/v1/users
认证与请求头
使用应用 API Key 调用。当前接口只校验上方独立 Scope;读取、管理与执行权限互不隐含。
| 名称 | 位置 | 类型 | 必填 | 说明 | 示例 |
|---|---|---|---|---|---|
Authorization | header | string | 是 | 应用 API Key,使用 Bearer 方式传递。 | Bearer qwk_*** |
X-Request-Id | header | string | 否 | 可选的调用追踪标识;未传入时由服务端生成。 | req-20260831-001 |
请求参数
| 名称 | 位置 | 类型 | 必填 | 说明 | 示例 |
|---|---|---|---|---|---|
third_party_user_ids | query | array | null | 否 | Repeated third-party user IDs (at most 100; each 1-255 characters after trimming). Case-sensitive exact match, intersected with other filters and application user scope. Empty values are rejected. Omit to leave this filter unset. | ["<string>"] |
keyword | query | string | 否 | - | "<string>" |
department_id | query | string · uuid | 否 | - | "<uuid>" |
status | query | string | 否 | - | "pending" |
seat_status | query | string | 否 | - | "assigned" |
page | query | integer · int64 | 否 | - | 1 |
page_size | query | integer · int64 | 否 | - | 20 |
请求示例
cURL
curl --request GET \
--url '<BASE_URL>/api/openapi/v1/users?third_party_user_ids=<third_party_user_ids>&keyword=<keyword>&department_id=<department_id>&status=<status>&seat_status=<seat_status>&page=1&page_size=20' \
--header 'Authorization: Bearer <API_KEY>'响应
200 OK
| 名称 | 类型 | 必填 | 说明 | 示例 |
|---|---|---|---|---|
items | array | null | 是 | 用户列表。 | [{"account":"<string>","department_ids":["<string>"],"email":"<string>","job_number":"<string>","name":"<string>","phone":"<string>","qid":"<uuid>","seat_status":"assigned","source":"manual","status":"pending","updated_at":"2026-08-27T10:00:00Z","third_party_user_id":"external-001","departments":[{"id":"22222222-2222-4222-8222-222222222222","name":"Engineering","path":"Company/Engineering","external_id":"external-dept","is_primary":true}],"credential":{"password_state":"active","must_change_password":false,"credential_version":2},"created_at":"2026-09-19T01:00:00Z","last_active_at":"2026-09-23T01:00:00Z"}] |
page | integer · int64 | 是 | - | 0 |
page_size | integer · int64 | 是 | - | 0 |
total | integer · int64 | 是 | - | 0 |
items[].third_party_user_id | string | 是 | 第三方用户 ID;未设置时为空字符串。 | "external-001" |
items[].departments | array | 是 | 部门详情;无部门时为空数组。 | [{"id":"22222222-2222-4222-8222-222222222222","name":"Engineering","path":"Company/Engineering","external_id":"external-dept","is_primary":true}] |
items[].credential | object | 是 | 密码生命周期信息,不包含密码或哈希。 | {"password_state":"active","must_change_password":false,"credential_version":2} |
items[].created_at | string · date-time | 是 | 用户创建时间。 | "2026-09-19T01:00:00Z" |
items[].last_active_at | string · date-time | 否 | IAM 最近活跃时间;无记录时省略,不等同于最近业务使用时间。 | "2026-09-23T01:00:00Z" |
items[].departments[].id | string · uuid | 是 | 部门 ID。 | - |
items[].departments[].name | string | 是 | 部门名称。 | - |
items[].departments[].path | string | 是 | 部门路径。 | - |
items[].departments[].external_id | string | 否 | 部门外部 ID;未设置时省略。 | - |
items[].departments[].is_primary | boolean | 是 | 是否为主部门。 | - |
items[].credential.password_state | string | 是 | 密码状态:unset 未设置、initial 初始密码、active 已生效。 | - |
items[].credential.must_change_password | boolean | 是 | 是否需要修改密码。 | - |
items[].credential.credential_version | integer | 是 | 凭证版本。 | - |
items[].credential.password_updated_at | string · date-time | 否 | 密码更新时间;无记录时省略。 | - |
items[].credential.first_login_completed_at | string · date-time | 否 | 首次登录完成时间;未完成时省略。 | - |
响应示例
{
"items": [
{
"account": "<string>",
"department_ids": [
"<string>"
],
"email": "<string>",
"job_number": "<string>",
"name": "<string>",
"phone": "<string>",
"qid": "<uuid>",
"seat_status": "assigned",
"source": "manual",
"status": "pending",
"updated_at": "2026-08-27T10:00:00Z",
"third_party_user_id": "external-001",
"departments": [
{
"id": "22222222-2222-4222-8222-222222222222",
"name": "Engineering",
"path": "Company/Engineering",
"external_id": "external-dept",
"is_primary": true
}
],
"credential": {
"password_state": "active",
"must_change_password": false,
"credential_version": 2
},
"created_at": "2026-09-19T01:00:00Z",
"last_active_at": "2026-09-23T01:00:00Z"
}
],
"page": 0,
"page_size": 0,
"total": 0
}default Flat business error
| 名称 | 类型 | 必填 | 说明 | 示例 |
|---|---|---|---|---|
code | string | 否 | Stable business error code | "<string>" |
detail | string | 是 | Human-readable error description | "<string>" |
details | OpenapiErrorDetails | 否 | - | {"field":"<string>","reason":"<string>","suggestion":"<string>"} |
details.field | string | 否 | Request field that failed validation | "<string>" |
details.reason | string | 否 | Stable validation failure reason | "<string>" |
details.suggestion | string | 否 | Suggested normalized value | "<string>" |
error | string | 是 | Stable HTTP error type | "<string>" |
响应示例
{
"code": "<string>",
"detail": "<string>",
"details": {
"field": "<string>",
"reason": "<string>",
"suggestion": "<string>"
},
"error": "<string>"
}