Claude Platform Docs
  • Messages
  • Managed Agents
  • 管理

Search...
⌘K
組織
Admin API工作區
驗證
概覽建立 Admin API 金鑰Workload Identity Federation透過 API 管理 WIFWIF 參考
監控
Usage and Cost APIRate Limits APIAnalytics APIClaude Code Analytics APISpend Limits API
資料與合規
資料駐留API 與資料保留存取透明度
Compliance API
概覽取得存取權活動動態對話、檔案與專案組織、使用者、角色、群組與設定設計您的整合錯誤常見問題

Log in
Admin API
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Claude Platform Docs

Solutions

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

Partners

  • Claude on AWS
  • Claude on Google Cloud

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 接受兩種憑證:透過 x-api-key 標頭傳送的 Admin API 金鑰(以 sk-ant-admin... 開頭),或透過 authorization: Bearer 標頭傳送且具有 org:admin 範圍的 OAuth bearer token。只有具有 admin 角色的組織成員才能配置 Admin API 金鑰,且只有具有 admin、owner 或 primary owner 角色的成員才能取得 org:admin token。請參閱建立 Admin API 金鑰。



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

驗證

使用任一憑證進行驗證。若要為您的組織類型建立 Admin API 金鑰,請參閱建立 Admin API 金鑰。以下範例以兩種方式呼叫組織資訊端點:

OAuth bearer:

cURL
curl --fail-with-body -sS "https://api.anthropic.com/v1/organizations/me" \
  --header "anthropic-version: 2023-06-01" \
  --header "authorization: Bearer $ANTHROPIC_OAUTH_TOKEN"

org:admin token 可授予對整個組織的存取權限,無論底層設定檔或聯合規則綁定到哪個工作區。若要取得此 token,請參閱使用 Admin API 管理 WIF 中的先決條件。

Admin API 金鑰:

cURL
curl --fail-with-body -sS "https://api.anthropic.com/v1/organizations/me" \
  --header "anthropic-version: 2023-06-01" \
  --header "x-api-key: $ANTHROPIC_ADMIN_KEY"

Admin API 的運作方式

當您使用 Admin API 時:

  1. 您使用驗證章節中的任一憑證發出請求
  2. 此 API 允許您管理:
    • 組織成員及其角色
    • 組織成員邀請
    • 工作區及其成員
    • API 金鑰
    • 服務帳戶、聯合簽發者和聯合規則(這些端點需要 org:admin OAuth token;不接受 Admin API 金鑰)

這適用於:

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

組織角色與權限

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

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

組織 owner 和 primary owner 擁有所有 admin 權限,並可額外管理 admin。本頁面中所有對 admin 角色的引用也適用於 owner 和 primary owner。

主要概念

組織成員

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

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"
  }'

服務帳戶

建立和管理服務帳戶(svac_...),即 Workload Identity Federation token 所代表的非人類身分。服務帳戶、聯合簽發者或聯合規則端點不接受 Admin API 金鑰;請使用 org:admin OAuth token。請參閱使用 Admin API 管理 WIF。

聯合簽發者

註冊 OIDC 身分提供者(fdis_...),其 token 可為您的組織聲明工作負載身分。請參閱使用 Admin API 管理 WIF。

聯合規則

管理將簽發者 token 對應到服務帳戶和範圍的規則(fdrl_...)。請參閱使用 Admin API 管理 WIF。

存取組織資訊

使用 /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 讀取為您的組織及其工作區設定的速率限制。

Compliance API

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

最佳實務

若要有效使用 Admin API:

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

常見問題

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

Was this page helpful?

  • 驗證
  • Admin API 的運作方式
  • 組織角色與權限
  • 主要概念
  • 組織成員
  • 組織邀請
  • 工作區
  • 工作區成員
  • API 金鑰
  • 服務帳戶
  • 聯合簽發者
  • 聯合規則
  • 存取組織資訊
  • 使用量與成本報告
  • Claude Code 分析
  • 速率限制
  • Compliance API
  • 最佳實務
  • 常見問題