The whole hunk
from line 137, old and new numbered
/
lines
The two sides of this change are more than 400 edits apart, too far apart to line up, so this is the differ's own diff of it and the words inside a line are not marked.
from line 137
137137 To attach the key to an additional workspace, add that workspace's compartment ID to the condition with `kms:PutKeyPolicy` before attaching.
138138 </Note>
139139
140 <Steps>
141 <Step title="Register the key with Anthropic">
142 Create an external key configuration through the Admin API.
143
144 <CodeGroup>
145 ```bash cURL
146 curl -sS "https://api.anthropic.com/v1/organizations/external_keys" \
147 -H "x-api-key: $ANTHROPIC_API_KEY" \
148 -H "anthropic-version: 2023-06-01" \
149 -H "content-type: application/json" \
150 -d '{
151 "display_name": "<friendly-name>",
152 "geo": "us",
153 "provider_config": {
154 "type": "aws",
155 "kms_arn": "<key-arn-from-create-key-step>"
140 You can set up the key in the Claude Console or through the Admin API, with the same result.
141
142 <Tabs>
143 <Tab title="Claude Console">
144 <Steps>
145 <Step title="Register the key with Anthropic">
146 In the Claude Console, open **Settings > Encryption keys** and click **Add key**. Enter a display name, choose **AWS KMS**, and click **Continue**. Paste the key ARN into **KMS key ARN**, and click **Add**.
147 </Step>
148
149 <Step title="Validate the key">
150 On the **Encryption keys** page, click **Verify** next to the key. **Connected** appears when the check passes. If it fails, a message gives the reason.
151 </Step>
152
153 <Step title="Attach the key to a workspace">
154 Open **Settings > Workspaces**, choose the workspace, and open its **Security** tab. Under **Encryption key**, select the key, click **Save**, and confirm. Attaching a key can't be undone. For a workspace that already receives requests, the key can take [up to a day to take effect](https://platform.claude.com/docs/en/manage-claude/cmek#how-it-works).
155 </Step>
156 </Steps>
157 </Tab>
158
159 <Tab title="API">
160 <Steps>
161 <Step title="Register the key with Anthropic">
162 Create an external key configuration through the Admin API.
163
164 <CodeGroup>
165 ```bash cURL
166 curl -sS "https://api.anthropic.com/v1/organizations/external_keys" \
167 -H "x-api-key: $ANTHROPIC_API_KEY" \
168 -H "anthropic-version: 2023-06-01" \
169 -H "content-type: application/json" \
170 -d '{
171 "display_name": "<friendly-name>",
172 "geo": "us",
173 "provider_config": {
174 "type": "aws",
175 "kms_arn": "<key-arn-from-create-key-step>"
176 }
177 }'
178 ```
179
180 ```bash CLI
181 ant beta:organization:external-keys create <<'YAML'
182 display_name: "<friendly-name>"
183 geo: us
184 provider_config:
185 type: aws
186 kms_arn: "<key-arn-from-create-key-step>"
187 YAML
188 ```
189
190 ```python Python
191 client = anthropic.Anthropic()
192
193 external_key = client.beta.organization.external_keys.create(
194 display_name="<friendly-name>",
195 geo="us",
196 provider_config={"type": "aws", "kms_arn": "<key-arn-from-create-key-step>"},
197 )
198
199 print(f"id: {external_key.id}")
200 print(f"display_name: {external_key.display_name}")
201 ```
202
203 ```typescript TypeScript
204 const client = new Anthropic();
205
206 const externalKey = await client.beta.organization.externalKeys.create({
207 display_name: "<friendly-name>",
208 geo: "us",
209 provider_config: {
210 type: "aws",
211 kms_arn: "<key-arn-from-create-key-step>"
212 }
213 });
214
215 console.log(`id: ${externalKey.id}`);
216 console.log(`display_name: ${externalKey.display_name}`);
217 ```
218
219 ```csharp C#
220 using Anthropic.Models.Beta.Organization.ExternalKeys;
221
222 AnthropicClient client = new();
223
224 var externalKey = await client.Beta.Organization.ExternalKeys.Create(new()
225 {
226 DisplayName = "<friendly-name>",
227 Geo = Geo.Us,
228 ProviderConfig = new BetaAwsExternalKeyConfig
229 {
230 KmsArn = "<key-arn-from-create-key-step>"
231 }
232 });
233
234 Console.WriteLine($"id: {externalKey.ID}");
235 Console.WriteLine($"display_name: {externalKey.DisplayName}");
236 ```
237
238 ```go Go
239 client := anthropic.NewClient()
240
241 externalKey, err := client.Beta.Organization.ExternalKeys.New(context.Background(), anthropic.BetaOrganizationExternalKeyNewParams{
242 DisplayName: anthropic.String("<friendly-name>"),
243 Geo: anthropic.BetaOrganizationExternalKeyNewParamsGeoUs,
244 ProviderConfig: anthropic.BetaOrganizationExternalKeyNewParamsProviderConfigUnion{
245 OfAWS: &anthropic.BetaAWSExternalKeyConfigParam{
246 KMSARN: "<key-arn-from-create-key-step>",
247 },
248 },
249 })
250 if err != nil {
251 log.Fatal(err)
156252 }
157 }'
158 ```
159
160 ```bash CLI
161 ant beta:organization:external-keys create <<'YAML'
162 display_name: "<friendly-name>"
163 geo: us
164 provider_config:
165 type: aws
166 kms_arn: "<key-arn-from-create-key-step>"
167 YAML
168 ```
169
170 ```python Python
171 client = anthropic.Anthropic()
172
173 external_key = client.beta.organization.external_keys.create(
174 display_name="<friendly-name>",
175 geo="us",
176 provider_config={"type": "aws", "kms_arn": "<key-arn-from-create-key-step>"},
177 )
178
179 print(f"id: {external_key.id}")
180 print(f"display_name: {external_key.display_name}")
181 ```
182
183 ```typescript TypeScript
184 const client = new Anthropic();
185
186 const externalKey = await client.beta.organization.externalKeys.create({
187 display_name: "<friendly-name>",
188 geo: "us",
189 provider_config: {
190 type: "aws",
191 kms_arn: "<key-arn-from-create-key-step>"
253
254 fmt.Printf("id: %s\n", externalKey.ID)
255 fmt.Printf("display_name: %s\n", externalKey.DisplayName)
256 ```
257
258 ```java Java
259 import com.anthropic.models.beta.organization.externalkeys.BetaAwsExternalKeyConfig;
260 import com.anthropic.models.beta.organization.externalkeys.ExternalKeyCreateParams;
261
262 void main() {
263 AnthropicClient client = AnthropicOkHttpClient.fromEnv();
264
265 var params = ExternalKeyCreateParams.builder()
266 .displayName("<friendly-name>")
267 .geo(ExternalKeyCreateParams.Geo.US)
268 .providerConfig(BetaAwsExternalKeyConfig.builder()
269 .kmsArn("<key-arn-from-create-key-step>")
270 .build())
271 .build();
272 var externalKey = client.beta().organization().externalKeys().create(params);
273
274 IO.println("id: " + externalKey.id());
275 IO.println("display_name: " + externalKey.displayName().orElseThrow());
276 }
277 ```
278
279 ```php PHP
280 use Anthropic\Beta\Organization\ExternalKeys\ExternalKeyCreateParams\Geo;
281 // ...
282
283 $client = new Client();
284
285 $externalKey = $client->beta->organization->externalKeys->create(
286 displayName: '<friendly-name>',
287 geo: Geo::US,
288 providerConfig: [
289 'type' => 'aws',
290 'kmsARN' => '<key-arn-from-create-key-step>',
291 ],
292 );
293
294 echo "id: {$externalKey->id}\n";
295 echo "display_name: {$externalKey->displayName}\n";
296 ```
297
298 ```ruby Ruby
299 client = Anthropic::Client.new
300
301 external_key = client.beta.organization.external_keys.create(
302 display_name: "<friendly-name>",
303 geo: :us,
304 provider_config: {
305 type: :aws,
306 kms_arn: "<key-arn-from-create-key-step>"
307 }
308 )
309
310 puts "id: #{external_key.id}"
311 puts "display_name: #{external_key.display_name}"
312 ```
313 </CodeGroup>
314
315 The response contains the external key ID:
316
317 ```json
318 {
319 "type": "external_key",
320 "id": "ekey_<id>",
321 "display_name": "<friendly-name>"
192322 }
193 });
194
195 console.log(`id: ${externalKey.id}`);
196 console.log(`display_name: ${externalKey.display_name}`);
197 ```
198
199 ```csharp C#
200 using Anthropic.Models.Beta.Organization.ExternalKeys;
201
202 AnthropicClient client = new();
203
204 var externalKey = await client.Beta.Organization.ExternalKeys.Create(new()
205 {
206 DisplayName = "<friendly-name>",
207 Geo = Geo.Us,
208 ProviderConfig = new BetaAwsExternalKeyConfig
323 ```
324 </Step>
325
326 <Step title="Validate the key">
327 Trigger an encrypt and decrypt round-trip against your key.
328
329 <CodeGroup>
330 ```bash cURL
331 curl -sS -X POST "https://api.anthropic.com/v1/organizations/external_keys/ekey_<id>/validate" \
332 -H "x-api-key: $ANTHROPIC_API_KEY" \
333 -H "anthropic-version: 2023-06-01"
334 ```
335
336 ```bash CLI
337 ant beta:organization:external-keys validate --external-key-id "ekey_<id>"
338 ```
339
340 ```python Python
341 client = anthropic.Anthropic()
342
343 validation = client.beta.organization.external_keys.validate("ekey_<id>")
344
345 print(f"status: {validation.status}")
346 print(f"error: {validation.error}")
347 ```
348
349 ```typescript TypeScript
350 const client = new Anthropic();
351
352 const validation = await client.beta.organization.externalKeys.validate("ekey_<id>");
353
354 console.log(`status: ${validation.status}`);
355 console.log(`error: ${validation.error}`);
356 ```
357
358 ```csharp C#
359 AnthropicClient client = new();
360
361 var validation = await client.Beta.Organization.ExternalKeys.Validate("ekey_<id>");
362
363 Console.WriteLine($"status: {validation.Status.Raw()}");
364 Console.WriteLine($"error: {validation.Error}");
365 ```
366
367 ```go Go
368 client := anthropic.NewClient()
369
370 validation, err := client.Beta.Organization.ExternalKeys.Validate(context.Background(), "ekey_<id>")
371 if err != nil {
372 log.Fatal(err)
373 }
374
375 fmt.Printf("status: %s\n", validation.Status)
376 fmt.Printf("error: %s\n", validation.Error)
377 ```
378
379 ```java Java
380 AnthropicClient client = AnthropicOkHttpClient.fromEnv();
381
382 var validation = client.beta().organization().externalKeys().validate("ekey_<id>");
383
384 IO.println("status: " + validation.status().asString());
385 IO.println("error: " + validation.error().orElse(""));
386 ```
387
388 ```php PHP
389 $client = new Client();
390
391 $validation = $client->beta->organization->externalKeys->validate(
392 externalKeyID: 'ekey_<id>',
393 );
394
395 echo "status: {$validation->status}\n";
396 echo "error: {$validation->error}\n";
397 ```
398
399 ```ruby Ruby
400 client = Anthropic::Client.new
401
402 external_key_id = "ekey_<id>"
403 validation = client.beta.organization.external_keys.validate(external_key_id)
404
405 puts "status: #{validation.status}"
406 puts "error: #{validation.error}"
407 ```
408 </CodeGroup>
409
410 A successful response looks like this:
411
412 ```json
413 { "type": "external_key_validation", "status": "success", "error": null }
414 ```
415
416 If validation fails, common causes are:
417
418 * **Encryption context mismatch:** Validation fails while data traffic works (or the reverse) with an opaque `AccessDeniedException` when a `kms:EncryptionContext:anthropic:compartment_uuid` condition allows only one of the two values Anthropic sends. Validation sends the all-zeros UUID (`00000000-0000-0000-0000-000000000000`); live traffic sends the attached workspace's compartment ID. Confirm the condition lists both. To rule the condition out entirely, temporarily remove the `Condition` block from the `AllowAnthropicCMEKCrypto` statement and re-validate.
419 * **Resource control policies (RCPs):** If your AWS organization has an RCP that denies KMS operations when `aws:PrincipalOrgID` does not match your org, it blocks Anthropic's cross-account role. The RCP needs a carve-out for this key or for Anthropic's role ARN. Service control policies do not apply here, because they do not evaluate for external principals calling through resource-based policies.
420 * **Access granted through IAM instead of the key policy:** Cross-account KMS access must be granted in the key policy itself, not through an IAM policy in your account. Check with `aws kms get-key-policy --key-id <id> --policy-name default`.
421 * **Region mismatch:** Confirm the key's region is one Anthropic operates in for the geo tier you configured.
422 </Step>
423
424 <Step title="Attach the key to a workspace">
425 Once the key is validated, attach it to a new workspace before you send any requests to that workspace. For a workspace that already receives requests, the key can take [up to a day to take effect](https://platform.claude.com/docs/en/manage-claude/cmek#how-it-works).
426
427 <CodeGroup>
428 ```bash cURL
429 curl -sS -X POST "https://api.anthropic.com/v1/organizations/workspaces/<workspace-id>" \
430 -H "x-api-key: $ANTHROPIC_API_KEY" \
431 -H "anthropic-version: 2023-06-01" \
432 -H "content-type: application/json" \
433 -d '{
434 "external_key_id": "ekey_<id>"
435 }'
436 ```
437
438 ```bash CLI
439 ant beta:organization:workspaces update \
440 --workspace-id "<workspace-id>" \
441 --external-key-id "ekey_<id>"
442 ```
443
444 ```python Python
445 client = anthropic.Anthropic()
446
447 workspace = client.beta.organization.workspaces.update(
448 "<workspace-id>", external_key_id="ekey_<id>"
449 )
450
451 print(f"id: {workspace.id}")
452 print(f"external_key_id: {workspace.external_key_id}")
453 ```
454
455 ```typescript TypeScript
456 const client = new Anthropic();
457
458 const workspace = await client.beta.organization.workspaces.update("<workspace-id>", {
459 external_key_id: "ekey_<id>"
460 });
461
462 console.log(`id: ${workspace.id}`);
463 console.log(`external_key_id: ${workspace.external_key_id}`);
464 ```
465
466 ```csharp C#
467 AnthropicClient client = new();
468
469 var workspace = await client.Beta.Organization.Workspaces.Update("<workspace-id>", new()
209470 {
210 KmsArn = "<key-arn-from-create-key-step>"
471 ExternalKeyID = "ekey_<id>"
472 });
473
474 Console.WriteLine($"id: {workspace.ID}");
475 Console.WriteLine($"external_key_id: {workspace.ExternalKeyID}");
476 ```
477
478 ```go Go
479 client := anthropic.NewClient()
480
481 workspace, err := client.Beta.Organization.Workspaces.Update(
482 context.Background(),
483 "<workspace-id>",
484 anthropic.BetaOrganizationWorkspaceUpdateParams{
485 ExternalKeyID: anthropic.String("ekey_<id>"),
486 },
487 )
488 if err != nil {
489 log.Fatal(err)
211490 }
212 });
213
214 Console.WriteLine($"id: {externalKey.ID}");
215 Console.WriteLine($"display_name: {externalKey.DisplayName}");
216 ```
217
218 ```go Go
219 client := anthropic.NewClient()
220
221 externalKey, err := client.Beta.Organization.ExternalKeys.New(context.Background(), anthropic.BetaOrganizationExternalKeyNewParams{
222 DisplayName: anthropic.String("<friendly-name>"),
223 Geo: anthropic.BetaOrganizationExternalKeyNewParamsGeoUs,
224 ProviderConfig: anthropic.BetaOrganizationExternalKeyNewParamsProviderConfigUnion{
225 OfAWS: &anthropic.BetaAWSExternalKeyConfigParam{
226 KMSARN: "<key-arn-from-create-key-step>",
227 },
228 },
229 })
230 if err != nil {
231 log.Fatal(err)
232 }
233
234 fmt.Printf("id: %s\n", externalKey.ID)
235 fmt.Printf("display_name: %s\n", externalKey.DisplayName)
236 ```
237
238 ```java Java
239 import com.anthropic.models.beta.organization.externalkeys.BetaAwsExternalKeyConfig;
240 import com.anthropic.models.beta.organization.externalkeys.ExternalKeyCreateParams;
241
242 void main() {
243 AnthropicClient client = AnthropicOkHttpClient.fromEnv();
244
245 var params = ExternalKeyCreateParams.builder()
246 .displayName("<friendly-name>")
247 .geo(ExternalKeyCreateParams.Geo.US)
248 .providerConfig(BetaAwsExternalKeyConfig.builder()
249 .kmsArn("<key-arn-from-create-key-step>")
250 .build())
251 .build();
252 var externalKey = client.beta().organization().externalKeys().create(params);
253
254 IO.println("id: " + externalKey.id());
255 IO.println("display_name: " + externalKey.displayName().orElseThrow());
256 }
257 ```
258
259 ```php PHP
260 use Anthropic\Beta\Organization\ExternalKeys\ExternalKeyCreateParams\Geo;
261 // ...
262
263 $client = new Client();
264
265 $externalKey = $client->beta->organization->externalKeys->create(
266 displayName: '<friendly-name>',
267 geo: Geo::US,
268 providerConfig: [
269 'type' => 'aws',
270 'kmsARN' => '<key-arn-from-create-key-step>',
271 ],
272 );
273
274 echo "id: {$externalKey->id}\n";
275 echo "display_name: {$externalKey->displayName}\n";
276 ```
277
278 ```ruby Ruby
279 client = Anthropic::Client.new
280
281 external_key = client.beta.organization.external_keys.create(
282 display_name: "<friendly-name>",
283 geo: :us,
284 provider_config: {
285 type: :aws,
286 kms_arn: "<key-arn-from-create-key-step>"
287 }
288 )
289
290 puts "id: #{external_key.id}"
291 puts "display_name: #{external_key.display_name}"
292 ```
293 </CodeGroup>
294
295 The response contains the external key ID:
296
297 ```json
298 {
299 "type": "external_key",
300 "id": "ekey_<id>",
301 "display_name": "<friendly-name>"
302 }
303 ```
304 </Step>
305
306 <Step title="Validate the key">
307 Trigger an encrypt and decrypt round-trip against your key.
308
309 <CodeGroup>
310 ```bash cURL
311 curl -sS -X POST "https://api.anthropic.com/v1/organizations/external_keys/ekey_<id>/validate" \
312 -H "x-api-key: $ANTHROPIC_API_KEY" \
313 -H "anthropic-version: 2023-06-01"
314 ```
315
316 ```bash CLI
317 ant beta:organization:external-keys validate --external-key-id "ekey_<id>"
318 ```
319
320 ```python Python
321 client = anthropic.Anthropic()
322
323 validation = client.beta.organization.external_keys.validate("ekey_<id>")
324
325 print(f"status: {validation.status}")
326 print(f"error: {validation.error}")
327 ```
328
329 ```typescript TypeScript
330 const client = new Anthropic();
331
332 const validation = await client.beta.organization.externalKeys.validate("ekey_<id>");
333
334 console.log(`status: ${validation.status}`);
335 console.log(`error: ${validation.error}`);
336 ```
337
338 ```csharp C#
339 AnthropicClient client = new();
340
341 var validation = await client.Beta.Organization.ExternalKeys.Validate("ekey_<id>");
342
343 Console.WriteLine($"status: {validation.Status.Raw()}");
344 Console.WriteLine($"error: {validation.Error}");
345 ```
346
347 ```go Go
348 client := anthropic.NewClient()
349
350 validation, err := client.Beta.Organization.ExternalKeys.Validate(context.Background(), "ekey_<id>")
351 if err != nil {
352 log.Fatal(err)
353 }
354
355 fmt.Printf("status: %s\n", validation.Status)
356 fmt.Printf("error: %s\n", validation.Error)
357 ```
358
359 ```java Java
360 AnthropicClient client = AnthropicOkHttpClient.fromEnv();
361
362 var validation = client.beta().organization().externalKeys().validate("ekey_<id>");
363
364 IO.println("status: " + validation.status().asString());
365 IO.println("error: " + validation.error().orElse(""));
366 ```
367
368 ```php PHP
369 $client = new Client();
370
371 $validation = $client->beta->organization->externalKeys->validate(
372 externalKeyID: 'ekey_<id>',
373 );
374
375 echo "status: {$validation->status}\n";
376 echo "error: {$validation->error}\n";
377 ```
378
379 ```ruby Ruby
380 client = Anthropic::Client.new
381
382 external_key_id = "ekey_<id>"
383 validation = client.beta.organization.external_keys.validate(external_key_id)
384
385 puts "status: #{validation.status}"
386 puts "error: #{validation.error}"
387 ```
388 </CodeGroup>
389
390 A successful response looks like this:
391
392 ```json
393 { "type": "external_key_validation", "status": "success", "error": null }
394 ```
395
396 If validation fails, common causes are:
397
398 * **Encryption context mismatch:** Validation fails while data traffic works (or the reverse) with an opaque `AccessDeniedException` when a `kms:EncryptionContext:anthropic:compartment_uuid` condition allows only one of the two values Anthropic sends. Validation sends the all-zeros UUID (`00000000-0000-0000-0000-000000000000`); live traffic sends the attached workspace's compartment ID. Confirm the condition lists both. To rule the condition out entirely, temporarily remove the `Condition` block from the `AllowAnthropicCMEKCrypto` statement and re-validate.
399 * **Resource control policies (RCPs):** If your AWS organization has an RCP that denies KMS operations when `aws:PrincipalOrgID` does not match your org, it blocks Anthropic's cross-account role. The RCP needs a carve-out for this key or for Anthropic's role ARN. Service control policies do not apply here, because they do not evaluate for external principals calling through resource-based policies.
400 * **Access granted through IAM instead of the key policy:** Cross-account KMS access must be granted in the key policy itself, not through an IAM policy in your account. Check with `aws kms get-key-policy --key-id <id> --policy-name default`.
401 * **Region mismatch:** Confirm the key's region is one Anthropic operates in for the geo tier you configured.
402 </Step>
403
404 <Step title="Attach the key to a workspace">
405 Once the key is validated, attach it to a new workspace before you send any requests to that workspace. For a workspace that already receives requests, the key can take [up to a day to take effect](https://platform.claude.com/docs/en/manage-claude/cmek#how-it-works).
406
407 <CodeGroup>
408 ```bash cURL
409 curl -sS -X POST "https://api.anthropic.com/v1/organizations/workspaces/<workspace-id>" \
410 -H "x-api-key: $ANTHROPIC_API_KEY" \
411 -H "anthropic-version: 2023-06-01" \
412 -H "content-type: application/json" \
413 -d '{
414 "external_key_id": "ekey_<id>"
415 }'
416 ```
417
418 ```bash CLI
419 ant beta:organization:workspaces update \
420 --workspace-id "<workspace-id>" \
421 --external-key-id "ekey_<id>"
422 ```
423
424 ```python Python
425 client = anthropic.Anthropic()
426
427 workspace = client.beta.organization.workspaces.update(
428 "<workspace-id>", external_key_id="ekey_<id>"
429 )
430
431 print(f"id: {workspace.id}")
432 print(f"external_key_id: {workspace.external_key_id}")
433 ```
434
435 ```typescript TypeScript
436 const client = new Anthropic();
437
438 const workspace = await client.beta.organization.workspaces.update("<workspace-id>", {
439 external_key_id: "ekey_<id>"
440 });
441
442 console.log(`id: ${workspace.id}`);
443 console.log(`external_key_id: ${workspace.external_key_id}`);
444 ```
445
446 ```csharp C#
447 AnthropicClient client = new();
448
449 var workspace = await client.Beta.Organization.Workspaces.Update("<workspace-id>", new()
450 {
451 ExternalKeyID = "ekey_<id>"
452 });
453
454 Console.WriteLine($"id: {workspace.ID}");
455 Console.WriteLine($"external_key_id: {workspace.ExternalKeyID}");
456 ```
457
458 ```go Go
459 client := anthropic.NewClient()
460
461 workspace, err := client.Beta.Organization.Workspaces.Update(
462 context.Background(),
463 "<workspace-id>",
464 anthropic.BetaOrganizationWorkspaceUpdateParams{
465 ExternalKeyID: anthropic.String("ekey_<id>"),
466 },
467 )
468 if err != nil {
469 log.Fatal(err)
470 }
471
472 fmt.Printf("id: %s\n", workspace.ID)
473 fmt.Printf("external_key_id: %s\n", workspace.ExternalKeyID)
474 ```
475
476 ```java Java
477 import com.anthropic.models.beta.organization.workspaces.WorkspaceUpdateParams;
478
479 void main() {
480 AnthropicClient client = AnthropicOkHttpClient.fromEnv();
481
482 var params = WorkspaceUpdateParams.builder()
483 .externalKeyId("ekey_<id>")
484 .build();
485 var workspace = client.beta().organization().workspaces().update("<workspace-id>", params);
486
487 IO.println("id: " + workspace.id());
488 IO.println("external_key_id: " + workspace.externalKeyId().orElseThrow());
489 }
490 ```
491
492 ```php PHP
493 $client = new Client();
494
495 $workspace = $client->beta->organization->workspaces->update(
496 workspaceID: '<workspace-id>',
497 externalKeyID: 'ekey_<id>',
498 );
499
500 echo "id: {$workspace->id}\n";
501 echo "external_key_id: {$workspace->externalKeyID}\n";
502 ```
503
504 ```ruby Ruby
505 client = Anthropic::Client.new
506
507 workspace_id = "<workspace-id>"
508 workspace = client.beta.organization.workspaces.update(
509 workspace_id,
510 external_key_id: "ekey_<id>"
511 )
512
513 puts "id: #{workspace.id}"
514 puts "external_key_id: #{workspace.external_key_id}"
515 ```
516 </CodeGroup>
517 </Step>
518 </Steps>
491
492 fmt.Printf("id: %s\n", workspace.ID)
493 fmt.Printf("external_key_id: %s\n", workspace.ExternalKeyID)
494 ```
495
496 ```java Java
497 import com.anthropic.models.beta.organization.workspaces.WorkspaceUpdateParams;
498
499 void main() {
500 AnthropicClient client = AnthropicOkHttpClient.fromEnv();
501
502 var params = WorkspaceUpdateParams.builder()
503 .externalKeyId("ekey_<id>")
504 .build();
505 var workspace = client.beta().organization().workspaces().update("<workspace-id>", params);
506
507 IO.println("id: " + workspace.id());
508 IO.println("external_key_id: " + workspace.externalKeyId().orElseThrow());
509 }
510 ```
511
512 ```php PHP
513 $client = new Client();
514
515 $workspace = $client->beta->organization->workspaces->update(
516 workspaceID: '<workspace-id>',
517 externalKeyID: 'ekey_<id>',
518 );
519
520 echo "id: {$workspace->id}\n";
521 echo "external_key_id: {$workspace->externalKeyID}\n";
522 ```
523
524 ```ruby Ruby
525 client = Anthropic::Client.new
526
527 workspace_id = "<workspace-id>"
528 workspace = client.beta.organization.workspaces.update(
529 workspace_id,
530 external_key_id: "ekey_<id>"
531 )
532
533 puts "id: #{workspace.id}"
534 puts "external_key_id: #{workspace.external_key_id}"
535 ```
536 </CodeGroup>
537 </Step>
538 </Steps>
539 </Tab>
540 </Tabs>
519541 </Tab>
520542
521543 <Tab title="Claude Enterprise">
522544