邀请

创建邀请

post /v1/organizations/invites

创建邀请

请求体参数

  • email: string

    用户的邮箱地址。

  • role: "user" or "developer" or "billing" or "claude_code_user"

    被邀请用户的角色。不能为 "admin"。

    • "user"

    • "developer"

    • "billing"

    • "claude_code_user"

返回值

  • Invite object { id, email, expires_at, 4 more }

    • id: string

      邀请的 ID。

    • email: string

      被邀请用户的邮箱地址。

    • expires_at: string

      RFC 3339 日期时间字符串,表示邀请的过期时间。

    • invited_at: string

      RFC 3339 日期时间字符串,表示邀请的创建时间。

    • role: "user" or "developer" or "billing" or 2 more

      用户在组织中的角色。

      • "user"

      • "developer"

      • "billing"

      • "admin"

      • "claude_code_user"

    • status: "accepted" or "expired" or "deleted" or "pending"

      邀请的状态。

      • "accepted"

      • "expired"

      • "deleted"

      • "pending"

    • type: "invite"

      对象类型。

      对于邀请,始终为 "invite"

      • "invite"

示例

curl https://api.anthropic.com/v1/organizations/invites \
    -H 'Content-Type: application/json' \
    -H 'anthropic-version: 2023-06-01' \
    -H "X-Api-Key: $ANTHROPIC_ADMIN_API_KEY" \
    -d '{
          "email": "user@emaildomain.com",
          "role": "user"
        }'

响应

{
  "id": "invite_015gWxCN9Hfg2QhZwTK7Mdeu",
  "email": "user@emaildomain.com",
  "expires_at": "2024-11-20T23:58:27.427722Z",
  "invited_at": "2024-10-30T23:58:27.427722Z",
  "role": "user",
  "status": "pending",
  "type": "invite"
}

获取邀请

get /v1/organizations/invites/{invite_id}

获取邀请

路径参数

  • invite_id: string

    邀请的 ID。

返回值

  • Invite object { id, email, expires_at, 4 more }

    • id: string

      邀请的 ID。

    • email: string

      被邀请用户的邮箱地址。

    • expires_at: string

      RFC 3339 日期时间字符串,表示邀请的过期时间。

    • invited_at: string

      RFC 3339 日期时间字符串,表示邀请的创建时间。

    • role: "user" or "developer" or "billing" or 2 more

      用户在组织中的角色。

      • "user"

      • "developer"

      • "billing"

      • "admin"

      • "claude_code_user"

    • status: "accepted" or "expired" or "deleted" or "pending"

      邀请的状态。

      • "accepted"

      • "expired"

      • "deleted"

      • "pending"

    • type: "invite"

      对象类型。

      对于邀请,始终为 "invite"

      • "invite"

示例

curl https://api.anthropic.com/v1/organizations/invites/$INVITE_ID \
    -H 'anthropic-version: 2023-06-01' \
    -H "X-Api-Key: $ANTHROPIC_ADMIN_API_KEY"

响应

{
  "id": "invite_015gWxCN9Hfg2QhZwTK7Mdeu",
  "email": "user@emaildomain.com",
  "expires_at": "2024-11-20T23:58:27.427722Z",
  "invited_at": "2024-10-30T23:58:27.427722Z",
  "role": "user",
  "status": "pending",
  "type": "invite"
}

列出邀请

get /v1/organizations/invites

列出邀请

查询参数

  • after_id: optional string

    用作分页游标的对象 ID。提供后,将返回该对象之后的结果页。

  • before_id: optional string

    用作分页游标的对象 ID。提供后,将返回该对象之前的结果页。

  • limit: optional number

    每页返回的项目数量。

    默认为 20。范围为 11000

返回值

  • data: array of Invite

    • id: string

      邀请的 ID。

    • email: string

      被邀请用户的邮箱地址。

    • expires_at: string

      RFC 3339 日期时间字符串,表示邀请的过期时间。

    • invited_at: string

      RFC 3339 日期时间字符串,表示邀请的创建时间。

    • role: "user" or "developer" or "billing" or 2 more

      用户在组织中的角色。

      • "user"

      • "developer"

      • "billing"

      • "admin"

      • "claude_code_user"

    • status: "accepted" or "expired" or "deleted" or "pending"

      邀请的状态。

      • "accepted"

      • "expired"

      • "deleted"

      • "pending"

    • type: "invite"

      对象类型。

      对于邀请,始终为 "invite"

      • "invite"
  • first_id: string

    data 列表中的第一个 ID。可用作上一页的 before_id

  • has_more: boolean

    指示在请求的页面方向上是否还有更多结果。

  • last_id: string

    data 列表中的最后一个 ID。可用作下一页的 after_id

示例

curl https://api.anthropic.com/v1/organizations/invites \
    -H 'anthropic-version: 2023-06-01' \
    -H "X-Api-Key: $ANTHROPIC_ADMIN_API_KEY"

响应

{
  "data": [
    {
      "id": "invite_015gWxCN9Hfg2QhZwTK7Mdeu",
      "email": "user@emaildomain.com",
      "expires_at": "2024-11-20T23:58:27.427722Z",
      "invited_at": "2024-10-30T23:58:27.427722Z",
      "role": "user",
      "status": "pending",
      "type": "invite"
    }
  ],
  "first_id": "first_id",
  "has_more": true,
  "last_id": "last_id"
}

删除邀请

delete /v1/organizations/invites/{invite_id}

删除邀请

路径参数

  • invite_id: string

    邀请的 ID。

返回值

  • id: string

    邀请的 ID。

  • type: "invite_deleted"

    已删除的对象类型。

    对于邀请,始终为 "invite_deleted"

    • "invite_deleted"

示例

curl https://api.anthropic.com/v1/organizations/invites/$INVITE_ID \
    -X DELETE \
    -H 'anthropic-version: 2023-06-01' \
    -H "X-Api-Key: $ANTHROPIC_ADMIN_API_KEY"

响应

{
  "id": "invite_015gWxCN9Hfg2QhZwTK7Mdeu",
  "type": "invite_deleted"
}

领域类型

Invite

  • Invite object { id, email, expires_at, 4 more }

    • id: string

      邀请的 ID。

    • email: string

      被邀请用户的邮箱地址。

    • expires_at: string

      RFC 3339 日期时间字符串,表示邀请的过期时间。

    • invited_at: string

      RFC 3339 日期时间字符串,表示邀请的创建时间。

    • role: "user" or "developer" or "billing" or 2 more

      用户在组织中的角色。

      • "user"

      • "developer"

      • "billing"

      • "admin"

      • "claude_code_user"

    • status: "accepted" or "expired" or "deleted" or "pending"

      邀请的状态。

      • "accepted"

      • "expired"

      • "deleted"

      • "pending"

    • type: "invite"

      对象类型。

      对于邀请,始终为 "invite"

      • "invite"

Invite Delete Response

  • InviteDeleteResponse object { id, type }

    • id: string

      邀请的 ID。

    • type: "invite_deleted"

      已删除的对象类型。

      对于邀请,始终为 "invite_deleted"

      • "invite_deleted"