本页介绍如何使用 Admin API 以编程方式管理您 Claude Enterprise(claude.ai)组织中的人员:列出成员并按电子邮件地址查找成员、更改成员的角色、移除成员、发送和撤回邀请、管理企业的群组及其成员资格,以及读取组织的自定义角色。对于 Claude Console(Claude Platform)组织,请参阅 Claude Console 的 Admin API 指南。

注意

群组和自定义角色请求不需要 anthropic-beta: ce-user-management-2026-07-13 beta 标头。仍然发送该标头的请求会被接受,且行为完全相同。

您的组织可以使用哪些端点?

Admin API 是位于 https://api.anthropic.com/v1/organizations/ 下的一组端点。Claude Console 和 Claude Enterprise 组织使用不同的密钥进行身份验证,并且各自可以访问不同的端点子集:

端点 Claude Console(Claude Platform) Claude Enterprise(claude.ai)
成员和邀请 可用;请参阅 Admin API 指南 可用(本页)
群组 不可用 可用(本页)
自定义角色 不可用 可用,只读(本页)
插件和 Claude Tag 不可用 以 beta 形式提供
支出限额 不可用 可用
使用量和成本报告 可用;请参阅用量和成本分析 API 通过用量和成本分析 API以及Claude Enterprise 分析 API 提供
工作区、API 密钥、速率限制以及 Admin API 指南中的其他端点 可用 不可用

成员和邀请对两种组织类型使用相同的端点;本页记录它们在 Claude Enterprise 中的行为,包括 Claude Enterprise 的组织角色。群组和自定义角色端点仅适用于 Claude Enterprise。

须知

需要带作用域的 Admin API 密钥

这些端点需要具有以下作用域的 Admin API 密钥:read:members 作用域(成员和邀请的 GET 端点,以及所有自定义角色端点;没有单独的角色作用域)、write:members 作用域(成员和邀请的 POST 和 DELETE 端点)、read:rbac_groups 作用域(群组 GET 端点)或 write:rbac_groups 作用域(群组 POST 和 DELETE 端点)。分配 managed 角色或在邀请中分配群组时,除 write:members 外还需要 write:rbac_groups。带有 read:org_audit 作用域(用于安全审计集成的只读作用域)的密钥也可以调用本页上的所有 GET 端点以及 Compliance API 的读取端点。请参阅创建 Admin API 密钥,了解您的主所有者在何处创建密钥以及应选择哪些作用域。在每个请求中通过 x-api-key 标头传递密钥,并同时传递 anthropic-version 标头。

概述

本页涵盖五种资源:

资源 端点 用途
成员 GET /v1/organizations/users
GET /v1/organizations/users/{user_id}
POST /v1/organizations/users/{user_id}
DELETE /v1/organizations/users/{user_id}
列出组织的成员或按电子邮件查找成员;更改成员的角色;移除成员。
邀请 POST /v1/organizations/invites
GET /v1/organizations/invites
GET /v1/organizations/invites/{invite_id}
DELETE /v1/organizations/invites/{invite_id}
邀请某人加入组织、跟踪邀请状态,并在邀请被接受前撤回。
群组 GET /v1/organizations/rbac_groups
GET /v1/organizations/rbac_groups/{rbac_group_id}
POST /v1/organizations/rbac_groups
POST /v1/organizations/rbac_groups/{rbac_group_id}
DELETE /v1/organizations/rbac_groups/{rbac_group_id}
读取企业的群组以及附加到每个群组的自定义角色;创建、重命名和删除群组。
群组成员 GET /v1/organizations/rbac_groups/{rbac_group_id}/members
POST /v1/organizations/rbac_groups/{rbac_group_id}/members
DELETE /v1/organizations/rbac_groups/{rbac_group_id}/members/{user_id}
读取群组的成员;添加和移除成员。
自定义角色 GET /v1/organizations/rbac_roles
GET /v1/organizations/rbac_roles/{rbac_role_id}
GET /v1/organizations/rbac_roles/{rbac_role_id}/permissions
读取组织的自定义角色以及每个角色授予的权限。

自定义角色及其群组附加关系在 claude.ai 组织设置中管理;API 可以读取它们,但无法更改它们。

快速入门

将 ANTHROPIC_API_KEY 环境变量设置为您的 Admin API 密钥。本页上的示例会从该变量读取密钥。SDK 和 ant CLI 会为您发送 Authorization 和 anthropic-version 标头。

列出组织的成员,最新的排在最前:

cURL

curl "https://api.anthropic.com/v1/organizations/users?limit=20" \
  -H "x-api-key: $ANTHROPIC_API_KEY" \
  -H "anthropic-version: 2023-06-01"

CLI

ant organization:users list --limit 20

Python

client = anthropic.Anthropic()

users = client.organization.users.list(limit=20)

for user in users:
    print(f"{user.id}: {user.email} ({user.role})")

TypeScript

const client = new Anthropic();

const users = await client.organization.users.list({ limit: 20 });

for await (const user of users) {
  console.log(`${user.id}: ${user.email} (${user.role})`);
}

C#

AnthropicClient client = new();

var page = await client.Organization.Users.List(new() { Limit = 20 });

await foreach (var user in page.Paginate())
{
    Console.WriteLine($"{user.ID}: {user.Email} ({user.Role.Raw()})");
}

Go

client := anthropic.NewClient()

users := client.Organization.Users.ListAutoPaging(context.Background(), anthropic.OrganizationUserListParams{
	Limit: anthropic.Int(20),
})

for users.Next() {
	user := users.Current()
	fmt.Printf("%s: %s (%s)\n", user.ID, user.Email, user.Role)
}
if err := users.Err(); err != nil {
	log.Fatal(err)
}

Java

import com.anthropic.models.organization.users.UserListParams;

void main() {
    AnthropicClient client = AnthropicOkHttpClient.fromEnv();

    var params = UserListParams.builder()
        .limit(20)
        .build();
    var users = client.organization().users().list(params);

    for (var user : users.autoPager()) {
        IO.println(user.id() + ": " + user.email() + " (" + user.role().asString() + ")");
    }
}

PHP

$client = new Client();

$users = $client->organization->users->list(limit: 20);

foreach ($users->pagingEachItem() as $user) {
    echo "{$user->id}: {$user->email} ({$user->role})\n";
}

Ruby

client = Anthropic::Client.new

users = client.organization.users.list(limit: 20)

users.auto_paging_each do |user|
  puts "#{user.id}: #{user.email} (#{user.role})"
end
{
  "data": [
    {
      "type": "user",
      "id": "user_01AbCdEfGhIjKlMnOpQrSt",
      "email": "jane@example.com",
      "name": "Jane Smith",
      "role": "user",
      "added_at": "2026-06-12T09:14:03Z"
    }
  ],
  "has_more": false,
  "first_id": "user_01AbCdEfGhIjKlMnOpQrSt",
  "last_id": "user_01AbCdEfGhIjKlMnOpQrSt"
}

关键概念

组织角色

每个成员恰好拥有一个组织角色。读取操作会将成员的角色返回为以下五个值之一:

角色 含义
user 标准成员。
managed 其权限通过附加到其所在群组的自定义角色授予的成员。
owner 组织所有者。
membership_admin 可以管理组织成员的成员。
primary_owner 组织的主所有者。有且仅有一个。

API 只能在创建邀请和更新角色时分配 user 和 managed 角色。分配 managed 时,除 write:members 外还需要 write:rbac_groups 作用域,因为受管成员的权限来自附加到其所在群组的自定义角色。管理角色(owner、membership_admin 和 primary_owner)在 claude.ai 组织设置中分配,持有这些角色的成员无法通过此 API 修改或移除。

成员和邀请

一个人通过接受邀请(或在已配置的情况下通过组织的单点登录)成为成员。创建邀请会发送一封邀请电子邮件;之后邀请的状态显示为 pending,直到收件人接受(accepted)或超过服务器分配的 expires_at(expired)。只有 pending 状态的邀请可以撤回。要更改待处理邀请的电子邮件地址或角色,请撤回该邀请并创建一个新邀请。

如果您组织的套餐从有限的已购席位池中分配成员,则待处理的邀请会占用一个席位。创建邀请端点不接受席位或层级参数:席位会自动从有可用席位的最低层级中分配。在没有空闲席位时创建邀请会失败并返回 400 错误,而不会购买席位。撤回邀请、让邀请过期或之后移除该成员都会将席位归还到池中。

群组和角色

群组将成员与自定义角色关联起来(“role-based access control”(基于角色的访问控制),即端点路径和作用域名称中的 rbac)。群组归您的整个企业(父组织及其下的所有组织)所有,而不是归单个组织所有,因此群组作用域(read:rbac_groups 和 write:rbac_groups)需要为所有关联组织创建的密钥。每个群组都带有一个 source_type:direct 表示在 claude.ai 中创建的群组,scim 表示由您的身份提供商预配的群组。群组的 role_ids 字段列出附加到该群组的自定义角色的 ID;请使用自定义角色端点将其解析为名称和权限。请注意,角色目录是按组织划分的,而群组是企业范围的,因此获取属于您企业中其他组织的角色时,您的密钥会收到 404。当角色数据暂时不可用时,该字段为 null(而不是 []),因此请重试以区分降级读取和没有角色的群组。

版本控制

在每个请求中发送 anthropic-version 标头;有关可用版本,请参阅 API 版本。

速率限制

Admin API 端点共享每个组织每分钟 100 个请求的限制;邀请创建则有其单独的限制,为每小时 1,200 个请求。超出限制的请求会返回 429 Too Many Requests。

分页

