NATSorganization.invitation.create发起组织邀请
Try it 面板需要启用 JavaScript。
生成一次性邀请令牌并经 OTP 通道向目标投递邀请消息。
Request Payload
消息格式:JSON
| Name | Data Type | Required | Description |
|---|---|---|---|
| orgId | string | Yes | 组织 ID |
| operatorId | string | Yes | 邀请人用户 ID |
| channel | string | Yes | phone / email |
| target | string | Yes | 被邀手机号 / 邮箱 |
| roleIds | array | No | 接受后授予的角色 |
type RequestBody = {
/** 组织 ID */
orgId: string
/** 邀请人用户 ID */
operatorId: string
/** phone / email */
channel: string
/** 被邀手机号 / 邮箱 */
target: string
/** 接受后授予的角色 */
roleIds?: string[]
}{
"orgId": "01JD8SRP1N4T8W6XQ5V9XDL2Y7K",
"operatorId": "01JD8SEGQ0P9N2XK4L7VDH3T6C",
"channel": "email",
"target": "liu.yang@example.com",
"roleIds": [
"01JD8SRR3N6V0X8ZS7X1ZFN4A9M"
]
}Response Payload
回复使用统一信封 {id, code, messages, result},其 result:
| Name | Data Type | Required | Description |
|---|---|---|---|
| invitationId | string | Yes | 邀请 ID |
| status | string | Yes | 固定为 pending |
| expiresAt | string | Yes | 过期时间 |
type ResponseBody = {
/** 邀请 ID */
invitationId: string
/** 固定为 pending */
status: string
/** 过期时间 */
expiresAt: string
}{
"invitationId": "01JD8SRT5N8X2Z0BU9Y3BHK6C1O",
"status": "pending",
"expiresAt": "2026-10-17T13:00:00Z"
}Response Code
回复使用统一信封 {id, code, messages, result},其 code 字段:
| code | Meaning | Notes |
|---|---|---|
| 0 | 成功 | 发起组织邀请 |
| 2504 | 目标用户已是成员 |
Examples
{
"orgId": "01JD8SRP1N4T8W6XQ5V9XDL2Y7K",
"operatorId": "01JD8SEGQ0P9N2XK4L7VDH3T6C",
"channel": "email",
"target": "liu.yang@example.com",
"roleIds": ["01JD8SRR3N6V0X8ZS7X1ZFN4A9M"]
}
{
"id": "01JD8SW7LW5Y2ZV",
"code": 0,
"messages": [],
"result": {
"invitationId": "01JD8SRT5N8X2Z0BU9Y3BHK6C1O",
"status": "pending",
"expiresAt": "2026-10-17T13:00:00Z"
}
}
Remarks
邀请令牌不进响应——只随投递消息到达被邀人。