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

邀请指定人员加入企业。该操作会向被邀请人发送邮件，需注意风险。
## 所需权限 {#3c617a38}
`users:write`
## 请求方式 {#dd72698b}
```HTTP
POST /openapi/v1/users/invite
```

## 请求体 {#9115c389}
<!-- @cols-width: 183,183,183,307 -->
| | | | | \
|**参数** |**类型** |**是否必填** |**描述** |
|---|---|---|---|
| | | | | \
|`users` |array |是 |待邀请成员，最多 20 个。 |

`users[]` 对象包含以下参数：
<!-- @cols-width: 183,183,183,307 -->
| | | | | \
|**参数** |**类型** |**是否必填** |**描述** |
|---|---|---|---|
| | | | | \
|`email` |string |是 |待邀请成员的邮箱地址。 |
| | | | | \
|`role` |string |是 |待邀请成员的角色： |\
| | | | |\
| | | |* `admin`：管理员 |\
| | | |* `member`：成员 |

## 响应参数 {#94413829}
<!-- @cols-width: 244,244,351 -->
| | | | \
|**参数** |**类型** |**描述** |
|---|---|---|
| | | | \
|`success_count` |int |成功邀请的成员数量。 |
| | | | \
|`failed_items` |array |邀请失败的成员列表。 |

`failed_items[]` 数组包含以下参数：
<!-- @cols-width: 244,186,406 -->
| | | | \
|**参数** |**类型** |**描述** |
|---|---|---|
| | | | \
|`email` |string |邀请失败的成员邮箱（即请求中传入的原始值）。 |
| | | | \
|`code` |int |错误码。 |
| | | | \
|`message` |string |失败原因。 |

## 请求示例 {#7fa8b693}
```JSON
{
  "users": [
    { "email": "alice@example.com", "role": "admin" },
    { "email": "bob@example.com", "role": "member" }
  ]
}
```

## 响应示例 {#02d59eaa}
```JSON
{
  "code": 0,
  "message": "success",
  "request_id": "req_abc123xyz",
  "data": {
    "success_count": 2,
    "failed_items": [
      {
        "email": "exists@example.com",
        "code": 30001,
        "message": "user already exists in this tenant"
      }
    ]
  }
}
```