成员和邀请列表使用基于 ID 的分页:传递 limit(默认 20,最大 1000)以及 before_id 或 after_id 中的至多一个,并使用每个响应的 first_id 和 last_id 字段进行翻页,直到 has_more 为 false。群组和自定义角色列表则使用不透明游标:将响应中的 next_page 值原样作为下一个请求的 page 参数传递,直到 next_page 为 null。

当您遍历结果时,SDK 会为您获取更多页面,因此 limit 设置的是页面大小,而不是总数。在 CLI 中,对于成员和邀请列表,--limit 设置结果总数;对于群组和角色列表,它设置页面大小。

错误响应

错误响应遵循错误中记录的标准格式。

成员

列出成员

GET /v1/organizations/users 返回组织的成员,最近添加的排在最前。按 email 筛选可查找特定成员;匹配不区分大小写,并且可以容忍同一地址的常见变体(例如,jane+hiring@example.com 匹配 jane@example.com)。需要 read:members 作用域。

有关完整的参数详细信息和响应架构,请参阅 API 参考中的列出用户。

cURL

curl "https://api.anthropic.com/v1/organizations/users?email=jane@example.com" \
  -H "x-api-key: $ANTHROPIC_API_KEY" \
  -H "anthropic-version: 2023-06-01"

CLI

ant organization:users list --email jane@example.com

Python

client = anthropic.Anthropic()

users = client.organization.users.list(email="jane@example.com")

for user in users:
    print(f"{user.id}: {user.email} ({user.role})")

TypeScript

const client = new Anthropic();

const users = await client.organization.users.list({ email: "jane@example.com" });

for await (const user of users) {
  console.log(`${user.id}: ${user.email} (${user.role})`);
}

C#

AnthropicClient client = new();

var page = await client.Organization.Users.List(new() { Email = "jane@example.com" });

await foreach (var user in page.Paginate())
{
    Console.WriteLine($"{user.ID}: {user.Email} ({user.Role.Raw()})");
}

Go

client := anthropic.NewClient()

users := client.Organization.Users.ListAutoPaging(context.Background(), anthropic.OrganizationUserListParams{
	Email: anthropic.String("jane@example.com"),
})

for users.Next() {
	user := users.Current()
	fmt.Printf("%s: %s (%s)\n", user.ID, user.Email, user.Role)
}
if err := users.Err(); err != nil {
	log.Fatal(err)
}

Java

import com.anthropic.models.organization.users.UserListParams;

void main() {
    AnthropicClient client = AnthropicOkHttpClient.fromEnv();

    var params = UserListParams.builder()
        .email("jane@example.com")
        .build();
    var users = client.organization().users().list(params);

    for (var user : users.autoPager()) {
        IO.println(user.id() + ": " + user.email() + " (" + user.role().asString() + ")");
    }
}

PHP

$client = new Client();

$users = $client->organization->users->list(email: 'jane@example.com');

foreach ($users->pagingEachItem() as $user) {
    echo "{$user->id}: {$user->email} ({$user->role})\n";
}

Ruby

client = Anthropic::Client.new

users = client.organization.users.list(email: "jane@example.com")

users.auto_paging_each do |user|
  puts "#{user.id}: #{user.email} (#{user.role})"
end

获取成员

GET /v1/organizations/users/{user_id} 按 ID 返回一个成员。需要 read:members 作用域。

有关完整的参数详细信息和响应架构,请参阅 API 参考中的获取用户。

cURL

curl "https://api.anthropic.com/v1/organizations/users/user_01AbCdEfGhIjKlMnOpQrSt" \
  -H "x-api-key: $ANTHROPIC_API_KEY" \
  -H "anthropic-version: 2023-06-01"

CLI

ant organization:users retrieve --user-id user_01AbCdEfGhIjKlMnOpQrSt

Python

client = anthropic.Anthropic()

user = client.organization.users.retrieve("user_01AbCdEfGhIjKlMnOpQrSt")

print(f"id: {user.id}")
print(f"email: {user.email}")
print(f"role: {user.role}")

TypeScript

const client = new Anthropic();

const user = await client.organization.users.retrieve("user_01AbCdEfGhIjKlMnOpQrSt");

console.log(`id: ${user.id}`);
console.log(`email: ${user.email}`);
console.log(`role: ${user.role}`);

C#

AnthropicClient client = new();

var user = await client.Organization.Users.Retrieve("user_01AbCdEfGhIjKlMnOpQrSt");

Console.WriteLine($"id: {user.ID}");
Console.WriteLine($"email: {user.Email}");
Console.WriteLine($"role: {user.Role.Raw()}");

Go

client := anthropic.NewClient()

user, err := client.Organization.Users.Get(context.Background(), "user_01AbCdEfGhIjKlMnOpQrSt")
if err != nil {
	log.Fatal(err)
}

fmt.Printf("id: %s\n", user.ID)
fmt.Printf("email: %s\n", user.Email)
fmt.Printf("role: %s\n", user.Role)

Java

AnthropicClient client = AnthropicOkHttpClient.fromEnv();

var user = client.organization().users()
    .retrieve("user_01AbCdEfGhIjKlMnOpQrSt");

IO.println("id: " + user.id());
IO.println("email: " + user.email());
IO.println("role: " + user.role().asString());

PHP

$client = new Client();

$user = $client->organization->users->retrieve(
    userID: 'user_01AbCdEfGhIjKlMnOpQrSt',
);

echo "id: {$user->id}\n";
echo "email: {$user->email}\n";
echo "role: {$user->role}\n";

Ruby

client = Anthropic::Client.new

user = client.organization.users.retrieve("user_01AbCdEfGhIjKlMnOpQrSt")

puts "id: #{user.id}"
puts "email: #{user.email}"
puts "role: #{user.role}"

更改成员的角色

POST /v1/organizations/users/{user_id} 将成员的角色设置为 user 或 managed。持有管理角色(owner、membership_admin 或 primary_owner)的成员无法通过此端点更改,也无法分配管理角色;这两种情况都会返回 400,并且需要在 claude.ai 组织设置中管理。如果您组织的身份提供商管理角色(高级 SSO 或高级 SCIM 预配),角色更新会返回 400。需要 write:members 作用域,将角色更改为 managed 时还需要 write:rbac_groups。

有关完整的参数详细信息和响应架构,请参阅 API 参考中的更新用户。

cURL

curl -X POST "https://api.anthropic.com/v1/organizations/users/user_01AbCdEfGhIjKlMnOpQrSt" \
  -H "content-type: application/json" \
  -H "x-api-key: $ANTHROPIC_API_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -d '{"role": "managed"}'

CLI

ant organization:users update \
  --user-id user_01AbCdEfGhIjKlMnOpQrSt \
  --role managed

Python

client = anthropic.Anthropic()

user = client.organization.users.update("user_01AbCdEfGhIjKlMnOpQrSt", role="managed")

print(f"id: {user.id}")
print(f"role: {user.role}")

TypeScript

const client = new Anthropic();

const user = await client.organization.users.update("user_01AbCdEfGhIjKlMnOpQrSt", {
  role: "managed"
});

console.log(`id: ${user.id}`);
console.log(`role: ${user.role}`);

C#

using Anthropic.Models.Organization.Users;
// ...

AnthropicClient client = new();

var user = await client.Organization.Users.Update(
    "user_01AbCdEfGhIjKlMnOpQrSt",
    new() { Role = Role.Managed }
);

Console.WriteLine($"id: {user.ID}");
Console.WriteLine($"role: {user.Role.Raw()}");

Go

client := anthropic.NewClient()

user, err := client.Organization.Users.Update(
	context.Background(),
	"user_01AbCdEfGhIjKlMnOpQrSt",
	anthropic.OrganizationUserUpdateParams{
		Role: anthropic.OrganizationUserUpdateParamsRoleManaged,
	},
)
if err != nil {
	log.Fatal(err)
}

fmt.Printf("id: %s\n", user.ID)
fmt.Printf("role: %s\n", user.Role)

Java

import com.anthropic.models.organization.users.UserUpdateParams;

void main() {
    AnthropicClient client = AnthropicOkHttpClient.fromEnv();

    var params = UserUpdateParams.builder()
        .role(UserUpdateParams.Role.MANAGED)
        .build();
    var user = client.organization().users()
        .update("user_01AbCdEfGhIjKlMnOpQrSt", params);

    IO.println("id: " + user.id());
    IO.println("role: " + user.role().asString());
}

PHP

use Anthropic\Organization\Users\UserUpdateParams\Role;
// ...

$client = new Client();

$user = $client->organization->users->update(
    userID: 'user_01AbCdEfGhIjKlMnOpQrSt',
    role: Role::MANAGED,
);

echo "id: {$user->id}\n";
echo "role: {$user->role}\n";

Ruby

client = Anthropic::Client.new

user_id = "user_01AbCdEfGhIjKlMnOpQrSt"
user = client.organization.users.update(user_id, role: :managed)

puts "id: #{user.id}"
puts "role: #{user.role}"

移除成员

DELETE /v1/organizations/users/{user_id} 将成员从组织中移除,并将其占用的任何已购席位归还到组织的池中。持有管理角色的成员无法通过此端点移除;如果您的身份提供商管理成员资格(SCIM),移除操作会返回 400。需要 write:members 作用域。

有关完整的参数详细信息和响应架构,请参阅 API 参考中的移除用户。

cURL

curl -X DELETE "https://api.anthropic.com/v1/organizations/users/user_01AbCdEfGhIjKlMnOpQrSt" \
  -H "x-api-key: $ANTHROPIC_API_KEY" \
  -H "anthropic-version: 2023-06-01"

CLI

ant organization:users remove --user-id user_01AbCdEfGhIjKlMnOpQrSt

Python

client = anthropic.Anthropic()

removed_user = client.organization.users.remove("user_01AbCdEfGhIjKlMnOpQrSt")

