• 訊息
  • 託管代理
  • 管理
Search...
⌘K
組織
Admin API工作區
驗證
概覽工作負載身分聯合WIF 參考
監控
用量與成本 API速率限制 APIClaude Code 分析 API
資料與合規
資料駐留API 與資料保留
合規 API
概覽取得存取權活動動態對話、檔案與專案組織、使用者、角色與群組設計您的整合錯誤常見問題
Log in
Admin API
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...

Solutions

  • AI agents
  • Code modernization
  • Coding
  • Customer support
  • Education
  • Financial services
  • Government
  • Life sciences

Partners

  • Amazon Bedrock
  • Google Cloud's Vertex AI

Learn

  • Blog
  • Courses
  • Use cases
  • Connectors
  • Customer stories
  • Engineering at Anthropic
  • Events
  • Powered by Claude
  • Service partners
  • Startups program

Company

  • Anthropic
  • Careers
  • Economic Futures
  • Research
  • News
  • Responsible Scaling Policy
  • Security and compliance
  • Transparency

Learn

  • Blog
  • Courses
  • Use cases
  • Connectors
  • Customer stories
  • Engineering at Anthropic
  • Events
  • Powered by Claude
  • Service partners
  • Startups program

Help and security

  • Availability
  • Status
  • Support
  • Discord

Terms and policies

  • Privacy policy
  • Responsible disclosure policy
  • Terms of service: Commercial
  • Terms of service: Consumer
  • Usage policy
管理/組織

Admin API

Admin API 不適用於個人帳戶。 若要與團隊成員協作並新增成員,請在 Console → Settings → Organization 中設定您的組織。

Admin API 允許您以程式化方式管理組織的資源,包括組織成員、工作區和 API 金鑰。這提供了對管理任務的程式化控制,否則這些任務需要在 Claude Console 中手動設定。

Admin API 需要特殊存取權限

Admin API 需要一個特殊的 Admin API 金鑰(以 sk-ant-admin... 開頭),這與標準 API 金鑰不同。只有具有管理員角色的組織成員才能透過 Claude Console 配置 Admin API 金鑰。

AWS 上的 Claude Platform: 大部分的 Admin API 在 AWS 上的 Claude Platform 中不可用。工作區端點(在 /v1/organizations/workspaces 上的建立、取得、列出、更新和封存)是可用的。其他端點,包括組織成員、工作區成員、邀請、API 金鑰、使用量報告、成本報告和速率限制報告則不可用。詳情請參閱 AWS 上的 Claude Platform。

Admin API 的運作方式

當您使用 Admin API 時:

  1. 您在 x-api-key 標頭中使用您的 Admin API 金鑰發出請求
  2. 此 API 允許您管理:
    • 組織成員及其角色
    • 組織成員邀請
    • 工作區及其成員
    • API 金鑰

這適用於:

  • 自動化使用者的加入/離開流程
  • 以程式化方式管理工作區存取權限
  • 監控和管理 API 金鑰的使用情況

組織角色與權限

共有五種組織層級的角色。更多詳情請參閱 API Console 角色與權限一文。

角色權限
user可以使用 Workbench
claude_code_user可以使用 Workbench 和 Claude Code
developer可以使用 Workbench 並管理 API 金鑰
billing可以使用 Workbench 並管理帳單詳情
admin可以執行上述所有操作,並管理使用者

關鍵概念

組織成員

您可以列出組織成員、更新成員角色以及移除成員。

cURL
# 列出組織成員
curl "https://api.anthropic.com/v1/organizations/users?limit=10" \
  --header "anthropic-version: 2023-06-01" \
  --header "x-api-key: $ANTHROPIC_ADMIN_KEY"

# 更新成員角色
curl "https://api.anthropic.com/v1/organizations/users/{user_id}" \
  --header "anthropic-version: 2023-06-01" \
  --header "content-type: application/json" \
  --header "x-api-key: $ANTHROPIC_ADMIN_KEY" \
  --data '{"role": "developer"}'

# 移除成員
curl --request DELETE "https://api.anthropic.com/v1/organizations/users/{user_id}" \
  --header "anthropic-version: 2023-06-01" \
  --header "x-api-key: $ANTHROPIC_ADMIN_KEY"

組織邀請

您可以邀請使用者加入組織並管理這些邀請。

cURL
# 建立邀請
curl --request POST "https://api.anthropic.com/v1/organizations/invites" \
  --header "anthropic-version: 2023-06-01" \
  --header "content-type: application/json" \
  --header "x-api-key: $ANTHROPIC_ADMIN_KEY" \
  --data '{
    "email": "[email protected]",
    "role": "developer"
  }'

