Repository Public
1---2title: Workspaces3url: https://platform.claude.com/docs/en/manage-claude/workspaces4description: Organize API keys, manage team access, and control costs with workspaces.5---67Workspaces provide a way to organize your API usage within an organization. Use workspaces to separate different projects, environments, or teams while maintaining centralized billing and administration.89## How workspaces work1011Every organization has a **Default Workspace** that cannot be renamed, archived, or deleted. When you create additional workspaces, you can assign members, service accounts, API keys, and resource limits to each one.1213Key characteristics:1415* **Workspace identifiers** use the `wrkspc_` prefix (for example, `wrkspc_01JwQvzr7rXLA5AGx3HKfFUJ`)16* **Maximum 100 workspaces** per organization by default (archived workspaces don't count); contact your account team if you need more17* **Default Workspace** has a `wrkspc_` ID like any other workspace (returned in the [`anthropic-workspace-id` response header](https://platform.claude.com/docs/en/manage-claude/workspaces#identify-the-workspace-behind-an-api-response) and accepted by [Get Workspace](https://platform.claude.com/docs/en/api/admin/workspaces/retrieve)), but it doesn't appear in [List Workspaces](https://platform.claude.com/docs/en/api/admin/workspaces/list) results, and API keys, usage reports, and cost reports show `null` for its `workspace_id`, as do all-workspaces API keys (an API key's `scope` field tells them apart; for a key bound to the Default Workspace it carries the real ID)18* **API keys** can be scoped to a single workspace. In this case, they can only access resources within that workspace. Some API keys can be granted permissions across multiple workspaces, and provide a [workspace ID header](https://platform.claude.com/docs/en/manage-claude/authentication#select-a-workspace) to access resources within that workspace1920### Claude Code workspace2122When a member of your organization first signs in to [Claude Code](https://code.claude.com/docs/en/overview) with their Claude Console account, Anthropic automatically creates a **Claude Code** workspace in the organization and adds that member to it. Every subsequent member who signs in to Claude Code is added the same way.2324The Claude Code workspace keeps Claude Code traffic separate from your other API workloads:2526* Claude Code mints a per-user API key in this workspace at sign-in. You cannot create keys in it manually from the Console.27* A Claude Code key stops working if its owner is removed from the workspace or organization, unlike a workspace key.28* Claude Code usage is rate-limited separately, and admins can cap its share of the organization's limits under [Settings > Workspaces](https://platform.claude.com/settings/workspaces).29* It is the only workspace that supports per-user monthly spend limits.3031<Warning>32 Archiving the Claude Code workspace disables Claude Code sign-in through Console billing for the whole organization.33</Warning>3435## Workspace roles and permissions3637Members can have different roles in each workspace, allowing fine-grained access control.3839| Role | Permissions |40| --------------------------- | ----------------------------------------------------------------------------------------------- |41| Workspace User | Use playground only |42| Workspace Limited Developer | Create and manage API keys, use the API. Cannot access session tracing views or download files. |43| Workspace Developer | Create and manage API keys, use the API |44| Workspace Admin | Full control over workspace settings and members |45| Workspace Billing | View workspace billing information (inherited from organization billing role) |4647### Role inheritance4849* **Organization admins** automatically receive Workspace Admin access to all workspaces50* **Organization billing members** automatically receive Workspace Billing access to all workspaces51* **Organization users and developers** must be explicitly added to each workspace52* **Service accounts** are added to workspaces from the service account's page in [Settings → Service accounts](https://platform.claude.com/settings/service-accounts) or from the workspace's **Service accounts** tab5354<Note>55 The Workspace Billing role cannot be manually assigned. It's inherited from having the organization billing role.56</Note>5758## Managing workspaces5960<Note>61 Only organization admins can create workspaces. Organization users and developers must be added to workspaces by an admin.62</Note>6364### Using the Console6566Create and manage workspaces in the [Claude Console](https://platform.claude.com/settings/workspaces).6768#### Create a workspace6970<Steps>71 <Step title="Open workspace settings">72 In the Claude Console, go to **Settings > Workspaces**.73 </Step>7475 <Step title="Create a workspace">76 Click **Create workspace**.77 </Step>7879 <Step title="Configure the workspace">80 Enter a workspace name and select a color for visual identification.81 </Step>8283 <Step title="Create the workspace">84 Click **Create** to finalize.85 </Step>86</Steps>8788<Tip>89 To switch between workspaces in the Console, use the **Workspaces** selector in the top-left corner.90</Tip>9192#### Edit workspace details9394To modify a workspace's name or color:95961. Select the workspace from the list.972. Click the ellipsis menu (**...**) and choose **Edit details**.983. Update the name or color and save your changes.99100<Note>101 The Default Workspace cannot be renamed or deleted.102</Note>103104#### Add members to a workspace1051061. Navigate to the workspace's **Members** tab.1072. Click **Add to Workspace**.1083. Select an organization member and assign them a [workspace role](https://platform.claude.com/docs/en/manage-claude/workspaces#workspace-roles-and-permissions).1094. Confirm the addition.110111To remove a member, click the trash icon next to their name.112113<Note>114 Organization admins and billing members cannot be removed from workspaces while they hold those organization roles.115</Note>116117#### Set workspace limits118119Each workspace's settings split these across two tabs:120121* **Rate limits:** On the **Rate limits** tab, set limits per model tier for requests per minute, input tokens, or output tokens122* **Spend limits:** On the **Spend limits** tab, cap monthly spending and configure alerts when spending reaches certain thresholds123124#### Archive a workspace125126To archive a workspace, click the ellipsis menu (**...**) and select **Archive**. Archiving:127128* Preserves historical data for reporting129* Deactivates the workspace and archives every API key created for it130* Cannot be undone131132<Warning>133 Archiving a workspace archives every API key created for that workspace within seconds (they remain listed in the Admin API as archived), and multi-workspace keys can no longer act in it. This action cannot be undone. If you archive the [Claude Code workspace](https://platform.claude.com/docs/en/manage-claude/workspaces#claude-code-workspace), members of your organization can no longer sign in to Claude Code through Console billing.134</Warning>135136### Using the Admin API137138Programmatically manage workspaces using the [Admin API](https://platform.claude.com/docs/en/manage-claude/admin-api).139140<Note>141 Admin API endpoints accept an [Admin API key](https://platform.claude.com/docs/en/manage-claude/admin-api-keys), an `org:admin` OAuth token, or a personal or service account key that isn't scoped to a specific workspace. Workspace keys don't work there. See [Authentication](https://platform.claude.com/docs/en/manage-claude/admin-api#authentication).142</Note>143144The following SDK and CLI examples construct the default client, which reads the Admin API key from the `ANTHROPIC_API_KEY` environment variable; the SDKs expose these endpoints under `client.beta.organization.workspaces`. SDK list methods fetch further pages on demand, so `limit` sets the page size; the PHP, Ruby, and curl examples return one page.145146Create a workspace:147148<CodeGroup>149 ```bash cURL150 curl -X POST "https://api.anthropic.com/v1/organizations/workspaces" \151 -H "x-api-key: $ANTHROPIC_API_KEY" \152 -H "anthropic-version: 2023-06-01" \153 -H "content-type: application/json" \154 -d '{"name": "Production"}'155 ```156157 ```bash CLI158 ant beta:organization:workspaces create --name Production159 ```160161 ```python Python162 client = anthropic.Anthropic()163164 workspace = client.beta.organization.workspaces.create(name="Production")165166 print(f"id: {workspace.id}")167 print(f"name: {workspace.name}")168 ```169170 ```typescript TypeScript171 const client = new Anthropic();172173 const workspace = await client.beta.organization.workspaces.create({ name: "Production" });174175 console.log(`id: ${workspace.id}`);176 console.log(`name: ${workspace.name}`);177 ```178179 ```csharp C#180 AnthropicClient client = new();181182 var workspace = await client.Beta.Organization.Workspaces.Create(new()183 {184 Name = "Production"185 });186187 Console.WriteLine($"id: {workspace.ID}");188 Console.WriteLine($"name: {workspace.Name}");189 ```190191 ```go Go192 client := anthropic.NewClient()193194 workspace, err := client.Beta.Organization.Workspaces.New(context.Background(), anthropic.BetaOrganizationWorkspaceNewParams{195 Name: "Production",196 })197 if err != nil {198 log.Fatal(err)199 }200201 fmt.Printf("id: %s\n", workspace.ID)202 fmt.Printf("name: %s\n", workspace.Name)203 ```204205 ```java Java206 import com.anthropic.models.beta.organization.workspaces.WorkspaceCreateParams;207208 void main() {209 AnthropicClient client = AnthropicOkHttpClient.fromEnv();210211 var params = WorkspaceCreateParams.builder()212 .name("Production")213 .build();214 var workspace = client.beta().organization().workspaces().create(params);215216 IO.println("id: " + workspace.id());217 IO.println("name: " + workspace.name());218 }219 ```220221 ```php PHP222 $client = new Client();223224 $workspace = $client->beta->organization->workspaces->create(225 name: 'Production',226 );227228 echo "id: {$workspace->id}\n";229 echo "name: {$workspace->name}\n";230 ```231232 ```ruby Ruby233 client = Anthropic::Client.new234235 workspace = client.beta.organization.workspaces.create(name: "Production")236237 puts "id: #{workspace.id}"238 puts "name: #{workspace.name}"239 ```240</CodeGroup>241242List workspaces:243244<CodeGroup>245 ```bash cURL246 curl "https://api.anthropic.com/v1/organizations/workspaces?limit=10&include_archived=false" \247 -H "x-api-key: $ANTHROPIC_API_KEY" \248 -H "anthropic-version: 2023-06-01"249 ```250251 ```bash CLI252 ant beta:organization:workspaces list --limit 10 --include-archived=false253 ```254255 ```python Python256 client = anthropic.Anthropic()257258 workspaces = client.beta.organization.workspaces.list(limit=10, include_archived=False)259260 for workspace in workspaces:261 print(f"{workspace.id}: {workspace.name}")262 ```263264 ```typescript TypeScript265 const client = new Anthropic();266267 const workspaces = await client.beta.organization.workspaces.list({268 limit: 10,269 include_archived: false270 });271272 for await (const workspace of workspaces) {273 console.log(`${workspace.id}: ${workspace.name}`);274 }275 ```276277 ```csharp C#278 AnthropicClient client = new();279280 var workspaces = await client.Beta.Organization.Workspaces.List(new()281 {282 Limit = 10,283 IncludeArchived = false284 });285286 await foreach (var workspace in workspaces.Paginate())287 {288 Console.WriteLine($"{workspace.ID}: {workspace.Name}");289 }290 ```291292 ```go Go293 client := anthropic.NewClient()294295 workspaces := client.Beta.Organization.Workspaces.ListAutoPaging(context.Background(), anthropic.BetaOrganizationWorkspaceListParams{296 Limit: anthropic.Int(10),297 IncludeArchived: anthropic.Bool(false),298 })299300 for workspaces.Next() {301 workspace := workspaces.Current()302 fmt.Printf("%s: %s\n", workspace.ID, workspace.Name)303 }304 if err := workspaces.Err(); err != nil {305 log.Fatal(err)306 }307 ```308309 ```java Java310 import com.anthropic.models.beta.organization.workspaces.WorkspaceListParams;311312 void main() {313 AnthropicClient client = AnthropicOkHttpClient.fromEnv();314315 var params = WorkspaceListParams.builder()316 .limit(10)317 .includeArchived(false)318 .build();319 var workspaces = client.beta().organization().workspaces().list(params);320321 for (var workspace : workspaces.autoPager()) {322 IO.println(workspace.id() + ": " + workspace.name());323 }324 }325 ```326327 ```php PHP328 $client = new Client();329330 $workspaces = $client->beta->organization->workspaces->list(331 limit: 10,332 includeArchived: false,333 );334335 foreach ($workspaces->getItems() as $workspace) {336 echo "{$workspace->id}: {$workspace->name}\n";337 }338 ```339340 ```ruby Ruby341 client = Anthropic::Client.new342343 workspaces = client.beta.organization.workspaces.list(limit: 10, include_archived: false)344345 workspaces.data.each do |workspace|346 puts "#{workspace.id}: #{workspace.name}"347 end348 ```349</CodeGroup>350351Archive a workspace:352353<CodeGroup>354 ```bash cURL355 curl -X POST "https://api.anthropic.com/v1/organizations/workspaces/wrkspc_01JwQvzr7rXLA5AGx3HKfFUJ/archive" \356 -H "x-api-key: $ANTHROPIC_API_KEY" \357 -H "anthropic-version: 2023-06-01"358 ```359360 ```bash CLI361 ant beta:organization:workspaces archive --workspace-id wrkspc_01JwQvzr7rXLA5AGx3HKfFUJ362 ```363364 ```python Python365 client = anthropic.Anthropic()366367 workspace = client.beta.organization.workspaces.archive(368 "wrkspc_01JwQvzr7rXLA5AGx3HKfFUJ"369 )370371 print(f"id: {workspace.id}")372 print(f"archived_at: {workspace.archived_at}")373 ```374375 ```typescript TypeScript376 const client = new Anthropic();377378 const workspace = await client.beta.organization.workspaces.archive(379 "wrkspc_01JwQvzr7rXLA5AGx3HKfFUJ"380 );381382 console.log(`id: ${workspace.id}`);383 console.log(`archived_at: ${workspace.archived_at}`);384 ```385386 ```csharp C#387 AnthropicClient client = new();388389 var workspace = await client.Beta.Organization.Workspaces.Archive(390 "wrkspc_01JwQvzr7rXLA5AGx3HKfFUJ"391 );392393 Console.WriteLine($"id: {workspace.ID}");394 Console.WriteLine($"archived_at: {workspace.ArchivedAt:O}");395 ```396397 ```go Go398 client := anthropic.NewClient()399400 workspace, err := client.Beta.Organization.Workspaces.Archive(context.Background(), "wrkspc_01JwQvzr7rXLA5AGx3HKfFUJ")401 if err != nil {402 log.Fatal(err)403 }404405 fmt.Printf("id: %s\n", workspace.ID)406 fmt.Printf("archived_at: %s\n", workspace.ArchivedAt)407 ```408409 ```java Java410 AnthropicClient client = AnthropicOkHttpClient.fromEnv();411412 var workspace = client.beta().organization().workspaces()413 .archive("wrkspc_01JwQvzr7rXLA5AGx3HKfFUJ");414415 IO.println("id: " + workspace.id());416 IO.println("archived_at: " + workspace.archivedAt().orElseThrow());417 ```418419 ```php PHP420 $client = new Client();421422 $workspace = $client->beta->organization->workspaces->archive(423 workspaceID: 'wrkspc_01JwQvzr7rXLA5AGx3HKfFUJ',424 );425426 echo "id: {$workspace->id}\n";427 echo "archived_at: {$workspace->archivedAt?->format(DATE_ATOM)}\n";428 ```429430 ```ruby Ruby431 client = Anthropic::Client.new432433 workspace_id = "wrkspc_01JwQvzr7rXLA5AGx3HKfFUJ"434 workspace = client.beta.organization.workspaces.archive(workspace_id)435436 puts "id: #{workspace.id}"437 puts "archived_at: #{workspace.archived_at}"438 ```439</CodeGroup>440441For complete parameter details and response schemas, see the [Workspaces API reference](https://platform.claude.com/docs/en/api/admin/workspaces/retrieve).442443### Managing workspace members444445Add a member to a workspace:446447<CodeGroup>448 ```bash cURL449 curl -X POST "https://api.anthropic.com/v1/organizations/workspaces/wrkspc_01JwQvzr7rXLA5AGx3HKfFUJ/members" \450 -H "x-api-key: $ANTHROPIC_API_KEY" \451 -H "anthropic-version: 2023-06-01" \452 -H "content-type: application/json" \453 -d '{454 "user_id": "user_01XyDMpzjS89pFZXqSFUBDr6",455 "workspace_role": "workspace_developer"456 }'457 ```458459 ```bash CLI460 ant beta:organization:workspaces:members add \461 --workspace-id wrkspc_01JwQvzr7rXLA5AGx3HKfFUJ \462 --user-id user_01XyDMpzjS89pFZXqSFUBDr6 \463 --workspace-role workspace_developer464 ```465466 ```python Python467 client = anthropic.Anthropic()468469 member = client.beta.organization.workspaces.members.add(470 "wrkspc_01JwQvzr7rXLA5AGx3HKfFUJ",471 user_id="user_01XyDMpzjS89pFZXqSFUBDr6",472 workspace_role="workspace_developer",473 )474475 print(f"user_id: {member.user_id}")476 print(f"workspace_role: {member.workspace_role}")477 ```478479 ```typescript TypeScript480 const client = new Anthropic();481482 const member = await client.beta.organization.workspaces.members.add(483 "wrkspc_01JwQvzr7rXLA5AGx3HKfFUJ",484 {485 user_id: "user_01XyDMpzjS89pFZXqSFUBDr6",486 workspace_role: "workspace_developer"487 }488 );489490 console.log(`user_id: ${member.user_id}`);491 console.log(`workspace_role: ${member.workspace_role}`);492 ```493494 ```csharp C#495 using Anthropic.Models.Beta.Organization.Workspaces;496497 AnthropicClient client = new();498499 var member = await client.Beta.Organization.Workspaces.Members.Add(500 "wrkspc_01JwQvzr7rXLA5AGx3HKfFUJ",501 new()502 {503 UserID = "user_01XyDMpzjS89pFZXqSFUBDr6",504 WorkspaceRole = BetaNoBillingWorkspaceRole.WorkspaceDeveloper505 }506 );507508 Console.WriteLine($"user_id: {member.UserID}");509 Console.WriteLine($"workspace_role: {member.WorkspaceRole.Raw()}");510 ```511512 ```go Go513 client := anthropic.NewClient()514515 member, err := client.Beta.Organization.Workspaces.Members.Add(516 context.Background(),517 "wrkspc_01JwQvzr7rXLA5AGx3HKfFUJ",518 anthropic.BetaOrganizationWorkspaceMemberAddParams{519 UserID: "user_01XyDMpzjS89pFZXqSFUBDr6",520 WorkspaceRole: anthropic.BetaNoBillingWorkspaceRoleWorkspaceDeveloper,521 },522 )523 if err != nil {524 log.Fatal(err)525 }526527 fmt.Printf("user_id: %s\n", member.UserID)528 fmt.Printf("workspace_role: %s\n", member.WorkspaceRole)529 ```530531 ```java Java532 import com.anthropic.models.beta.organization.workspaces.BetaNoBillingWorkspaceRole;533 import com.anthropic.models.beta.organization.workspaces.members.MemberAddParams;534535 void main() {536 AnthropicClient client = AnthropicOkHttpClient.fromEnv();537538 var params = MemberAddParams.builder()539 .userId("user_01XyDMpzjS89pFZXqSFUBDr6")540 .workspaceRole(BetaNoBillingWorkspaceRole.WORKSPACE_DEVELOPER)541 .build();542 var member = client.beta().organization().workspaces().members()543 .add("wrkspc_01JwQvzr7rXLA5AGx3HKfFUJ", params);544545 IO.println("user_id: " + member.userId());546 IO.println("workspace_role: " + member.workspaceRole().asString());547 }548 ```549550 ```php PHP551 use Anthropic\Beta\Organization\Workspaces\NoBillingWorkspaceRole;552 // ...553554 $client = new Client();555556 $member = $client->beta->organization->workspaces->members->add(557 workspaceID: 'wrkspc_01JwQvzr7rXLA5AGx3HKfFUJ',558 userID: 'user_01XyDMpzjS89pFZXqSFUBDr6',559 workspaceRole: NoBillingWorkspaceRole::WORKSPACE_DEVELOPER,560 );561562 echo "user_id: {$member->userID}\n";563 echo "workspace_role: {$member->workspaceRole}\n";564 ```565566 ```ruby Ruby567 client = Anthropic::Client.new568569 workspace_id = "wrkspc_01JwQvzr7rXLA5AGx3HKfFUJ"570 member = client.beta.organization.workspaces.members.add(571 workspace_id,572 user_id: "user_01XyDMpzjS89pFZXqSFUBDr6",573 workspace_role: :workspace_developer574 )575576 puts "user_id: #{member.user_id}"577 puts "workspace_role: #{member.workspace_role}"578 ```579</CodeGroup>580581Update a member's role:582583<CodeGroup>584 ```bash cURL585 curl -X POST "https://api.anthropic.com/v1/organizations/workspaces/wrkspc_01JwQvzr7rXLA5AGx3HKfFUJ/members/user_01XyDMpzjS89pFZXqSFUBDr6" \586 -H "x-api-key: $ANTHROPIC_API_KEY" \587 -H "anthropic-version: 2023-06-01" \588 -H "content-type: application/json" \589 -d '{"workspace_role": "workspace_admin"}'590 ```591592 ```bash CLI593 ant beta:organization:workspaces:members update \594 --user-id user_01XyDMpzjS89pFZXqSFUBDr6 \595 --workspace-id wrkspc_01JwQvzr7rXLA5AGx3HKfFUJ \596 --workspace-role workspace_admin597 ```598599 ```python Python600 client = anthropic.Anthropic()601602 member = client.beta.organization.workspaces.members.update(603 "user_01XyDMpzjS89pFZXqSFUBDr6",604 workspace_id="wrkspc_01JwQvzr7rXLA5AGx3HKfFUJ",605 workspace_role="workspace_admin",606 )607608 print(f"user_id: {member.user_id}")609 print(f"workspace_role: {member.workspace_role}")610 ```611612 ```typescript TypeScript613 const client = new Anthropic();614615 const member = await client.beta.organization.workspaces.members.update(616 "user_01XyDMpzjS89pFZXqSFUBDr6",617 {618 workspace_id: "wrkspc_01JwQvzr7rXLA5AGx3HKfFUJ",619 workspace_role: "workspace_admin"620 }621 );622623 console.log(`user_id: ${member.user_id}`);624 console.log(`workspace_role: ${member.workspace_role}`);625 ```626627 ```csharp C#628 using Anthropic.Models.Beta.Organization.Workspaces;629630 AnthropicClient client = new();631632 var member = await client.Beta.Organization.Workspaces.Members.Update(633 "user_01XyDMpzjS89pFZXqSFUBDr6",634 new()635 {636 WorkspaceID = "wrkspc_01JwQvzr7rXLA5AGx3HKfFUJ",637 WorkspaceRole = BetaWorkspaceRole.WorkspaceAdmin638 }639 );640641 Console.WriteLine($"user_id: {member.UserID}");642 Console.WriteLine($"workspace_role: {member.WorkspaceRole.Raw()}");643 ```644645 ```go Go646 client := anthropic.NewClient()647648 member, err := client.Beta.Organization.Workspaces.Members.Update(649 context.Background(),650 "user_01XyDMpzjS89pFZXqSFUBDr6",651 anthropic.BetaOrganizationWorkspaceMemberUpdateParams{652 WorkspaceID: "wrkspc_01JwQvzr7rXLA5AGx3HKfFUJ",653 WorkspaceRole: anthropic.BetaWorkspaceRoleWorkspaceAdmin,654 },655 )656 if err != nil {657 log.Fatal(err)658 }659660 fmt.Printf("user_id: %s\n", member.UserID)661 fmt.Printf("workspace_role: %s\n", member.WorkspaceRole)662 ```663664 ```java Java665 import com.anthropic.models.beta.organization.workspaces.BetaWorkspaceRole;666 import com.anthropic.models.beta.organization.workspaces.members.MemberUpdateParams;667668 void main() {669 AnthropicClient client = AnthropicOkHttpClient.fromEnv();670671 var params = MemberUpdateParams.builder()672 .workspaceId("wrkspc_01JwQvzr7rXLA5AGx3HKfFUJ")673 .workspaceRole(BetaWorkspaceRole.WORKSPACE_ADMIN)674 .build();675 var member = client.beta().organization().workspaces().members()676 .update("user_01XyDMpzjS89pFZXqSFUBDr6", params);677678 IO.println("user_id: " + member.userId());679 IO.println("workspace_role: " + member.workspaceRole().asString());680 }681 ```682683 ```php PHP684 use Anthropic\Beta\Organization\Workspaces\WorkspaceRole;685 // ...686687 $client = new Client();688689 $member = $client->beta->organization->workspaces->members->update(690 userID: 'user_01XyDMpzjS89pFZXqSFUBDr6',691 workspaceID: 'wrkspc_01JwQvzr7rXLA5AGx3HKfFUJ',692 workspaceRole: WorkspaceRole::WORKSPACE_ADMIN,693 );694695 echo "user_id: {$member->userID}\n";696 echo "workspace_role: {$member->workspaceRole}\n";697 ```698699 ```ruby Ruby700 client = Anthropic::Client.new701702 user_id = "user_01XyDMpzjS89pFZXqSFUBDr6"703 member = client.beta.organization.workspaces.members.update(704 user_id,705 workspace_id: "wrkspc_01JwQvzr7rXLA5AGx3HKfFUJ",706 workspace_role: :workspace_admin707 )708709 puts "user_id: #{member.user_id}"710 puts "workspace_role: #{member.workspace_role}"711 ```712</CodeGroup>713714Remove a member from a workspace:715716<CodeGroup>717 ```bash cURL718 curl -X DELETE "https://api.anthropic.com/v1/organizations/workspaces/wrkspc_01JwQvzr7rXLA5AGx3HKfFUJ/members/user_01XyDMpzjS89pFZXqSFUBDr6" \719 -H "x-api-key: $ANTHROPIC_API_KEY" \720 -H "anthropic-version: 2023-06-01"721 ```722723 ```bash CLI724 ant beta:organization:workspaces:members remove \725 --user-id user_01XyDMpzjS89pFZXqSFUBDr6 \726 --workspace-id wrkspc_01JwQvzr7rXLA5AGx3HKfFUJ727 ```728729 ```python Python730 client = anthropic.Anthropic()731732 removed_member = client.beta.organization.workspaces.members.remove(733 "user_01XyDMpzjS89pFZXqSFUBDr6",734 workspace_id="wrkspc_01JwQvzr7rXLA5AGx3HKfFUJ",735 )736737 print(f"user_id: {removed_member.user_id}")738 ```739740 ```typescript TypeScript741 const client = new Anthropic();742743 const removedMember = await client.beta.organization.workspaces.members.remove(744 "user_01XyDMpzjS89pFZXqSFUBDr6",745 { workspace_id: "wrkspc_01JwQvzr7rXLA5AGx3HKfFUJ" }746 );747748 console.log(`user_id: ${removedMember.user_id}`);749 ```750751 ```csharp C#752 AnthropicClient client = new();753754 var removedMember = await client.Beta.Organization.Workspaces.Members.Remove(755 "user_01XyDMpzjS89pFZXqSFUBDr6",756 new() { WorkspaceID = "wrkspc_01JwQvzr7rXLA5AGx3HKfFUJ" }757 );758759 Console.WriteLine($"user_id: {removedMember.UserID}");760 ```761762 ```go Go763 client := anthropic.NewClient()764765 removedMember, err := client.Beta.Organization.Workspaces.Members.Remove(766 context.Background(),767 "user_01XyDMpzjS89pFZXqSFUBDr6",768 anthropic.BetaOrganizationWorkspaceMemberRemoveParams{769 WorkspaceID: "wrkspc_01JwQvzr7rXLA5AGx3HKfFUJ",770 },771 )772 if err != nil {773 log.Fatal(err)774 }775776 fmt.Printf("user_id: %s\n", removedMember.UserID)777 ```778779 ```java Java780 import com.anthropic.models.beta.organization.workspaces.members.MemberRemoveParams;781782 void main() {783 AnthropicClient client = AnthropicOkHttpClient.fromEnv();784785 var params = MemberRemoveParams.builder()786 .workspaceId("wrkspc_01JwQvzr7rXLA5AGx3HKfFUJ")787 .build();788 var removedMember = client.beta().organization().workspaces().members()789 .remove("user_01XyDMpzjS89pFZXqSFUBDr6", params);790791 IO.println("user_id: " + removedMember.userId());792 }793 ```794795 ```php PHP796 $client = new Client();797798 $removedMember = $client->beta->organization->workspaces->members->remove(799 userID: 'user_01XyDMpzjS89pFZXqSFUBDr6',800 workspaceID: 'wrkspc_01JwQvzr7rXLA5AGx3HKfFUJ',801 );802803 echo "user_id: {$removedMember->userID}\n";804 ```805806 ```ruby Ruby807 client = Anthropic::Client.new808809 user_id = "user_01XyDMpzjS89pFZXqSFUBDr6"810 removed_member = client.beta.organization.workspaces.members.remove(811 user_id,812 workspace_id: "wrkspc_01JwQvzr7rXLA5AGx3HKfFUJ"813 )814815 puts "user_id: #{removed_member.user_id}"816 ```817</CodeGroup>818819For complete parameter details, see the [Workspace Members API reference](https://platform.claude.com/docs/en/api/admin/workspaces/members/retrieve).820821## API keys and resource scoping822823Every request runs in exactly one workspace and can only access resources within that workspace. Which workspace depends on the [key type](https://platform.claude.com/docs/en/manage-claude/authentication#key-types):824825* A **workspace key** (a legacy key without an owner) belongs to the workspace it was created in and always runs there.826* A **personal key** or **service account key** acts as its user or service account. A single-workspace key always runs in the workspace chosen when it was created. A multi-workspace key runs in the workspace named by each request's `anthropic-workspace-id` header. Accounts must have access to the workspace to use it.827828Resources scoped to workspaces include:829830* **Files** created through the [Files API](https://platform.claude.com/docs/en/build-with-claude/files)831* **Message Batches** created through the [Batch API](https://platform.claude.com/docs/en/build-with-claude/batch-processing)832* **Skills** created through the [Skills API](https://platform.claude.com/docs/en/build-with-claude/skills-guide)833834Some resources are managed differently:835836* **[MCP tunnels](https://platform.claude.com/docs/en/agents-and-tools/mcp-tunnels/overview)** are managed with a `workspace:manage_tunnels` OAuth token obtained through [Workload Identity Federation](https://platform.claude.com/docs/en/manage-claude/workload-identity-federation), not an API key. Tunnels are created in a workspace, and the Console **MCP tunnels** list and the Managed Agent server picker show tunnels in the current workspace only; the cap of 10 active tunnels applies organization-wide. Tunnel management requires a role with tunnel management permissions; organization developers can view but not change them.837* **Workspaces** themselves and **organization members** are managed at the organization level through the [Admin API](https://platform.claude.com/docs/en/manage-claude/admin-api), using an Admin API key, an `org:admin` OAuth token, or a personal or service account key that isn't scoped to a specific workspace.838839To look up your organization's workspace IDs, call the [List Workspaces](https://platform.claude.com/docs/en/api/admin/workspaces/list) endpoint or find them in the [Claude Console](https://platform.claude.com/settings/workspaces).840841<Note>842 [Prompt caches](https://platform.claude.com/docs/en/build-with-claude/prompt-caching) are also isolated per workspace on the Claude API, [Claude Platform on AWS](https://platform.claude.com/docs/en/build-with-claude/claude-platform-on-aws), and [Microsoft Foundry](https://platform.claude.com/docs/en/build-with-claude/claude-in-microsoft-foundry). On Amazon Bedrock and Google Cloud, prompt caches are isolated per organization.843</Note>844845## Identify the workspace behind an API response846847Claude API responses include an `anthropic-workspace-id` header alongside the `request-id` and `anthropic-organization-id` [response headers](https://platform.claude.com/docs/en/api/overview#response-headers). Its value is the `wrkspc_`-prefixed ID of the workspace that the request's API key or access token resolved to, including when that workspace is the Default Workspace. For example, a successful response includes headers like these:848849```http850HTTP/1.1 200 OK851request-id: req_018EeWyXxfu5pfWkrYcMdjWG852anthropic-organization-id: 0d0e7a3b-52f1-4c7e-9a51-3f6f2f7c1b9e853anthropic-workspace-id: wrkspc_01JwQvzr7rXLA5AGx3HKfFUJ854```855856The header is absent when the credential doesn't resolve to a workspace (for example, on Admin API requests) or when the request fails before authentication completes, such as a 401 error.857858The following examples send a Messages API request and print the workspace ID from the response headers:859860<CodeGroup>861 ```bash cURL862 # -D - prints the response headers; -o /dev/null discards the body863 curl -sS -D - -o /dev/null https://api.anthropic.com/v1/messages \864 -H "x-api-key: $ANTHROPIC_API_KEY" \865 -H "anthropic-version: 2023-06-01" \866 -H "content-type: application/json" \867 -d '{868 "model": "claude-opus-5",869 "max_tokens": 1024,870 "messages": [{"role": "user", "content": "Hello, Claude"}]871 }' | grep -i '^anthropic-workspace-id'872 ```873874 ```bash CLI875 # --debug prints the HTTP response, including the Anthropic-Workspace-Id876 # header, to stderr; > /dev/null hides the JSON body on stdout877 ant --debug messages create \878 --model claude-opus-5 \879 --max-tokens 1024 \880 --message '{role: user, content: "Hello, Claude"}' > /dev/null881 ```882883 ```python Python884 client = anthropic.Anthropic()885886 response = client.messages.with_raw_response.create(887 model="claude-opus-5",888 max_tokens=1024,889 messages=[{"role": "user", "content": "Hello, Claude"}],890 )891 workspace_id = response.headers.get("anthropic-workspace-id")892 print(f"Workspace ID: {workspace_id}")893 ```894895 ```typescript TypeScript896 const client = new Anthropic();897898 const { response } = await client.messages899 .create({900 model: "claude-opus-5",901 max_tokens: 1024,902 messages: [{ role: "user", content: "Hello, Claude" }]903 })904 .withResponse();905 console.log("Workspace ID:", response.headers.get("anthropic-workspace-id"));906 ```907908 ```csharp C#909 AnthropicClient client = new();910911 using var response = await client.WithRawResponse.Messages.Create(new()912 {913 Model = Model.ClaudeOpus5,914 MaxTokens = 1024,915 Messages = [new() { Role = Role.User, Content = "Hello, Claude" }]916 });917 var workspaceId = response.GetHeaderValues("anthropic-workspace-id").First();918 Console.WriteLine($"Workspace ID: {workspaceId}");919 ```920921 ```go Go922 client := anthropic.NewClient()923924 var response *http.Response925 _, err := client.Messages.New(926 context.Background(),927 anthropic.MessageNewParams{928 Model: anthropic.ModelClaudeOpus5,929 MaxTokens: 1024,930 Messages: []anthropic.MessageParam{931 anthropic.NewUserMessage(anthropic.NewTextBlock("Hello, Claude")),932 },933 },934 option.WithResponseInto(&response),935 )936 if err != nil {937 log.Fatal(err)938 }939940 fmt.Println("Workspace ID:", response.Header.Get("anthropic-workspace-id"))941 ```942943 ```java Java944 import com.anthropic.client.AnthropicClient;945 import com.anthropic.client.okhttp.AnthropicOkHttpClient;946 import com.anthropic.core.http.HttpResponseFor;947 import com.anthropic.models.messages.Message;948 import com.anthropic.models.messages.MessageCreateParams;949 import com.anthropic.models.messages.Model;950951 void main() {952 AnthropicClient client = AnthropicOkHttpClient.fromEnv();953954 HttpResponseFor<Message> response = client.messages().withRawResponse().create(955 MessageCreateParams.builder()956 .model(Model.CLAUDE_OPUS_5)957 .maxTokens(1024)958 .addUserMessage("Hello, Claude")959 .build()960 );961962 String workspaceId = response.headers().values("anthropic-workspace-id").getFirst();963 IO.println("Workspace ID: " + workspaceId);964 }965 ```966967 ```php PHP968 $client = new Client();969970 $response = $client->messages->raw->create([971 'model' => Model::CLAUDE_OPUS_5,972 'maxTokens' => 1024,973 'messages' => [['role' => 'user', 'content' => 'Hello, Claude']],974 ]);975 echo 'Workspace ID: ' . $response->getHeaderLine('anthropic-workspace-id') . "\n";976 ```977978 ```ruby Ruby979 client = Anthropic::Client.new980981 # Read response headers in per-request middleware, which receives the982 # raw HTTP response before the SDK parses it983 workspace_id = nil984 read_workspace_id = lambda do |request, call_next|985 response = call_next.call(request)986 # Keys in response.headers are lowercase987 workspace_id = response.headers["anthropic-workspace-id"]988 response989 end990991 client.messages.create(992 model: Anthropic::Model::CLAUDE_OPUS_5,993 max_tokens: 1024,994 messages: [{ role: "user", content: "Hello, Claude" }],995 request_options: { middleware: [read_workspace_id] }996 )997 puts "Workspace ID: #{workspace_id}"998 ```999</CodeGroup>10001001```text Output wrap1002Workspace ID: wrkspc_01JwQvzr7rXLA5AGx3HKfFUJ1003```10041005The same accessors read the header from other Claude API endpoints too, including the [Claude Managed Agents](https://platform.claude.com/docs/en/managed-agents/overview) APIs. For example, read `anthropic-workspace-id` from the response that [creates a session](https://platform.claude.com/docs/en/managed-agents/sessions) to record which workspace the session belongs to.10061007With the workspace ID from a response, you can:10081009* Confirm which workspace's usage, cost, and [rate limits](https://platform.claude.com/docs/en/api/rate-limits) the request counted toward1010* Match it against the `workspace_id` field in [Usage and Cost API](https://platform.claude.com/docs/en/manage-claude/usage-cost-api) reports and on [Admin API](https://platform.claude.com/docs/en/manage-claude/admin-api) objects such as API keys (both report `null` for the Default Workspace, as API keys also do for all-workspaces keys; an API key's `scope` field tells the two apart and, for a key bound to one workspace, carries that workspace's real ID)1011* Check whether it's your Default Workspace's ID by passing it to [Get Workspace](https://platform.claude.com/docs/en/api/admin/workspaces/retrieve) with an [Admin API key](https://platform.claude.com/docs/en/manage-claude/admin-api-keys): the Default Workspace comes back with `"name": "Default"`, even though [List Workspaces](https://platform.claude.com/docs/en/api/admin/workspaces/list) omits it1012* Open that workspace in the [Console](https://platform.claude.com/settings/workspaces) to find the request's resources, such as sessions, files, message batches, and skills10131014## Workspace limits10151016You can set custom spend and rate limits for each workspace to protect against overuse and ensure fair resource distribution.10171018### Setting workspace limits10191020You can set workspace limits lower than (but not higher than) your organization's limits:10211022* **Spend limits:** Cap monthly spending for a workspace. Set these on the workspace's **Spend limits** settings tab in the [Claude Console](https://platform.claude.com/settings/workspaces).1023* **Rate limits:** Limit requests per minute, input tokens per minute, or output tokens per minute. Set these on the workspace's **Rate limits** settings tab in the [Claude Console](https://platform.claude.com/settings/workspaces).10241025<Note>1026 - You cannot set limits on the Default Workspace1027 - If not set, workspace limits match the organization's limits1028 - Organization-wide limits always apply, even if workspace limits add up to more1029</Note>10301031For detailed information on rate limits and how they work, see [Rate limits](https://platform.claude.com/docs/en/api/rate-limits). You can also read your current organization and workspace rate limits programmatically with the [Rate Limits API](https://platform.claude.com/docs/en/manage-claude/rate-limits-api).10321033## Usage and cost tracking10341035Track usage and costs by workspace using the [Usage and Cost API](https://platform.claude.com/docs/en/manage-claude/usage-cost-api):10361037```bash cURL1038curl "https://api.anthropic.com/v1/organizations/usage_report/messages?\1039starting_at=2025-01-01T00:00:00Z&\1040ending_at=2025-01-08T00:00:00Z&\1041workspace_ids[]=wrkspc_01JwQvzr7rXLA5AGx3HKfFUJ&\1042group_by[]=workspace_id&\1043bucket_width=1d" \1044 -H "anthropic-version: 2023-06-01" \1045 -H "x-api-key: $ANTHROPIC_ADMIN_KEY"1046```10471048Usage and costs attributed to the Default Workspace have a `null` value for `workspace_id`.10491050## Common use cases10511052### Environment separation10531054Create separate workspaces for development, staging, and production:10551056| Workspace | Purpose |1057| ----------- | -------------------------------------------------- |1058| Development | Testing and experimentation with lower rate limits |1059| Staging | Pre-production testing with production-like limits |1060| Production | Live traffic with full rate limits and monitoring |10611062### Team or department isolation10631064Assign workspaces to different teams for cost allocation and access control:10651066* **Engineering team** with developer access1067* **Data science team** with their own API keys1068* **Support team** with limited access for customer tools10691070### Project-based organization10711072Create workspaces for specific projects or products to track usage and costs separately.10731074## Best practices10751076<Steps>1077 <Step title="Plan your workspace structure">1078 Consider how you'll organize workspaces before creating them. Think about billing, access control, and usage tracking needs.1079 </Step>10801081 <Step title="Use meaningful names">1082 Name workspaces clearly to indicate their purpose (for example, "Production - Customer Chatbot" or "Dev - Internal Tools").1083 </Step>10841085 <Step title="Set appropriate limits">1086 Configure spend and rate limits to prevent unexpected costs and ensure fair resource distribution.1087 </Step>10881089 <Step title="Audit access regularly">1090 Review workspace membership periodically to ensure only appropriate users have access.1091 </Step>10921093 <Step title="Monitor usage">1094 Use the [Usage and Cost API](https://platform.claude.com/docs/en/manage-claude/usage-cost-api) to track workspace-level consumption.1095 </Step>1096</Steps>10971098## FAQ10991100<AccordionGroup>1101 <Accordion title="What's the Default Workspace?">1102 Every organization has a "Default Workspace" that cannot be renamed, archived, or deleted. Like every workspace, it has a `wrkspc_` ID: the API returns it in the [`anthropic-workspace-id` response header](https://platform.claude.com/docs/en/manage-claude/workspaces#identify-the-workspace-behind-an-api-response), and you can pass it to [Get Workspace](https://platform.claude.com/docs/en/api/admin/workspaces/retrieve) and [Update Workspace](https://platform.claude.com/docs/en/api/admin/workspaces/update). It has no member list of its own, because access to it follows each member's organization role. It doesn't appear in [List Workspaces](https://platform.claude.com/docs/en/api/admin/workspaces/list) results, and API keys, usage reports, and cost reports that belong to it show `null` for `workspace_id`, as do all-workspaces API keys; an API key's `scope` field tells the two apart and, for a key that belongs to the Default Workspace, carries its real ID.1103 </Accordion>11041105 <Accordion title="What's the Claude Code workspace?">1106 Anthropic creates the Claude Code workspace automatically the first time a member of your organization signs in to Claude Code with their Console account. It isolates Claude Code's API keys, usage, and rate limits from your other workloads. See [Claude Code workspace](https://platform.claude.com/docs/en/manage-claude/workspaces#claude-code-workspace) for details.1107 </Accordion>11081109 <Accordion title="Are there limits on workspaces?">1110 Yes. Each organization can have up to 100 workspaces by default, and archived workspaces don't count toward this limit. If you need more, contact your account team.1111 </Accordion>11121113 <Accordion title="How do organization roles affect workspace access?">1114 Organization admins automatically get the Workspace Admin role in all workspaces. Organization billing members automatically get the Workspace Billing role. Organization users and developers must be manually added to each workspace.1115 </Accordion>11161117 <Accordion title="Which roles can be assigned in workspaces?">1118 Organization users and developers can be assigned Workspace Admin, Workspace Developer, Workspace Limited Developer, or Workspace User roles. The Workspace Billing role cannot be manually assigned; it's inherited from having the organization `billing` role.1119 </Accordion>11201121 <Accordion title="Can organization admin or billing members' workspace roles be changed?">1122 Organization admins and billing members cannot have their workspace roles changed or be removed from workspaces while they hold those organization roles (with one exception: billing members can be upgraded to a Workspace Admin role). For everyone else covered by this constraint, change their organization role first to change their workspace access.1123 </Accordion>11241125 <Accordion title="What happens to workspace access when organization roles change?">1126 If an organization admin or billing member is demoted to user or developer, they lose access to all workspaces except ones where they were manually assigned roles. When users are promoted to admin or billing roles, they gain automatic access to all workspaces.1127 </Accordion>11281129 <Accordion title="What happens to API keys when a user is removed from a workspace?">1130 Behavior depends on the [key type](https://platform.claude.com/docs/en/manage-claude/authentication#key-types).11311132 A personal or service account key stops working in a workspace shortly after its user or service account is removed from it. A service account key keeps working even if the user who created it is removed. Workspace API keys continue to work. In the [Claude Code workspace](https://platform.claude.com/docs/en/manage-claude/workspaces#claude-code-workspace), each key is bound to the member who created it and stops working when that member is removed.11331134 Personal keys are archived when their user is removed from the organization. If the user is re-invited, they need to create new keys; archived keys are not restored.1135 </Accordion>1136</AccordionGroup>11371138## See also11391140* [Admin API](https://platform.claude.com/docs/en/manage-claude/admin-api)1141* [Admin API reference](https://platform.claude.com/docs/en/api/admin)1142* [Rate limits](https://platform.claude.com/docs/en/api/rate-limits)1143* [Usage and Cost API](https://platform.claude.com/docs/en/manage-claude/usage-cost-api)1144