print(f"id: {removed_user.id}")

TypeScript

const client = new Anthropic();

const removedUser = await client.organization.users.remove("user_01AbCdEfGhIjKlMnOpQrSt");

console.log(`id: ${removedUser.id}`);

C#

AnthropicClient client = new();

var removedUser = await client.Organization.Users.Remove("user_01AbCdEfGhIjKlMnOpQrSt");

Console.WriteLine($"id: {removedUser.ID}");

Go

client := anthropic.NewClient()

removedUser, err := client.Organization.Users.Remove(context.Background(), "user_01AbCdEfGhIjKlMnOpQrSt")
if err != nil {
	log.Fatal(err)
}

fmt.Printf("id: %s\n", removedUser.ID)

Java

AnthropicClient client = AnthropicOkHttpClient.fromEnv();

var removedUser = client.organization().users()
    .remove("user_01AbCdEfGhIjKlMnOpQrSt");

IO.println("id: " + removedUser.id());

PHP

$client = new Client();

$removedUser = $client->organization->users->remove(
    userID: 'user_01AbCdEfGhIjKlMnOpQrSt',
);

echo "id: {$removedUser->id}\n";

Ruby

client = Anthropic::Client.new

user_id = "user_01AbCdEfGhIjKlMnOpQrSt"
removed_user = client.organization.users.remove(user_id)

puts "id: #{removed_user.id}"
{
  "type": "user_deleted",
  "id": "user_01AbCdEfGhIjKlMnOpQrSt"
}

邀请

创建邀请

POST /v1/organizations/invites 发送一封邀请电子邮件,并返回带有服务器分配的 expires_at 的邀请。role 必须为 user 或 managed。如果该电子邮件地址已存在待处理的邀请,或该地址已属于某个成员,请求会返回 400 并指明现有资源。身份提供商自动预配用户(JIT 或 SCIM)的组织无法通过 API 创建邀请。需要 write:members 作用域,当 role 为 managed 时还需要 write:rbac_groups。

在从有限席位池中分配成员的套餐上,邀请会自动从有可用席位的最低层级中占用一个席位。API 不接受层级参数。如果没有空闲席位,请求会失败并返回 400 错误,而不会购买席位。请通过组织的套餐管理添加席位后重试。

可选的 rbac_group_ids 字段列出在成员接受邀请时要分配给该成员的群组(使用带 rbac_group_ 前缀的 ID)。传递非空的 rbac_group_ids 还要求密钥带有 write:rbac_groups 作用域,因为群组分配可能会授予附加到群组角色的权限。

有关完整的参数详细信息和响应架构,请参阅 API 参考中的创建邀请。

cURL

curl -X POST "https://api.anthropic.com/v1/organizations/invites" \
  -H "content-type: application/json" \
  -H "x-api-key: $ANTHROPIC_API_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -d '{
    "email": "newhire@example.com",
    "role": "managed",
    "rbac_group_ids": ["rbac_group_01UvWxYzAbCdEfGhIjKlMn"]
  }'

CLI

ant organization:invites create \
  --email newhire@example.com \
  --role managed \
  --rbac-group-id rbac_group_01UvWxYzAbCdEfGhIjKlMn

Python

client = anthropic.Anthropic()

invite = client.organization.invites.create(
    email="newhire@example.com",
    role="managed",
    rbac_group_ids=["rbac_group_01UvWxYzAbCdEfGhIjKlMn"],
)

print(f"id: {invite.id}")
print(f"email: {invite.email}")
print(f"status: {invite.status}")
print(f"expires_at: {invite.expires_at}")

TypeScript

const client = new Anthropic();

const invite = await client.organization.invites.create({
  email: "newhire@example.com",
  role: "managed",
  rbac_group_ids: ["rbac_group_01UvWxYzAbCdEfGhIjKlMn"]
});

console.log(`id: ${invite.id}`);
console.log(`email: ${invite.email}`);
console.log(`status: ${invite.status}`);
console.log(`expires_at: ${invite.expires_at}`);

C#

using Anthropic.Models.Organization.Invites;
// ...

AnthropicClient client = new();

var invite = await client.Organization.Invites.Create(new()
{
    Email = "newhire@example.com",
    Role = Role.Managed,
    RbacGroupIds = ["rbac_group_01UvWxYzAbCdEfGhIjKlMn"]
});

Console.WriteLine($"id: {invite.ID}");
Console.WriteLine($"email: {invite.Email}");
Console.WriteLine($"status: {invite.Status.Raw()}");
Console.WriteLine($"expires_at: {invite.ExpiresAt:O}");

Go

client := anthropic.NewClient()

invite, err := client.Organization.Invites.New(context.Background(), anthropic.OrganizationInviteNewParams{
	Email:        "newhire@example.com",
	Role:         anthropic.OrganizationInviteNewParamsRoleManaged,
	RBACGroupIDs: []string{"rbac_group_01UvWxYzAbCdEfGhIjKlMn"},
})
if err != nil {
	log.Fatal(err)
}

fmt.Printf("id: %s\n", invite.ID)
fmt.Printf("email: %s\n", invite.Email)
fmt.Printf("status: %s\n", invite.Status)
fmt.Printf("expires_at: %s\n", invite.ExpiresAt.Format(time.RFC3339))

Java

import com.anthropic.models.organization.invites.InviteCreateParams;

void main() {
    AnthropicClient client = AnthropicOkHttpClient.fromEnv();

    var params = InviteCreateParams.builder()
        .email("newhire@example.com")
        .role(InviteCreateParams.Role.MANAGED)
        .addRbacGroupId("rbac_group_01UvWxYzAbCdEfGhIjKlMn")
        .build();
    var invite = client.organization().invites().create(params);

    IO.println("id: " + invite.id());
    IO.println("email: " + invite.email());
    IO.println("status: " + invite.status().asString());
    IO.println("expires_at: " + invite.expiresAt());
}

PHP

use Anthropic\Organization\Invites\InviteCreateParams\Role;
// ...

$client = new Client();

$invite = $client->organization->invites->create(
    email: 'newhire@example.com',
    role: Role::MANAGED,
    rbacGroupIDs: ['rbac_group_01UvWxYzAbCdEfGhIjKlMn'],
);

echo "id: {$invite->id}\n";
echo "email: {$invite->email}\n";
echo "status: {$invite->status}\n";
echo "expires_at: {$invite->expiresAt->format(DATE_ATOM)}\n";

Ruby

client = Anthropic::Client.new

invite = client.organization.invites.create(
  email: "newhire@example.com",
  role: :managed,
  rbac_group_ids: ["rbac_group_01UvWxYzAbCdEfGhIjKlMn"]
)

puts "id: #{invite.id}"
puts "email: #{invite.email}"
puts "status: #{invite.status}"
puts "expires_at: #{invite.expires_at.iso8601}"
{
  "type": "invite",
  "id": "invite_01QrStUvWxYzAbCdEfGhIj",
  "email": "newhire@example.com",
  "role": "managed",
  "invited_at": "2026-07-06T16:20:11Z",
  "expires_at": "2026-07-27T16:20:11Z",
  "accepted_at": null,
  "status": "pending",
  "rbac_group_ids": ["rbac_group_01UvWxYzAbCdEfGhIjKlMn"]
}

列出邀请

GET /v1/organizations/invites 返回组织的邀请,最新的排在最前,涵盖 pending、accepted 和 expired 状态;没有状态筛选器。需要 read:members 作用域。

有关完整的参数详细信息和响应架构,请参阅 API 参考中的列出邀请。

cURL

curl "https://api.anthropic.com/v1/organizations/invites?limit=20" \
  -H "x-api-key: $ANTHROPIC_API_KEY" \
  -H "anthropic-version: 2023-06-01"

CLI

ant organization:invites list --limit 20

Python

client = anthropic.Anthropic()

invites = client.organization.invites.list(limit=20)

for invite in invites:
    print(f"{invite.id}: {invite.email} ({invite.status})")

TypeScript

const client = new Anthropic();

const invites = await client.organization.invites.list({ limit: 20 });

for await (const invite of invites) {
  console.log(`${invite.id}: ${invite.email} (${invite.status})`);
}

C#

AnthropicClient client = new();

var page = await client.Organization.Invites.List(new() { Limit = 20 });

await foreach (var invite in page.Paginate())
{
    Console.WriteLine($"{invite.ID}: {invite.Email} ({invite.Status.Raw()})");
}

Go

client := anthropic.NewClient()

invites := client.Organization.Invites.ListAutoPaging(context.Background(), anthropic.OrganizationInviteListParams{
	Limit: anthropic.Int(20),
})

for invites.Next() {
	invite := invites.Current()
	fmt.Printf("%s: %s (%s)\n", invite.ID, invite.Email, invite.Status)
}
if err := invites.Err(); err != nil {
	log.Fatal(err)
}

Java

import com.anthropic.models.organization.invites.InviteListParams;

void main() {
    AnthropicClient client = AnthropicOkHttpClient.fromEnv();

    var params = InviteListParams.builder()
        .limit(20)
        .build();
    var invites = client.organization().invites().list(params);

    for (var invite : invites.autoPager()) {
        IO.println(invite.id() + ": " + invite.email() + " (" + invite.status().asString() + ")");
    }
}

PHP

$client = new Client();

$invites = $client->organization->invites->list(limit: 20);

foreach ($invites->pagingEachItem() as $invite) {
    echo "{$invite->id}: {$invite->email} ({$invite->status})\n";
}

Ruby

client = Anthropic::Client.new

invites = client.organization.invites.list(limit: 20)

invites.auto_paging_each do |invite|
  puts "#{invite.id}: #{invite.email} (#{invite.status})"
end

获取邀请