# 列出邀請
curl "https://api.anthropic.com/v1/organizations/invites?limit=10" \
  --header "anthropic-version: 2023-06-01" \
  --header "x-api-key: $ANTHROPIC_ADMIN_KEY"

# 刪除邀請
curl --request DELETE "https://api.anthropic.com/v1/organizations/invites/{invite_id}" \
  --header "anthropic-version: 2023-06-01" \
  --header "x-api-key: $ANTHROPIC_ADMIN_KEY"

工作區

如需工作區的完整指南,包括 Console 和 API 範例,請參閱工作區。

工作區成員

管理使用者對特定工作區的存取權限:

cURL
# 將成員新增至工作區
curl --request POST "https://api.anthropic.com/v1/organizations/workspaces/{workspace_id}/members" \
  --header "anthropic-version: 2023-06-01" \
  --header "content-type: application/json" \
  --header "x-api-key: $ANTHROPIC_ADMIN_KEY" \
  --data '{
    "user_id": "user_xxx",
    "workspace_role": "workspace_developer"
  }'

# 列出工作區成員
curl "https://api.anthropic.com/v1/organizations/workspaces/{workspace_id}/members?limit=10" \
  --header "anthropic-version: 2023-06-01" \
  --header "x-api-key: $ANTHROPIC_ADMIN_KEY"

# 更新成員角色
curl --request POST "https://api.anthropic.com/v1/organizations/workspaces/{workspace_id}/members/{user_id}" \
  --header "anthropic-version: 2023-06-01" \
  --header "content-type: application/json" \
  --header "x-api-key: $ANTHROPIC_ADMIN_KEY" \
  --data '{
    "workspace_role": "workspace_admin"
  }'

# 從工作區移除成員
curl --request DELETE "https://api.anthropic.com/v1/organizations/workspaces/{workspace_id}/members/{user_id}" \
  --header "anthropic-version: 2023-06-01" \
  --header "x-api-key: $ANTHROPIC_ADMIN_KEY"

API 金鑰

監控和管理 API 金鑰:

cURL
# 列出 API 金鑰
curl "https://api.anthropic.com/v1/organizations/api_keys?limit=10&status=active&workspace_id=wrkspc_xxx" \
  --header "anthropic-version: 2023-06-01" \
  --header "x-api-key: $ANTHROPIC_ADMIN_KEY"

# 更新 API 金鑰
curl --request POST "https://api.anthropic.com/v1/organizations/api_keys/{api_key_id}" \
  --header "anthropic-version: 2023-06-01" \
  --header "content-type: application/json" \
  --header "x-api-key: $ANTHROPIC_ADMIN_KEY" \
  --data '{
    "status": "inactive",
    "name": "New Key Name"
  }'

存取組織資訊

使用 /v1/organizations/me 端點以程式化方式取得您組織的相關資訊。

例如:

cURL
curl "https://api.anthropic.com/v1/organizations/me" \
  --header "anthropic-version: 2023-06-01" \
  --header "x-api-key: $ANTHROPIC_ADMIN_KEY"
{
  "id": "12345678-1234-5678-1234-567812345678",
  "type": "organization",
  "name": "Organization Name"
}

此端點適用於以程式化方式判斷 Admin API 金鑰所屬的組織。

如需完整的參數詳情和回應結構描述,請參閱組織資訊 API 參考文件。

使用量與成本報告

使用使用量與成本 API 追蹤您組織的使用量和成本。

Claude Code 分析

使用 Claude Code 分析 API 監控開發人員生產力和 Claude Code 的採用情況。

速率限制

使用速率限制 API 讀取為您的組織及其工作區所設定的速率限制。

合規 API

使用合規 API 擷取您組織的稽核和活動資料。Admin API 金鑰只能讀取活動動態;如需完整存取權限,請參閱取得合規 API 的存取權限。

最佳實務

為了有效使用 Admin API:

  • 為工作區和 API 金鑰使用有意義的名稱和描述
  • 為失敗的操作實作適當的錯誤處理
  • 定期稽核成員角色和權限
  • 清理未使用的工作區和已過期的邀請
  • 監控 API 金鑰的使用情況並定期輪換金鑰

常見問題

如有工作區相關的問題,請參閱工作區常見問題。

Was this page helpful?

  • Admin API 的運作方式
  • 組織角色與權限
  • 關鍵概念
  • 組織成員
  • 組織邀請
  • 工作區
  • 工作區成員
  • API 金鑰
  • 存取組織資訊
  • 使用量與成本報告
  • Claude Code 分析
  • 速率限制
  • 合規 API
  • 最佳實務
  • 常見問題