Claude Platform Docs

外部密钥

创建外部密钥
client.organization.externalKeys.create(body, options?): ExternalKey
POST/v1/organizations/external_keys

创建一个归调用方组织所有的外部密钥配置。

列出外部密钥
client.organization.externalKeys.list(query?, options?): PageCursor<ExternalKey>
GET/v1/organizations/external_keys

列出调用方组织中的外部密钥配置。

获取外部密钥
client.organization.externalKeys.retrieve(externalKeyID, options?): ExternalKey
GET/v1/organizations/external_keys/{external_key_id}

按 ID 检索调用方组织中的单个外部密钥配置。

更新外部密钥
client.organization.externalKeys.update(externalKeyID, body, options?): ExternalKey
POST/v1/organizations/external_keys/{external_key_id}

Partially update an external key config. Omitted fields are left unchanged.

删除外部密钥
client.organization.externalKeys.delete(externalKeyID, options?): ExternalKeyDeleteResponse
DELETE/v1/organizations/external_keys/{external_key_id}

删除外部密钥配置。

验证外部密钥
client.organization.externalKeys.validate(externalKeyID, options?): ExternalKeyValidateResponse
POST/v1/organizations/external_keys/{external_key_id}/validate

针对客户的 KMS 验证外部密钥配置。

Models
interface AWSExternalKeyConfig { type: "aws"; kms_arn; region }
type: "aws"
kms_arn: string

Full ARN of the AWS KMS key. On Claude Platform on AWS, alias ARNs are rejected, and your organization's own key must be a single-Region key.

maxLength2048
region?: string | null

AWS region. Derived from kms_arn if omitted.

interface AzureExternalKeyConfig { type: "azure"; key_name; tenant_id; /* 2 more */ }
type: "azure"
key_name: string

Name of the key within the vault.

tenant_id: string

Azure AD tenant ID.

vault_uri: string

Key Vault data-plane URI — https://{vault-name}.vault.azure.net or https://{hsm-name}.managedhsm.azure.net.

client_id?: string | null

Azure AD application (client) ID. Omit to use Anthropic's multitenant app. Provide only if using a single-tenant app registration in the customer's directory.

interface AzureExternalKeyConfigParam { type: "azure"; key_name; tenant_id; /* 2 more */ }

Azure Key Vault provider configuration.

type: "azure"
key_name: string

Name of the key within the vault.

tenant_id: string

Azure AD tenant ID.

vault_uri: string

Key Vault data-plane URI — https://{vault-name}.vault.azure.net or https://{hsm-name}.managedhsm.azure.net.

client_id?: string | null

Azure AD application (client) ID. Omit to use Anthropic's multitenant app. Provide only if using a single-tenant app registration in the customer's directory.

interface ExternalKey { type: "external_key"; id; attachment; /* 6 more */ }

CMEK external key config belonging to the caller's organization.

Configs are organization-scoped. Workspaces attach to a config; once any workspace references it, the provider fields become effectively immutable (existing encrypted data needs the config for decrypt).

interface ExternalKeyAttachedAttachment { type: "attached" }
type: "attached"
defaultattached
interface ExternalKeyChangedErrorDetails { error_code }
error_code: "external_key_changed"
interface ExternalKeyInWorkspacePolicyErrorDetails { error_code }
error_code: "external_key_in_workspace_policy"
interface ExternalKeyUnattachedAttachment { type: "unattached" }
type: "unattached"
defaultunattached
interface ExternalKeyValidationFailedErrorDetails { error_code }
error_code: "external_key_validation_failed"
interface ExternalKeyValidationTimedOutErrorDetails { error_code }
error_code: "external_key_validation_timed_out"
interface GCPExternalKeyConfig { type: "gcp"; key_name }
type: "gcp"
key_name: string

Full resource name of the Cloud KMS key.

interface ExternalKeyDeleteResponse { type: "external_key_deleted"; id }
type: "external_key_deleted"
defaultexternal_key_deleted
id: string

ID of the deleted External Key.

interface ExternalKeyValidateResponse { type: "external_key_validation"; error; status }

Result of a validation roundtrip against the customer's KMS.

HTTP 200 for both outcomes — the operation completed; status says whether the key works.

type: "external_key_validation"
defaultexternal_key_validation
error: string | null

Error message when status is failure. Null otherwise.

status: "failure" | "success"

success — encrypt/decrypt roundtrip succeeded. failure — the roundtrip failed or timed out; see error.

One of the following:
"failure"
"success"
Errors
class ExternalKeyInWorkspacePolicyError extends BadRequestError { errorCode; details }⁠HTTP status 400

The External Key can't be deleted or reconfigured while the organization's Workspace Policy lists it as an allowed key.

errorCode: "external_key_in_workspace_policy"
error_code: "external_key_in_workspace_policy"
class ExternalKeyValidationFailedError extends BadRequestError { errorCode; details }⁠HTTP status 400

The External Key failed Anthropic's validation, so the request was refused. The message gives the reason, if there is one.

errorCode: "external_key_validation_failed"
error_code: "external_key_validation_failed"
class ExternalKeyValidationTimedOutError extends BadRequestError { errorCode; details }⁠HTTP status 400

Anthropic's validation of the External Key did not finish in time, so the request was refused. Wait a moment, then send the request again.

errorCode: "external_key_validation_timed_out"
error_code: "external_key_validation_timed_out"
class ExternalKeyChangedError extends ConflictError { errorCode; details }⁠HTTP status 409

The external key changed while the request was validating it. Send the request again.

errorCode: "external_key_changed"
details: ExternalKeyChangedErrorDetails { error_code }
error_code: "external_key_changed"