GET /v1/organizations/invites/{invite_id} 按 ID 返回一个邀请。需要 read:members 作用域。

有关完整的参数详细信息和响应架构,请参阅 API 参考中的获取邀请。

cURL

curl "https://api.anthropic.com/v1/organizations/invites/invite_01QrStUvWxYzAbCdEfGhIj" \
  -H "x-api-key: $ANTHROPIC_API_KEY" \
  -H "anthropic-version: 2023-06-01"

CLI

ant organization:invites retrieve --invite-id invite_01QrStUvWxYzAbCdEfGhIj

Python

client = anthropic.Anthropic()

invite = client.organization.invites.retrieve("invite_01QrStUvWxYzAbCdEfGhIj")

print(f"id: {invite.id}")
print(f"email: {invite.email}")
print(f"status: {invite.status}")

TypeScript

const client = new Anthropic();

const invite = await client.organization.invites.retrieve("invite_01QrStUvWxYzAbCdEfGhIj");

console.log(`id: ${invite.id}`);
console.log(`email: ${invite.email}`);
console.log(`status: ${invite.status}`);

C#

AnthropicClient client = new();

var invite = await client.Organization.Invites.Retrieve("invite_01QrStUvWxYzAbCdEfGhIj");

Console.WriteLine($"id: {invite.ID}");
Console.WriteLine($"email: {invite.Email}");
Console.WriteLine($"status: {invite.Status.Raw()}");

Go

client := anthropic.NewClient()

invite, err := client.Organization.Invites.Get(context.Background(), "invite_01QrStUvWxYzAbCdEfGhIj")
if err != nil {
	log.Fatal(err)
}

fmt.Printf("id: %s\n", invite.ID)
fmt.Printf("email: %s\n", invite.Email)
fmt.Printf("status: %s\n", invite.Status)

Java

AnthropicClient client = AnthropicOkHttpClient.fromEnv();

var invite = client.organization().invites()
    .retrieve("invite_01QrStUvWxYzAbCdEfGhIj");

IO.println("id: " + invite.id());
IO.println("email: " + invite.email());
IO.println("status: " + invite.status().asString());

PHP

$client = new Client();

$invite = $client->organization->invites->retrieve(
    inviteID: 'invite_01QrStUvWxYzAbCdEfGhIj',
);

echo "id: {$invite->id}\n";
echo "email: {$invite->email}\n";
echo "status: {$invite->status}\n";

Ruby

client = Anthropic::Client.new

invite = client.organization.invites.retrieve("invite_01QrStUvWxYzAbCdEfGhIj")

puts "id: #{invite.id}"
puts "email: #{invite.email}"
puts "status: #{invite.status}"

撤回邀请

DELETE /v1/organizations/invites/{invite_id} 撤回一个 pending 状态的邀请,使邀请电子邮件中的链接失效。撤回 accepted 状态的邀请会返回 400(请改为移除该成员);撤回 expired 状态的邀请会返回 400。需要 write:members 作用域。

有关完整的参数详细信息和响应架构,请参阅 API 参考中的删除邀请。

cURL

curl -X DELETE "https://api.anthropic.com/v1/organizations/invites/invite_01QrStUvWxYzAbCdEfGhIj" \
  -H "x-api-key: $ANTHROPIC_API_KEY" \
  -H "anthropic-version: 2023-06-01"

CLI

ant organization:invites delete --invite-id invite_01QrStUvWxYzAbCdEfGhIj

Python

client = anthropic.Anthropic()

deleted_invite = client.organization.invites.delete("invite_01QrStUvWxYzAbCdEfGhIj")

print(f"id: {deleted_invite.id}")

TypeScript

const client = new Anthropic();

const deletedInvite = await client.organization.invites.delete(
  "invite_01QrStUvWxYzAbCdEfGhIj"
);

console.log(`id: ${deletedInvite.id}`);

C#

AnthropicClient client = new();

var deletedInvite = await client.Organization.Invites.Delete("invite_01QrStUvWxYzAbCdEfGhIj");

Console.WriteLine($"id: {deletedInvite.ID}");

Go

client := anthropic.NewClient()

deletedInvite, err := client.Organization.Invites.Delete(context.Background(), "invite_01QrStUvWxYzAbCdEfGhIj")
if err != nil {
	log.Fatal(err)
}

fmt.Printf("id: %s\n", deletedInvite.ID)

Java

AnthropicClient client = AnthropicOkHttpClient.fromEnv();

var deletedInvite = client.organization().invites()
    .delete("invite_01QrStUvWxYzAbCdEfGhIj");

IO.println("id: " + deletedInvite.id());

PHP

$client = new Client();

$deletedInvite = $client->organization->invites->delete(
    inviteID: 'invite_01QrStUvWxYzAbCdEfGhIj',
);

echo "id: {$deletedInvite->id}\n";

Ruby

client = Anthropic::Client.new

invite_id = "invite_01QrStUvWxYzAbCdEfGhIj"
deleted_invite = client.organization.invites.delete(invite_id)

puts "id: #{deleted_invite.id}"

群组

您的企业直接创建的群组(在 claude.ai 组织设置中或通过此 API 创建,source_type: "direct")支持本节中的所有端点。由您的身份提供商预配的群组(source_type: "scim")可以读取但不能修改:重命名或删除 SCIM 群组,或更改其成员资格,都会返回 400,因为该群组归您的身份提供商所有。

列出群组

GET /v1/organizations/rbac_groups 返回您企业的群组,包括由身份提供商管理的(scim)群组。需要 read:rbac_groups 作用域。

有关完整的参数详细信息和响应架构,请参阅 API 参考中的列出群组。

cURL

curl "https://api.anthropic.com/v1/organizations/rbac_groups?limit=20" \
  -H "x-api-key: $ANTHROPIC_API_KEY" \
  -H "anthropic-version: 2023-06-01"

CLI

ant beta:organization:rbac-groups list --limit 20

Python

client = anthropic.Anthropic()

groups = client.beta.organization.rbac_groups.list(limit=20)

for group in groups:
    print(f"{group.id}: {group.name} ({group.source_type})")

TypeScript

const client = new Anthropic();

const groups = await client.beta.organization.rbacGroups.list({ limit: 20 });

for await (const group of groups) {
  console.log(`${group.id}: ${group.name} (${group.source_type})`);
}

C#

AnthropicClient client = new();

var page = await client.Beta.Organization.RbacGroups.List(new() { Limit = 20 });

await foreach (var group in page.Paginate())
{
    Console.WriteLine($"{group.ID}: {group.Name} ({group.SourceType.Raw()})");
}

Go

client := anthropic.NewClient()

groups := client.Beta.Organization.RBACGroups.ListAutoPaging(context.Background(), anthropic.BetaOrganizationRBACGroupListParams{
	Limit: anthropic.Int(20),
})

for groups.Next() {
	group := groups.Current()
	fmt.Printf("%s: %s (%s)\n", group.ID, group.Name, group.SourceType)
}
if err := groups.Err(); err != nil {
	log.Fatal(err)
}

Java

import com.anthropic.models.beta.organization.rbacgroups.RbacGroupListParams;

void main() {
    AnthropicClient client = AnthropicOkHttpClient.fromEnv();

    var params = RbacGroupListParams.builder()
        .limit(20)
        .build();
    var groups = client.beta().organization().rbacGroups().list(params);

    for (var group : groups.autoPager()) {
        IO.println(group.id() + ": " + group.name() + " (" + group.sourceType().asString() + ")");
    }
}

PHP

$client = new Client();

$groups = $client->beta->organization->rbacGroups->list(limit: 20);

foreach ($groups->pagingEachItem() as $group) {
    echo "{$group->id}: {$group->name} ({$group->sourceType})\n";
}

Ruby

client = Anthropic::Client.new

groups = client.beta.organization.rbac_groups.list(limit: 20)

groups.auto_paging_each do |group|
  puts "#{group.id}: #{group.name} (#{group.source_type})"
end
{
  "data": [
    {
      "type": "rbac_group",
      "id": "rbac_group_01UvWxYzAbCdEfGhIjKlMn",
      "name": "Engineering",
      "source_type": "direct",
      "role_ids": ["rbac_role_01CdEfGhIjKlMnOpQrStUv"],
      "roles": ["rbac_role_01CdEfGhIjKlMnOpQrStUv"],
      "created_at": "2026-03-18T10:01:42Z",
      "updated_at": "2026-05-02T08:55:09Z"
    }
  ],
  "has_more": false,
  "next_page": null
}

获取群组

GET /v1/organizations/rbac_groups/{rbac_group_id} 按 ID 返回一个群组。需要 read:rbac_groups 作用域。

有关完整的参数详细信息和响应架构,请参阅 API 参考中的获取群组。

cURL

curl "https://api.anthropic.com/v1/organizations/rbac_groups/rbac_group_01UvWxYzAbCdEfGhIjKlMn" \
  -H "x-api-key: $ANTHROPIC_API_KEY" \
  -H "anthropic-version: 2023-06-01"

CLI

ant beta:organization:rbac-groups retrieve \
  --rbac-group-id rbac_group_01UvWxYzAbCdEfGhIjKlMn

Python

client = anthropic.Anthropic()

group = client.beta.organization.rbac_groups.retrieve(
    "rbac_group_01UvWxYzAbCdEfGhIjKlMn"
)

print(f"id: {group.id}")
print(f"name: {group.name}")
print(f"source_type: {group.source_type}")

TypeScript

const client = new Anthropic();

const group = await client.beta.organization.rbacGroups.retrieve(
  "rbac_group_01UvWxYzAbCdEfGhIjKlMn"
);

console.log(`id: ${group.id}`);
console.log(`name: ${group.name}`);
console.log(`source_type: ${group.source_type}`);

C#

