The Admin API is unavailable for individual accounts. To collaborate with teammates and add members, set up your organization in Console → Settings → Organization .
Admin API を使用すると、組織メンバー、ワークスペース、APIキーなど、組織のリソースをプログラムで管理できます。これにより、Anthropic Console で手動設定が必要な管理タスクをプログラムで制御できます。
Admin APIには特別なアクセスが必要です
Admin APIには、標準のAPIキーとは異なる特別なAdmin APIキー(sk-ant-admin...
で始まる)が必要です。管理者ロールを持つ組織メンバーのみが、Anthropic Consoleを通じてAdmin APIキーをプロビジョニングできます。
Admin APIの仕組み
Admin APIを使用する場合:
x-api-key
ヘッダーでAdmin APIキーを使用してリクエストを行います
APIでは以下を管理できます:
組織メンバーとその役割
組織メンバーの招待
ワークスペースとそのメンバー
APIキー
これは以下の用途に便利です:
ユーザーのオンボーディング/オフボーディングの自動化
ワークスペースアクセスのプログラム管理
APIキー使用量の監視と管理
組織の役割と権限
組織レベルの役割は5つあります。詳細はこちら をご覧ください。
役割 権限 user Workbenchを使用可能 claude_code_user WorkbenchとClaude Code を使用可能 developer Workbenchを使用し、APIキーを管理可能 billing Workbenchを使用し、請求詳細を管理可能 admin 上記すべてに加えて、ユーザーを管理可能
主要概念
組織メンバー
組織メンバー の一覧表示、メンバーの役割更新、メンバーの削除ができます。
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 "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 --request POST "https://api.anthropic.com/v1/organizations/invites" \
--header "anthropic-version: 2023-06-01" \
--header "x-api-key: $ANTHROPIC_ADMIN_KEY " \
--data '{
"email" : "newuser@domain.com" ,
"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 "
ワークスペース
リソースを整理するためにワークスペース (コンソール )を作成・管理します:
curl --request POST "https://api.anthropic.com/v1/organizations/workspaces" \
--header "anthropic-version: 2023-06-01" \
--header "x-api-key: $ANTHROPIC_ADMIN_KEY " \
--data '{"name": "Production"}'
curl "https://api.anthropic.com/v1/organizations/workspaces?limit=10&include_archived=false" \
--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}/archive" \
--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" \
--header "anthropic-version: 2023-06-01" \
--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 "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 "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 "
curl --request POST "https://api.anthropic.com/v1/organizations/api_keys/{api_key_id}" \
--header "anthropic-version: 2023-06-01" \
--header "x-api-key: $ANTHROPIC_ADMIN_KEY " \
--data '{
"status" : "inactive" ,
"name" : "New Key Name"
} '
ベストプラクティス
Admin APIを効果的に使用するには:
ワークスペースとAPIキーに意味のある名前と説明を使用する
失敗した操作に対する適切なエラーハンドリングを実装する
メンバーの役割と権限を定期的に監査する
未使用のワークスペースと期限切れの招待をクリーンアップする
APIキーの使用量を監視し、定期的にキーをローテーションする
FAQ