> ## 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.

批量创建企业成员。创建成功后，成员将直接加入企业并处于激活状态，无需通过邀请邮件完成加入或手动激活。

## 所需权限 {#hzB7R87kc}

`users:write`

## 请求说明 {#hcCMhLsfy}

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

## 注意事项 {#hH10c4m40}


* 对于存量成员，“使用中” 状态的成员账号不会被覆盖；处于待激活、审批中、或已移除状态的存量成员会被重新激活，并使用本次请求中的名称、角色和初始密码。
* 当企业成员由外部身份源（包括火山引擎云身份中心）统一管理时，请求将失败，不会创建成员。

## 请求体 {#hWlyfBCHq}

<!-- @cols-width: 190,127,108,488 -->
| | | | | \
|**参数** |**类型** |**是否必填** |**描述** |
|---|---|---|---|
|`users` |array |是 |成员数组。单次请求最多传入 100 个成员。 |
|`users[].email` |string |是 |成员的邮箱地址。 |
|`users[].user_name` |string |是 |成员的名称。 |
|`users[].role` |string |是 |成员的角色，取值： |\
| | | | |\
| | | |* `admin`：管理员； |\
| | | |* `member`：成员。 |\
| | | | |\
| | | |***提示***：不支持创建 “超级管理员” 角色。 |
|`users[].password` |string |是 |成员的账号的初始密码。 |\
| | | | |\
| | | |长度至少 8 位；不能包含空白字符；大写字母、小写字母、数字、特殊字符四类中至少包含三类。 |

## 响应参数 {#hwNNNZaH2}

<!-- @cols-width: 237,116,559 -->
| | | | \
|**参数** |**类型** |**描述** |
|---|---|---|
|`success_count` |int |本次请求成功创建或重新激活的成员数量。 |
|`failed_items` |array |创建失败的成员列表。全部成员创建成功时返回 `[]`。 |
|`failed_items[].index` |int |创建失败的成员在请求中传入的 `users` 数组中的下标，从 `0` 开始。 |
|`failed_items[].email` |string |创建失败成员的邮箱地址。 |
|`failed_items[].code` |int |错误码。详情参考[错误码](/enterprise_error-codes)。 |
|`failed_items[].message` |string |错误消息，用于说明创建失败的原因。 |

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

## 请求示例 {#hQyXll8bg}

```Bash
curl -X POST "${HOST}/openapi/v1/users/create" \
  -H "Authorization: Bearer ${ACCESS_TOKEN}" \
  -H "Content-Type: application/json" \
  -d '{
    "users": [
      {
        "email": "john@example.com",
        "user_name": "John",
        "role": "member",
        "password": "Aa123456!"
      },
      {
        "email": "bob@example.com",
        "user_name": "Bob",
        "role": "admin",
        "password": "Bb123456!"
      }
    ]
  }'
```

## 响应示例 {#huW0FPMfd}

```JSON
{
  "code": 0,
  "message": "success",
  "request_id": "021xxxxxxxxx",
  "data": {
    "success_count": 1,
    "failed_items": [
      {
        "index": 1,
        "email": "bob@example.com",
        "code": 30001,
        "message": "user already exists in this tenant"
      }
    ]
  }
}
```