AnthropicClient client = new();

var group = await client.Beta.Organization.RbacGroups.Retrieve("rbac_group_01UvWxYzAbCdEfGhIjKlMn");

Console.WriteLine($"id: {group.ID}");
Console.WriteLine($"name: {group.Name}");
Console.WriteLine($"source_type: {group.SourceType.Raw()}");

Go

client := anthropic.NewClient()

group, err := client.Beta.Organization.RBACGroups.Get(context.Background(), "rbac_group_01UvWxYzAbCdEfGhIjKlMn")
if err != nil {
	log.Fatal(err)
}

fmt.Printf("id: %s\n", group.ID)
fmt.Printf("name: %s\n", group.Name)
fmt.Printf("source_type: %s\n", group.SourceType)

Java

AnthropicClient client = AnthropicOkHttpClient.fromEnv();

var group = client.beta().organization().rbacGroups()
    .retrieve("rbac_group_01UvWxYzAbCdEfGhIjKlMn");

IO.println("id: " + group.id());
IO.println("name: " + group.name());
IO.println("source_type: " + group.sourceType().asString());

PHP

$client = new Client();

$group = $client->beta->organization->rbacGroups->retrieve(
    rbacGroupID: 'rbac_group_01UvWxYzAbCdEfGhIjKlMn',
);

echo "id: {$group->id}\n";
echo "name: {$group->name}\n";
echo "source_type: {$group->sourceType}\n";

Ruby

client = Anthropic::Client.new

rbac_group_id = "rbac_group_01UvWxYzAbCdEfGhIjKlMn"
group = client.beta.organization.rbac_groups.retrieve(rbac_group_id)

puts "id: #{group.id}"
puts "name: #{group.name}"
puts "source_type: #{group.source_type}"

创建群组

POST /v1/organizations/rbac_groups 使用给定的 name(1–255 个字符)创建一个没有角色或成员的群组。需要 write:rbac_groups 作用域。

有关完整的参数详细信息和响应架构,请参阅 API 参考中的创建群组。

cURL

curl -X POST "https://api.anthropic.com/v1/organizations/rbac_groups" \
  -H "content-type: application/json" \
  -H "x-api-key: $ANTHROPIC_API_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -d '{"name": "Engineering"}'

CLI

ant beta:organization:rbac-groups create --name Engineering

Python

client = anthropic.Anthropic()

group = client.beta.organization.rbac_groups.create(name="Engineering")

print(f"id: {group.id}")
print(f"name: {group.name}")

TypeScript

const client = new Anthropic();

const group = await client.beta.organization.rbacGroups.create({ name: "Engineering" });

console.log(`id: ${group.id}`);
console.log(`name: ${group.name}`);

C#

AnthropicClient client = new();

var group = await client.Beta.Organization.RbacGroups.Create(new()
{
    Name = "Engineering"
});

Console.WriteLine($"id: {group.ID}");
Console.WriteLine($"name: {group.Name}");

Go

client := anthropic.NewClient()

group, err := client.Beta.Organization.RBACGroups.New(context.Background(), anthropic.BetaOrganizationRBACGroupNewParams{
	Name: "Engineering",
})
if err != nil {
	log.Fatal(err)
}

fmt.Printf("id: %s\n", group.ID)
fmt.Printf("name: %s\n", group.Name)

Java

import com.anthropic.models.beta.organization.rbacgroups.RbacGroupCreateParams;

void main() {
    AnthropicClient client = AnthropicOkHttpClient.fromEnv();

    var params = RbacGroupCreateParams.builder()
        .name("Engineering")
        .build();
    var group = client.beta().organization().rbacGroups().create(params);

    IO.println("id: " + group.id());
    IO.println("name: " + group.name());
}

PHP

$client = new Client();

$group = $client->beta->organization->rbacGroups->create(
    name: 'Engineering',
);

echo "id: {$group->id}\n";
echo "name: {$group->name}\n";

Ruby

client = Anthropic::Client.new

group = client.beta.organization.rbac_groups.create(name: "Engineering")

puts "id: #{group.id}"
puts "name: #{group.name}"
{
  "type": "rbac_group",
  "id": "rbac_group_01UvWxYzAbCdEfGhIjKlMn",
  "name": "Engineering",
  "source_type": "direct",
  "role_ids": [],
  "roles": [],
  "created_at": "2026-07-09T18:00:00Z",
  "updated_at": "2026-07-09T18:00:00Z"
}

重命名群组

POST /v1/organizations/rbac_groups/{rbac_group_id} 更新群组。name 是此端点唯一可以更改的字段。需要 write:rbac_groups 作用域。

有关完整的参数详细信息和响应架构,请参阅 API 参考中的更新群组。

cURL

curl -X POST "https://api.anthropic.com/v1/organizations/rbac_groups/rbac_group_01UvWxYzAbCdEfGhIjKlMn" \
  -H "content-type: application/json" \
  -H "x-api-key: $ANTHROPIC_API_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -d '{"name": "Platform Engineering"}'

CLI

ant beta:organization:rbac-groups update \
  --rbac-group-id rbac_group_01UvWxYzAbCdEfGhIjKlMn \
  --name "Platform Engineering"

Python

client = anthropic.Anthropic()

group = client.beta.organization.rbac_groups.update(
    "rbac_group_01UvWxYzAbCdEfGhIjKlMn", name="Platform Engineering"
)

print(f"id: {group.id}")
print(f"name: {group.name}")

TypeScript

const client = new Anthropic();

const group = await client.beta.organization.rbacGroups.update(
  "rbac_group_01UvWxYzAbCdEfGhIjKlMn",
  { name: "Platform Engineering" }
);

console.log(`id: ${group.id}`);
console.log(`name: ${group.name}`);

C#

AnthropicClient client = new();

var group = await client.Beta.Organization.RbacGroups.Update(
    "rbac_group_01UvWxYzAbCdEfGhIjKlMn",
    new() { Name = "Platform Engineering" }
);

Console.WriteLine($"id: {group.ID}");
Console.WriteLine($"name: {group.Name}");

Go

client := anthropic.NewClient()

group, err := client.Beta.Organization.RBACGroups.Update(
	context.Background(),
	"rbac_group_01UvWxYzAbCdEfGhIjKlMn",
	anthropic.BetaOrganizationRBACGroupUpdateParams{
		Name: anthropic.String("Platform Engineering"),
	},
)
if err != nil {
	log.Fatal(err)
}

fmt.Printf("id: %s\n", group.ID)
fmt.Printf("name: %s\n", group.Name)

Java

import com.anthropic.models.beta.organization.rbacgroups.RbacGroupUpdateParams;

void main() {
    AnthropicClient client = AnthropicOkHttpClient.fromEnv();

    var params = RbacGroupUpdateParams.builder()
        .name("Platform Engineering")
        .build();
    var group = client.beta().organization().rbacGroups()
        .update("rbac_group_01UvWxYzAbCdEfGhIjKlMn", params);

    IO.println("id: " + group.id());
    IO.println("name: " + group.name());
}

PHP

$client = new Client();

$group = $client->beta->organization->rbacGroups->update(
    rbacGroupID: 'rbac_group_01UvWxYzAbCdEfGhIjKlMn',
    name: 'Platform Engineering',
);

echo "id: {$group->id}\n";
echo "name: {$group->name}\n";

Ruby

client = Anthropic::Client.new

rbac_group_id = "rbac_group_01UvWxYzAbCdEfGhIjKlMn"
group = client.beta.organization.rbac_groups.update(rbac_group_id, name: "Platform Engineering")

puts "id: #{group.id}"
puts "name: #{group.name}"

删除群组

DELETE /v1/organizations/rbac_groups/{rbac_group_id} 删除群组。其成员仍然是各自组织的成员,但会失去该群组所附加角色的权限,并且群组支出限额(如果存在)将不再适用于他们。需要 write:rbac_groups 作用域。

有关完整的参数详细信息和响应架构,请参阅 API 参考中的删除群组。

cURL

curl -X DELETE "https://api.anthropic.com/v1/organizations/rbac_groups/rbac_group_01UvWxYzAbCdEfGhIjKlMn" \
  -H "x-api-key: $ANTHROPIC_API_KEY" \
  -H "anthropic-version: 2023-06-01"

CLI

ant beta:organization:rbac-groups delete \
  --rbac-group-id rbac_group_01UvWxYzAbCdEfGhIjKlMn

Python

client = anthropic.Anthropic()

deleted_group = client.beta.organization.rbac_groups.delete(
    "rbac_group_01UvWxYzAbCdEfGhIjKlMn"
)

print(f"id: {deleted_group.id}")

TypeScript

const client = new Anthropic();

const deletedGroup = await client.beta.organization.rbacGroups.delete(
  "rbac_group_01UvWxYzAbCdEfGhIjKlMn"
);

console.log(`id: ${deletedGroup.id}`);

C#

AnthropicClient client = new();

var deletedGroup = await client.Beta.Organization.RbacGroups.Delete(
    "rbac_group_01UvWxYzAbCdEfGhIjKlMn"
);

Console.WriteLine($"id: {deletedGroup.ID}");

Go

client := anthropic.NewClient()

deletedGroup, err := client.Beta.Organization.RBACGroups.Delete(context.Background(), "rbac_group_01UvWxYzAbCdEfGhIjKlMn")
if err != nil {
	log.Fatal(err)
}

fmt.Printf("id: %s\n", deletedGroup.ID)

Java

AnthropicClient client = AnthropicOkHttpClient.fromEnv();

var deletedGroup = client.beta().organization().rbacGroups()
    .delete("rbac_group_01UvWxYzAbCdEfGhIjKlMn");

IO.println("id: " + deletedGroup.id());

PHP

$client = new Client();

