> ## Documentation Index
> Fetch the complete documentation index at: https://docs.trae.cn/llms.txt
> Use this file to discover all available pages before exploring further.

批量重置企业成员的账号密码。

## 所需权限 {#hGsRFzLmA}

`users:write`

## 请求说明 {#hMMmAM1uG}

* 请求方式：POST
* 请求地址：{域名}/openapi/v1/users/reset_password

## 注意事项 {#hnlhK1mwl}


* 仅支持重置由 TRAE 企业账号体系管理的成员密码。以下成员的账号密码不会被重置：超级管理员、非当前企业的成员、已注销成员、外部身份源（包括火山引擎云身份中心）托管的成员不会被修改。
* 密码重置成功后，相关成员已有的登录 Session 和 Refresh Token 将被清理。成员需要使用新密码重新登录。

## 请求体 {#hjt8Dj4zM}

<!-- @cols-width: 190,100,145,477 -->
| | | | | \
|**参数** |**类型** |**是否必填** |**描述** |
|---|---|---|---|
|`users` |array |是 |成员数组。最多传入 100 个成员。 |
|`users[].email` |string |条件必填 |成员的邮箱地址。与 `user_id` 至少传入一个。邮箱不区分大小写。 |
|`users[].user_id` |string |条件必填 |成员的用户 ID。与 `email` 至少传入一个。 |\
| | | | |\
| | | |你需要调用 “获取成员列表” 接口来获取成员的用户 ID，详情参考[获取成员列表](/enterprise_get-user-list)。 |
|`users[].password` |string |是 |新的密码。 |\
| | | | |\
| | | |长度至少 8 位；不能包含空白字符；大写字母、小写字母、数字、特殊字符四类中至少包含三类。 |

:::notice 注意
* 在 `users` 数组中的同一个元素中，若你同时传入 `email` 和 `user_id`，需确保两者指向同一个成员，否则将无法为该成员重置密码。
* 若在不同元素中重复传入同一成员，例如分别在两个元素中通过 `email` 和 `user_id` 指向同一成员，则第一个元素会被处理，后续重复元素会失败。
:::

## 响应参数 {#hkOy4UvjI}

<!-- @cols-width: 281,127,502 -->
| | | | \
|**参数** |**类型** |**描述** |
|---|---|---|
|`success_count` |int |成功重置密码的成员数量。 |
|`failed_items` |array |重置密码失败的成员列表。全部成功时返回 `[]`。 |
|`failed_items[].index` |int |重置密码失败的成员在请求中传入的 `users` 数组中的下标，从 `0` 开始。 |
|`failed_items[].email` |string |若在请求中传入了成员的邮箱，则返回该邮箱，否则省略。 |
|`failed_items[].user_id` |string |若在请求中传入了成员的用户 ID，则返回该用户 ID，否则省略。 |
|`failed_items[].code` |int |错误码。详情参考[错误码](/enterprise_error-codes)。 |
|`failed_items[].message` |string |错误消息，用于说明重置密码失败的原因。 |

:::tip 提示
当 `code` 为 `0` 且 `failed_items` 不为空时，表示接口调用成功，但部分成员重置密码失败。请根据 `failed_items` 中的 `index`、`email`、`user_id` 和错误码定位失败成员，并修正后重试。
:::

## 请求示例 {#hwNw3peHA}

```Bash
curl -X POST "${HOST}/openapi/v1/users/reset_password" \
  -H "Authorization: Bearer ${ACCESS_TOKEN}" \
  -H "Content-Type: application/json" \
  -d '{
    "users": [
      {
        "email": "john@example.com",
        "password": "NewAa123!"
      },
      {
        "user_id": "123456789012345678",
        "password": "NewBb123!"
      }
    ]
  }'
```

## 响应示例 {#hNjKloFqH}

```JSON
{
  "code": 0,
  "message": "success",
  "request_id": "021xxxxxxxxx",
  "data": {
    "success_count": 1,
    "failed_items": [
      {
        "index": 1,
        "email": "bob@example.com",
        "user_id": "123456",
        "code": 30019,
        "message": "password invalid"
      }
    ]
  }
}
```
