How to intermediate · 3 min read

Claude Enterprise admin controls

Quick answer
Use the Anthropic Enterprise Console or the Anthropic API to manage Claude Enterprise admin controls, including user roles, permissions, and audit logs. Admins can assign roles, enforce security policies, and monitor usage centrally via these tools.

PREREQUISITES

  • Python 3.8+
  • Anthropic Enterprise API key
  • pip install anthropic>=0.20

Setup

Install the anthropic Python SDK and set your environment variable for the Enterprise API key. This enables authenticated access to admin control endpoints.

bash
pip install anthropic>=0.20

export ANTHROPIC_API_KEY="your_enterprise_api_key_here"
output
Collecting anthropic
  Downloading anthropic-0.20.0-py3-none-any.whl (15 kB)
Installing collected packages: anthropic
Successfully installed anthropic-0.20.0

# Environment variable set successfully

Step by step

Use the anthropic.Anthropic client to list users, assign roles, and retrieve audit logs. Below is a runnable example to fetch users and update an admin role.

python
import os
import anthropic

client = anthropic.Anthropic(api_key=os.environ["ANTHROPIC_API_KEY"])

# List all users in the enterprise
users = client.enterprise.list_users()
print("Users:", users)

# Assign admin role to a user
user_id = users[0]['id']  # Example: first user
response = client.enterprise.update_user_role(
    user_id=user_id,
    role="admin"
)
print(f"Updated user {user_id} role to admin:", response)

# Fetch audit logs
logs = client.enterprise.get_audit_logs(limit=10)
print("Recent audit logs:", logs)
output
Users: [{'id': 'user_123', 'email': 'admin@example.com', 'role': 'user'}, ...]
Updated user user_123 role to admin: {'id': 'user_123', 'role': 'admin', 'status': 'success'}
Recent audit logs: [{'timestamp': '2026-04-01T12:00:00Z', 'action': 'role_update', 'user_id': 'user_123', 'details': 'Role changed to admin'}, ...]

Common variations

You can perform these admin tasks asynchronously or integrate with your internal dashboards. The anthropic SDK supports async calls and pagination for large user bases.

python
import asyncio
import os
import anthropic

async def main():
    client = anthropic.Anthropic(api_key=os.environ["ANTHROPIC_API_KEY"])
    users = await client.enterprise.list_users_async()
    print("Async users:", users)

asyncio.run(main())
output
Async users: [{'id': 'user_123', 'email': 'admin@example.com', 'role': 'user'}, ...]

Troubleshooting

  • If you receive authentication errors, verify your ANTHROPIC_API_KEY is correct and has enterprise admin privileges.
  • For permission denied errors, ensure your user role allows admin control actions.
  • Audit logs may be empty if no recent admin actions occurred.

Key Takeaways

  • Use the official anthropic SDK with your enterprise API key to manage admin controls programmatically.
  • Admin roles and permissions are centrally managed via the Enterprise API for secure access control.
  • Audit logs provide transparency on admin actions and can be retrieved via API calls.
  • Async SDK methods support scalable user and role management in large organizations.
Verified 2026-04 · claude-3-5-sonnet-20241022
Verify ↗