Claude Platform Docs

外部キーを作成

$client->organization->externalKeys->create(ProviderConfig providerConfig, ?string displayName, ?Geo geo, ?string userProfileID): ExternalKey
POST/v1/organizations/external_keys

呼び出し元の組織が所有する外部キー設定を作成します。

Parameters
providerConfig: ProviderConfig

KMS provider identity and auth coordinates.

displayName?: optional string

Human-friendly display name.

geo?: optional Geo

Data residency geo. Only us is supported.

userProfileID?: optional string

ID of a user profile to bind the key to. Omit this field for a key that isn't bound to a user profile. Such a key can be attached to a Workspace whatever its user profile. The binding cannot be changed later. A key bound to a user profile can only be attached to a Workspace that has the same user profile.

Returns
class ExternalKey { $type = 'external_key'; $id; $attachment; /* 6 more */ }
"external_key" type
string id

Identifier of the external key config: a tagged ID prefixed ekey_, or, on Claude Platform on AWS, an AWS KMS key's ARN.

Attachment attachment

Whether any workspace uses this config to encrypt its data — counting live and archived workspaces (an archived workspace's data remains encrypted under the config), excluding deleted ones. Only an attached config is used by the encryption path; an unattached config is inert and can be deleted.

\Datetime createdAt
?string displayName

Human-friendly display name. Null if none was set.

string geo

Data residency geo. Selects the region this key is used in.

ProviderConfig providerConfig

KMS provider identity and auth coordinates.

\Datetime updatedAt
?string userProfileID

ID of the user profile the key is bound to, or null if the key is not bound to one. A key bound to a user profile can only be attached to a Workspace that has the same user profile. A key that isn't bound can be attached to a Workspace whatever its user profile.

外部キーを作成
<?php

require_once dirname(__DIR__) . '/vendor/autoload.php';

use Anthropic\Client;

$client = new Client(apiKey: 'my-anthropic-api-key');

$externalKey = $client->organization->externalKeys->create(
  providerConfig: [
    'kmsARN' => 'arn:aws:kms:us-east-1:111122223333:key/abcd1234-5678-90ab-cdef-000011112222',
    'type' => 'aws',
    'region' => 'us-east-1',
  ],
  displayName: 'x',
  geo: 'us',
  userProfileID: 'uprof_01SDCCSbTxrXDpWc1phhtcfK',
);

var_dump($externalKey);
Returns Examples
Response 200
{
  "id": "ekey_01SDCCSbTxrXDpWc1phhtcfK",
  "attachment": {
    "type": "attached"
  },
  "created_at": "2024-10-30T23:58:27.427722Z",
  "display_name": "prod-us-key",
  "geo": "us",
  "provider_config": {
    "kms_arn": "arn:aws:kms:us-east-1:111122223333:key/abcd1234-5678-90ab-cdef-000011112222",
    "type": "aws",
    "region": "us-east-1",
    "role_arn": "arn:aws:iam::111122223333:role/anthropic-cmek"
  },
  "type": "external_key",
  "updated_at": "2024-10-30T23:58:27.427722Z",
  "user_profile_id": "uprof_01SDCCSbTxrXDpWc1phhtcfK"
}