$deletedGroup = $client->beta->organization->rbacGroups->delete(
    rbacGroupID: 'rbac_group_01UvWxYzAbCdEfGhIjKlMn',
);

echo "id: {$deletedGroup->id}\n";

Ruby

client = Anthropic::Client.new

rbac_group_id = "rbac_group_01UvWxYzAbCdEfGhIjKlMn"
deleted_group = client.beta.organization.rbac_groups.delete(rbac_group_id)

puts "id: #{deleted_group.id}"
{
  "id": "rbac_group_01UvWxYzAbCdEfGhIjKlMn",
  "type": "rbac_group_deleted"
}

列出群组的成员

GET /v1/organizations/rbac_groups/{rbac_group_id}/members 返回群组的成员(每个成员都带有其 user_id 和电子邮件),最早的排在最前。只会返回您企业各组织的当前成员,因此在 has_more 为 true 时,一个页面包含的条目可能少于 limit。需要 read:rbac_groups 作用域。

有关完整的参数详细信息和响应架构,请参阅 API 参考中的列出群组成员。

cURL

curl "https://api.anthropic.com/v1/organizations/rbac_groups/rbac_group_01UvWxYzAbCdEfGhIjKlMn/members?limit=100" \
  -H "x-api-key: $ANTHROPIC_API_KEY" \
  -H "anthropic-version: 2023-06-01"

CLI

ant beta:organization:rbac-groups:members list \
  --rbac-group-id rbac_group_01UvWxYzAbCdEfGhIjKlMn \
  --limit 100

Python

client = anthropic.Anthropic()

members = client.beta.organization.rbac_groups.members.list(
    "rbac_group_01UvWxYzAbCdEfGhIjKlMn", limit=100
)

for member in members:
    print(f"{member.user_id}: {member.email}")

TypeScript

const client = new Anthropic();

const members = await client.beta.organization.rbacGroups.members.list(
  "rbac_group_01UvWxYzAbCdEfGhIjKlMn",
  { limit: 100 }
);

for await (const member of members) {
  console.log(`${member.user_id}: ${member.email}`);
}

C#

AnthropicClient client = new();

var page = await client.Beta.Organization.RbacGroups.Members.List(
    "rbac_group_01UvWxYzAbCdEfGhIjKlMn",
    new() { Limit = 100 }
);

await foreach (var member in page.Paginate())
{
    Console.WriteLine($"{member.UserID}: {member.Email}");
}

Go

client := anthropic.NewClient()

members := client.Beta.Organization.RBACGroups.Members.ListAutoPaging(
	context.Background(),
	"rbac_group_01UvWxYzAbCdEfGhIjKlMn",
	anthropic.BetaOrganizationRBACGroupMemberListParams{
		Limit: anthropic.Int(100),
	},
)

for members.Next() {
	member := members.Current()
	fmt.Printf("%s: %s\n", member.UserID, member.Email)
}
if err := members.Err(); err != nil {
	log.Fatal(err)
}

Java

import com.anthropic.models.beta.organization.rbacgroups.members.MemberListParams;

void main() {
    AnthropicClient client = AnthropicOkHttpClient.fromEnv();

    var params = MemberListParams.builder()
        .limit(100)
        .build();
    var members = client.beta().organization().rbacGroups().members()
        .list("rbac_group_01UvWxYzAbCdEfGhIjKlMn", params);

    for (var member : members.autoPager()) {
        IO.println(member.userId() + ": " + member.email());
    }
}

PHP

$client = new Client();

$members = $client->beta->organization->rbacGroups->members->list(
    rbacGroupID: 'rbac_group_01UvWxYzAbCdEfGhIjKlMn',
    limit: 100,
);

foreach ($members->pagingEachItem() as $member) {
    echo "{$member->userID}: {$member->email}\n";
}

Ruby

client = Anthropic::Client.new

rbac_group_id = "rbac_group_01UvWxYzAbCdEfGhIjKlMn"
members = client.beta.organization.rbac_groups.members.list(rbac_group_id, limit: 100)

members.auto_paging_each do |member|
  puts "#{member.user_id}: #{member.email}"
end
{
  "data": [
    {
      "type": "rbac_group_member",
      "rbac_group_id": "rbac_group_01UvWxYzAbCdEfGhIjKlMn",
      "group_id": "rbac_group_01UvWxYzAbCdEfGhIjKlMn",
      "user_id": "user_01AbCdEfGhIjKlMnOpQrSt",
      "email": "jane@example.com",
      "created_at": "2026-04-07T12:30:00Z"
    }
  ],
  "has_more": false,
  "next_page": null
}

向群组添加成员

POST /v1/organizations/rbac_groups/{rbac_group_id}/members 按 user_id 将组织成员添加到群组。该用户必须已经是您企业某个组织的成员(否则请求返回 404),添加已在群组中的人员会返回 400。对于 scim 群组,成员资格在您的身份提供商中管理,此请求会返回 400。要为尚未加入的人员分配群组,请改为在创建邀请时使用 rbac_group_ids。需要 write:rbac_groups 作用域。

有关完整的参数详细信息和响应架构,请参阅 API 参考中的添加群组成员。

cURL

curl -X POST "https://api.anthropic.com/v1/organizations/rbac_groups/rbac_group_01UvWxYzAbCdEfGhIjKlMn/members" \
  -H "content-type: application/json" \
  -H "x-api-key: $ANTHROPIC_API_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -d '{"user_id": "user_01AbCdEfGhIjKlMnOpQrSt"}'

CLI

ant beta:organization:rbac-groups:members add \
  --rbac-group-id rbac_group_01UvWxYzAbCdEfGhIjKlMn \
  --user-id user_01AbCdEfGhIjKlMnOpQrSt

Python

client = anthropic.Anthropic()

member = client.beta.organization.rbac_groups.members.add(
    "rbac_group_01UvWxYzAbCdEfGhIjKlMn", user_id="user_01AbCdEfGhIjKlMnOpQrSt"
)

print(f"user_id: {member.user_id}")
print(f"email: {member.email}")

TypeScript

const client = new Anthropic();

const member = await client.beta.organization.rbacGroups.members.add(
  "rbac_group_01UvWxYzAbCdEfGhIjKlMn",
  { user_id: "user_01AbCdEfGhIjKlMnOpQrSt" }
);

console.log(`user_id: ${member.user_id}`);
console.log(`email: ${member.email}`);

C#

AnthropicClient client = new();

var member = await client.Beta.Organization.RbacGroups.Members.Add(
    "rbac_group_01UvWxYzAbCdEfGhIjKlMn",
    new() { UserID = "user_01AbCdEfGhIjKlMnOpQrSt" }
);

Console.WriteLine($"user_id: {member.UserID}");
Console.WriteLine($"email: {member.Email}");

Go

client := anthropic.NewClient()

member, err := client.Beta.Organization.RBACGroups.Members.Add(
	context.Background(),
	"rbac_group_01UvWxYzAbCdEfGhIjKlMn",
	anthropic.BetaOrganizationRBACGroupMemberAddParams{
		UserID: "user_01AbCdEfGhIjKlMnOpQrSt",
	},
)
if err != nil {
	log.Fatal(err)
}

fmt.Printf("user_id: %s\n", member.UserID)
fmt.Printf("email: %s\n", member.Email)

Java

import com.anthropic.models.beta.organization.rbacgroups.members.MemberAddParams;

void main() {
    AnthropicClient client = AnthropicOkHttpClient.fromEnv();

    var params = MemberAddParams.builder()
        .userId("user_01AbCdEfGhIjKlMnOpQrSt")
        .build();
    var member = client.beta().organization().rbacGroups().members()
        .add("rbac_group_01UvWxYzAbCdEfGhIjKlMn", params);

    IO.println("user_id: " + member.userId());
    IO.println("email: " + member.email());
}

PHP

$client = new Client();

$member = $client->beta->organization->rbacGroups->members->add(
    rbacGroupID: 'rbac_group_01UvWxYzAbCdEfGhIjKlMn',
    userID: 'user_01AbCdEfGhIjKlMnOpQrSt',
);

echo "user_id: {$member->userID}\n";
echo "email: {$member->email}\n";

Ruby

client = Anthropic::Client.new

rbac_group_id = "rbac_group_01UvWxYzAbCdEfGhIjKlMn"
member = client.beta.organization.rbac_groups.members.add(
  rbac_group_id,
  user_id: "user_01AbCdEfGhIjKlMnOpQrSt"
)

puts "user_id: #{member.user_id}"
puts "email: #{member.email}"
{
  "type": "rbac_group_member",
  "rbac_group_id": "rbac_group_01UvWxYzAbCdEfGhIjKlMn",
  "group_id": "rbac_group_01UvWxYzAbCdEfGhIjKlMn",
  "user_id": "user_01AbCdEfGhIjKlMnOpQrSt",
  "email": "jane@example.com",
  "created_at": "2026-07-09T18:00:00Z"
}

从群组中移除成员

DELETE /v1/organizations/rbac_groups/{rbac_group_id}/members/{user_id} 将成员从群组中移除;该成员仍然是其组织的成员。如果该用户不是群组成员,请求返回 404;对于 scim 群组(其成员资格在您的身份提供商中管理),请求返回 400。需要 write:rbac_groups 作用域。

有关完整的参数详细信息和响应架构,请参阅 API 参考中的移除群组成员。

cURL

curl -X DELETE "https://api.anthropic.com/v1/organizations/rbac_groups/rbac_group_01UvWxYzAbCdEfGhIjKlMn/members/user_01AbCdEfGhIjKlMnOpQrSt" \
  -H "x-api-key: $ANTHROPIC_API_KEY" \
  -H "anthropic-version: 2023-06-01"

CLI

ant beta:organization:rbac-groups:members remove \
  --rbac-group-id rbac_group_01UvWxYzAbCdEfGhIjKlMn \
  --user-id user_01AbCdEfGhIjKlMnOpQrSt

Python

client = anthropic.Anthropic()

removed_member = client.beta.organization.rbac_groups.members.remove(
    "user_01AbCdEfGhIjKlMnOpQrSt", rbac_group_id="rbac_group_01UvWxYzAbCdEfGhIjKlMn"
)

print(f"user_id: {removed_member.user_id}")

TypeScript

const client = new Anthropic();

const removedMember = await client.beta.organization.rbacGroups.members.remove(
  "user_01AbCdEfGhIjKlMnOpQrSt",
  { rbac_group_id: "rbac_group_01UvWxYzAbCdEfGhIjKlMn" }
);

console.log(`user_id: ${removedMember.user_id}`);

C#

AnthropicClient client = new();

var removedMember = await client.Beta.Organization.RbacGroups.Members.Remove(
    "user_01AbCdEfGhIjKlMnOpQrSt",
    new() { RbacGroupID = "rbac_group_01UvWxYzAbCdEfGhIjKlMn" }
);

Console.WriteLine($"user_id: {removedMember.UserID}");

Go

client := anthropic.NewClient()

removedMember, err := client.Beta.Organization.RBACGroups.Members.Remove(
	context.Background(),
	"user_01AbCdEfGhIjKlMnOpQrSt",
	anthropic.BetaOrganizationRBACGroupMemberRemoveParams{
		RBACGroupID: "rbac_group_01UvWxYzAbCdEfGhIjKlMn",
	},
)
if err != nil {
	log.Fatal(err)
}

fmt.Printf("user_id: %s\n", removedMember.UserID)

Java

import com.anthropic.models.beta.organization.rbacgroups.members.MemberRemoveParams;

void main() {
    AnthropicClient client = AnthropicOkHttpClient.fromEnv();

    var params = MemberRemoveParams.builder()
        .rbacGroupId("rbac_group_01UvWxYzAbCdEfGhIjKlMn")
        .build();
    var removedMember = client.beta().organization().rbacGroups().members()
        .remove("user_01AbCdEfGhIjKlMnOpQrSt", params);

    IO.println("user_id: " + removedMember.userId());
}

PHP

$client = new Client();

$removedMember = $client->beta->organization->rbacGroups->members->remove(
    userID: 'user_01AbCdEfGhIjKlMnOpQrSt',
    rbacGroupID: 'rbac_group_01UvWxYzAbCdEfGhIjKlMn',
);

echo "user_id: {$removedMember->userID}\n";

Ruby

client = Anthropic::Client.new

rbac_group_id = "rbac_group_01UvWxYzAbCdEfGhIjKlMn"
removed_member = client.beta.organization.rbac_groups.members.remove(
  "user_01AbCdEfGhIjKlMnOpQrSt",
  rbac_group_id: rbac_group_id
)

puts "user_id: #{removed_member.user_id}"
{
  "rbac_group_id": "rbac_group_01UvWxYzAbCdEfGhIjKlMn",
  "group_id": "rbac_group_01UvWxYzAbCdEfGhIjKlMn",
  "user_id": "user_01AbCdEfGhIjKlMnOpQrSt",
  "type": "rbac_group_member_deleted"
}

自定义角色

自定义角色通过 API 是只读的:这些端点列出您组织的自定义角色(在 claude.ai 组织设置中定义或由 Anthropic 预配)以及每个角色授予的权限。自定义角色读取使用 read:members 作用域(没有单独的角色作用域),并且可以使用组织级密钥:与群组端点不同,它们不需要为所有关联组织创建的密钥,返回的目录是您组织自己的目录。

从角色的 display_name 字段读取其名称。 对于由 Anthropic 预配的角色,display_name 可能与 claude.ai 显示的标签不同,并且 Anthropic 可能会更改该名称。要持久引用某个角色,请存储其 id。

列出角色

GET /v1/organizations/rbac_roles 返回您组织的自定义角色。需要 read:members 作用域。

有关完整的参数详细信息和响应架构,请参阅 API 参考中的列出角色。

cURL

curl "https://api.anthropic.com/v1/organizations/rbac_roles?limit=20" \
  -H "x-api-key: $ANTHROPIC_API_KEY" \
  -H "anthropic-version: 2023-06-01"

CLI

ant beta:organization:rbac-roles list --limit 20

Python

client = anthropic.Anthropic()

roles = client.beta.organization.rbac_roles.list(limit=20)

for role in roles:
    print(f"{role.id}: {role.display_name}")

TypeScript

const client = new Anthropic();

const roles = await client.beta.organization.rbacRoles.list({ limit: 20 });

for await (const role of roles) {
  console.log(`${role.id}: ${role.display_name}`);
}

C#

AnthropicClient client = new();

var page = await client.Beta.Organization.RbacRoles.List(new() { Limit = 20 });

await foreach (var role in page.Paginate())
{
    Console.WriteLine($"{role.ID}: {role.DisplayName}");
}

Go

client := anthropic.NewClient()

roles := client.Beta.Organization.RBACRoles.ListAutoPaging(context.Background(), anthropic.BetaOrganizationRBACRoleListParams{
	Limit: anthropic.Int(20),
})

for roles.Next() {
	role := roles.Current()
	fmt.Printf("%s: %s\n", role.ID, role.DisplayName)
}
if err := roles.Err(); err != nil {
	log.Fatal(err)
}

Java

import com.anthropic.models.beta.organization.rbacroles.RbacRoleListParams;

void main() {
    AnthropicClient client = AnthropicOkHttpClient.fromEnv();

    var params = RbacRoleListParams.builder()
        .limit(20)
        .build();
    var roles = client.beta().organization().rbacRoles().list(params);

    for (var role : roles.autoPager()) {
        IO.println(role.id() + ": " + role.displayName());
    }
}

PHP

$client = new Client();

$roles = $client->beta->organization->rbacRoles->list(limit: 20);

foreach ($roles->pagingEachItem() as $role) {
    echo "{$role->id}: {$role->displayName}\n";
}

Ruby

client = Anthropic::Client.new

roles = client.beta.organization.rbac_roles.list(limit: 20)

roles.auto_paging_each do |role|
  puts "#{role.id}: #{role.display_name}"
end
{
  "data": [
    {
      "type": "rbac_role",
      "id": "rbac_role_01CdEfGhIjKlMnOpQrStUv",
      "display_name": "Engineering base",
      "name": "Engineering base",
      "created_at": "2026-03-18T10:01:42Z",
      "updated_at": "2026-05-02T08:55:09Z"
    }
  ],
  "has_more": false,
  "next_page": null
}

获取角色

GET /v1/organizations/rbac_roles/{rbac_role_id} 按 ID 返回一个角色。需要 read:members 作用域。

有关完整的参数详细信息和响应架构,请参阅 API 参考中的获取角色。

cURL

curl "https://api.anthropic.com/v1/organizations/rbac_roles/rbac_role_01CdEfGhIjKlMnOpQrStUv" \
  -H "x-api-key: $ANTHROPIC_API_KEY" \
  -H "anthropic-version: 2023-06-01"

CLI

ant beta:organization:rbac-roles retrieve \
  --rbac-role-id rbac_role_01CdEfGhIjKlMnOpQrStUv

Python

client = anthropic.Anthropic()

role = client.beta.organization.rbac_roles.retrieve("rbac_role_01CdEfGhIjKlMnOpQrStUv")

print(f"id: {role.id}")
print(f"display_name: {role.display_name}")

TypeScript

const client = new Anthropic();

const role = await client.beta.organization.rbacRoles.retrieve(
  "rbac_role_01CdEfGhIjKlMnOpQrStUv"
);

console.log(`id: ${role.id}`);
console.log(`display_name: ${role.display_name}`);

C#

AnthropicClient client = new();

var role = await client.Beta.Organization.RbacRoles.Retrieve("rbac_role_01CdEfGhIjKlMnOpQrStUv");

Console.WriteLine($"id: {role.ID}");
Console.WriteLine($"display_name: {role.DisplayName}");

Go

client := anthropic.NewClient()

role, err := client.Beta.Organization.RBACRoles.Get(context.Background(), "rbac_role_01CdEfGhIjKlMnOpQrStUv")
if err != nil {
	log.Fatal(err)
}

fmt.Printf("id: %s\n", role.ID)
fmt.Printf("display_name: %s\n", role.DisplayName)

Java

AnthropicClient client = AnthropicOkHttpClient.fromEnv();

var role = client.beta().organization().rbacRoles()
    .retrieve("rbac_role_01CdEfGhIjKlMnOpQrStUv");

IO.println("id: " + role.id());
IO.println("display_name: " + role.displayName());

PHP

$client = new Client();

$role = $client->beta->organization->rbacRoles->retrieve(
    rbacRoleID: 'rbac_role_01CdEfGhIjKlMnOpQrStUv',
);

echo "id: {$role->id}\n";
echo "display_name: {$role->displayName}\n";

Ruby

client = Anthropic::Client.new

rbac_role_id = "rbac_role_01CdEfGhIjKlMnOpQrStUv"
role = client.beta.organization.rbac_roles.retrieve(rbac_role_id)

puts "id: #{role.id}"
puts "display_name: #{role.display_name}"

列出角色的权限

GET /v1/organizations/rbac_roles/{rbac_role_id}/permissions 返回角色的权限。每个权限将一个 resource(其适用对象:组织的产品功能、某个连接器工具、某个连接器 OAuth 作用域、单个连接器或所有连接器)与一个 action(其在该资源上授予的内容)配对。未为您的组织启用的功能所对应的行会被省略,因此在 has_more 为 true 时,一个页面包含的行可能少于 limit。需要 read:members 作用域。

有两个 action 值需要特别注意:action 为 capability_access_all(所有产品功能)或 capability_access_all_ga(所有稳定产品功能,即所有未标记为 beta 或研究预览的功能)的 organization 权限是一种全面授权(既不涵盖模型访问,也不涵盖带 permission_ 前缀的管理面板权限,也不涵盖 inference_hooks_inspection,角色只能通过明确指定它的行来持有该权限),并且以单独一行列出,而不会展开。在统计某个角色授予的内容时,请将全面授权行视为涵盖其变体所描述的所有内容,而不仅仅是其他行中列出的功能。

有关完整的参数详细信息和响应架构,请参阅 API 参考中的列出角色权限。

cURL

curl "https://api.anthropic.com/v1/organizations/rbac_roles/rbac_role_01CdEfGhIjKlMnOpQrStUv/permissions?limit=20" \
  -H "x-api-key: $ANTHROPIC_API_KEY" \
  -H "anthropic-version: 2023-06-01"

CLI

ant beta:organization:rbac-roles:permissions list \
  --rbac-role-id rbac_role_01CdEfGhIjKlMnOpQrStUv \
  --limit 20

Python

client = anthropic.Anthropic()

permissions = client.beta.organization.rbac_roles.permissions.list(
    "rbac_role_01CdEfGhIjKlMnOpQrStUv", limit=20
)

for permission in permissions:
    print(permission.action)

TypeScript

const client = new Anthropic();

const permissions = await client.beta.organization.rbacRoles.permissions.list(
  "rbac_role_01CdEfGhIjKlMnOpQrStUv",
  { limit: 20 }
);

for await (const permission of permissions) {
  console.log(permission.action);
}

C#

AnthropicClient client = new();

var page = await client.Beta.Organization.RbacRoles.Permissions.List(
    "rbac_role_01CdEfGhIjKlMnOpQrStUv",
    new() { Limit = 20 }
);

await foreach (var permission in page.Paginate())
{
    Console.WriteLine(permission.Action);
}

Go

client := anthropic.NewClient()

permissions := client.Beta.Organization.RBACRoles.Permissions.ListAutoPaging(
	context.Background(),
	"rbac_role_01CdEfGhIjKlMnOpQrStUv",
	anthropic.BetaOrganizationRBACRolePermissionListParams{
		Limit: anthropic.Int(20),
	},
)

for permissions.Next() {
	permission := permissions.Current()
	fmt.Println(permission.Action)
}
if err := permissions.Err(); err != nil {
	log.Fatal(err)
}

Java

import com.anthropic.models.beta.organization.rbacroles.permissions.PermissionListParams;

void main() {
    AnthropicClient client = AnthropicOkHttpClient.fromEnv();

    var params = PermissionListParams.builder()
        .limit(20)
        .build();
    var permissions = client.beta().organization().rbacRoles().permissions()
        .list("rbac_role_01CdEfGhIjKlMnOpQrStUv", params);

    for (var permission : permissions.autoPager()) {
        IO.println(permission.action());
    }
}

PHP

$client = new Client();

$permissions = $client->beta->organization->rbacRoles->permissions->list(
    rbacRoleID: 'rbac_role_01CdEfGhIjKlMnOpQrStUv',
    limit: 20,
);

foreach ($permissions->pagingEachItem() as $permission) {
    echo "{$permission->action}\n";
}

Ruby

client = Anthropic::Client.new

rbac_role_id = "rbac_role_01CdEfGhIjKlMnOpQrStUv"
permissions = client.beta.organization.rbac_roles.permissions.list(rbac_role_id, limit: 20)

permissions.auto_paging_each do |permission|
  puts permission.action
end
{
  "data": [
    {
      "type": "rbac_role_permission",
      "resource": {
        "type": "organization",
        "organization_id": "12345678-1234-5678-1234-567812345678"
      },
      "action": "capability_access_all_ga"
    },
    {
      "type": "rbac_role_permission",
      "resource": {
        "type": "connector_tool",
        "connector_id": "mcpsrv_01WxYzAbCdEfGhIjKlMnOp",
        "tool_name": "search_tickets"
      },
      "action": "use"
    }
  ],
  "has_more": false,
  "next_page": null
}

示例工作流

为离职员工办理离职

  1. 按电子邮件查找成员:

    cURL

    curl "https://api.anthropic.com/v1/organizations/users?email=departing@example.com" \
      -H "x-api-key: $ANTHROPIC_API_KEY" \
      -H "anthropic-version: 2023-06-01"

    CLI

    ant organization:users list --email departing@example.com

    Python

    client = anthropic.Anthropic()
    
    users = client.organization.users.list(email="departing@example.com")
    
    for user in users:
        print(f"{user.id}: {user.email} ({user.role})")

    TypeScript

    const client = new Anthropic();
    
    const users = await client.organization.users.list({ email: "departing@example.com" });
    
    for await (const user of users) {
      console.log(`${user.id}: ${user.email} (${user.role})`);
    }

    C#

    AnthropicClient client = new();
    
    var page = await client.Organization.Users.List(new() { Email = "departing@example.com" });
    
    await foreach (var user in page.Paginate())
    {
        Console.WriteLine($"{user.ID}: {user.Email} ({user.Role.Raw()})");
    }

    Go

    client := anthropic.NewClient()
    
    users := client.Organization.Users.ListAutoPaging(context.Background(), anthropic.OrganizationUserListParams{
    	Email: anthropic.String("departing@example.com"),
    })
    
    for users.Next() {
    	user := users.Current()
    	fmt.Printf("%s: %s (%s)\n", user.ID, user.Email, user.Role)
    }
    if err := users.Err(); err != nil {
    	log.Fatal(err)
    }

    Java

    import com.anthropic.models.organization.users.UserListParams;
    
    void main() {
        AnthropicClient client = AnthropicOkHttpClient.fromEnv();
    
        var params = UserListParams.builder()
            .email("departing@example.com")
            .build();
        var users = client.organization().users().list(params);
    
        for (var user : users.autoPager()) {
            IO.println(user.id() + ": " + user.email() + " (" + user.role().asString() + ")");
        }
    }

    PHP

    $client = new Client();
    
    $users = $client->organization->users->list(email: 'departing@example.com');
    
    foreach ($users->pagingEachItem() as $user) {
        echo "{$user->id}: {$user->email} ({$user->role})\n";
    }

    Ruby

    client = Anthropic::Client.new
    
    users = client.organization.users.list(email: "departing@example.com")
    
    users.auto_paging_each do |user|
      puts "#{user.id}: #{user.email} (#{user.role})"
    end
  2. 使用响应中的 id,通过 DELETE /v1/organizations/users/{user_id} 移除该成员。其席位(如果有)会归还到池中。

  3. 如果此人尚未加入,查找将不会返回任何成员;请改为列出邀请并撤回其 pending 状态的邀请。

审计群组成员资格

  1. 列出群组,并记录每个群组的 id、name 和 role_ids。

  2. 对于每个带有敏感角色的群组,翻页浏览 GET /v1/organizations/rbac_groups/{rbac_group_id}/members,并将成员电子邮件与您身份提供商的名册进行比较。

  3. 使用 DELETE /v1/organizations/rbac_groups/{rbac_group_id}/members/{user_id} 移除不应再留在群组中的成员。对于 scim 群组,请改为在您的身份提供商中进行更改。

有关将群组成员资格与临时提高支出限额相结合的工作流,请参阅 Spend Limits API 页面上的在事件期间临时提高成员的支出限额。

常见问题

这是与 Admin API 不同的 API 吗?

不是。成员和邀请端点与 Claude Console 组织使用的 /v1/organizations/ 端点相同;本页记录它们在 Claude Enterprise 中的行为。群组和自定义角色端点属于同一个 API,并且仅适用于 Claude Enterprise 组织。可用性表显示了每种组织类型可以调用哪些端点。

我可以通过 API 分配所有者或成员管理员角色吗?

不可以。API 仅在创建邀请和更新角色时分配 user 和 managed。管理角色在 claude.ai 组织设置中分配,持有这些角色的成员无法通过 API 修改或移除。

我可以通过 API 创建或修改群组吗?

可以,需要 write:rbac_groups 作用域:创建、重命名和删除群组,以及添加或移除其成员。API 无法更改以下两类内容:由您的身份提供商预配的群组(source_type: "scim"),其名称和成员资格归身份提供商所有;以及自定义角色,它们在 claude.ai 组织设置中管理(API 可以读取它们)。

未接受的邀请会占用席位吗?

在具有有限席位池的套餐上,会:pending 状态的邀请会占用一个席位。撤回邀请或让其过期会释放该席位。在没有席位池的套餐上,邀请不会占用任何资源。

我的组织使用单点登录。哪些操作可用?

如果您的身份提供商自动预配用户(JIT 或 SCIM),创建邀请会返回 400。如果它管理角色(高级 SSO 或高级 SCIM 预配),角色更新会返回 400。如果它管理成员资格(SCIM 预配),移除成员会返回 400。读取操作在任何情况下都可用。

当创建 Admin API 密钥的人离职时,该密钥会怎样?

该密钥会继续有效。Admin API 密钥的作用范围是组织,而不是个人用户,并且在 claude.ai 中创建的密钥不会过期。将创建者从组织中移除或通过您的身份提供商取消其预配,会终止其本人的访问权限,但不会影响其创建的密钥。降低其角色也不会改变这些密钥:每个密钥都会保持有效并保留其原始作用域。当您为创建过 Admin API 密钥的人员办理离职时,请在 claude.ai > 组织设置 > API 的 Keys 部分删除这些密钥并创建替代密钥。

另请参阅