Claude Platform Docs

Clés externes

Créer une clé externe
client.Organization.ExternalKeys.New(ctx, body) (*ExternalKey, error)
POST/v1/organizations/external_keys

Créez une configuration de clé externe appartenant à l'organisation de l'appelant.

Lister les clés externes
client.Organization.ExternalKeys.List(ctx, query) (*PageCursor[ExternalKey], error)
GET/v1/organizations/external_keys

Listez les configurations de clés externes de l'organisation de l'appelant.

Obtenir une clé externe
client.Organization.ExternalKeys.Get(ctx, externalKeyID) (*ExternalKey, error)
GET/v1/organizations/external_keys/{external_key_id}

Récupérez une configuration de clé externe unique de l'organisation de l'appelant par son ID.

Mettre à jour une clé externe
client.Organization.ExternalKeys.Update(ctx, externalKeyID, body) (*ExternalKey, error)
POST/v1/organizations/external_keys/{external_key_id}

Mettez à jour partiellement une configuration de clé externe. Les champs omis restent inchangés.

Supprimer une clé externe
client.Organization.ExternalKeys.Delete(ctx, externalKeyID) (*OrganizationExternalKeyDeleteResponse, error)
DELETE/v1/organizations/external_keys/{external_key_id}

Supprimez une configuration de clé externe.

Valider une clé externe
client.Organization.ExternalKeys.Validate(ctx, externalKeyID) (*OrganizationExternalKeyValidateResponse, error)
POST/v1/organizations/external_keys/{external_key_id}/validate

Validez une configuration de clé externe auprès du KMS du client.

Models
type AWSExternalKeyConfig struct { Type: "aws"; KMSARN; Region }
Type AWS
KMSARN 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 Optional

AWS region. Derived from kms_arn if omitted.

type AzureExternalKeyConfig struct { Type: "azure"; KeyName; TenantID; /* 2 more */ }
Type Azure
KeyName string

Name of the key within the vault.

TenantID string

Azure AD tenant ID.

VaultURI string

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

ClientID string Optional

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.

type AzureExternalKeyConfigParam struct { Type: "azure"; KeyName; TenantID; /* 2 more */ }

Azure Key Vault provider configuration.

Type Azure
KeyName string

Name of the key within the vault.

TenantID string

Azure AD tenant ID.

VaultURI string

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

ClientID string Optional

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.

type ExternalKey struct { 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).

type ExternalKeyAttachedAttachment struct { Type: "attached" }
Type Attached
defaultattached
type ExternalKeyChangedErrorDetails struct { ErrorCode }
ErrorCode ExternalKeyChangedErrorCode
type ExternalKeyInWorkspacePolicyErrorDetails struct { ErrorCode }
ErrorCode ExternalKeyInWorkspacePolicyErrorCode
type ExternalKeyUnattachedAttachment struct { Type: "unattached" }
Type Unattached
defaultunattached
type ExternalKeyValidationFailedErrorDetails struct { ErrorCode }
ErrorCode ExternalKeyValidationFailedErrorCode
type ExternalKeyValidationTimedOutErrorDetails struct { ErrorCode }
ErrorCode ExternalKeyValidationTimedOutErrorCode
type GCPExternalKeyConfig struct { Type: "gcp"; KeyName }
Type GCP
KeyName string

Full resource name of the Cloud KMS key.

Errors
const ErrorCodeExternalKeyInWorkspacePolicy ErrorCode = "external_key_in_workspace_policy"⁠HTTP status 400

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

const ErrorCodeExternalKeyValidationFailed ErrorCode = "external_key_validation_failed"⁠HTTP status 400

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

const ErrorCodeExternalKeyValidationTimedOut ErrorCode = "external_key_validation_timed_out"⁠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.

const ErrorCodeExternalKeyChanged ErrorCode = "external_key_changed"⁠HTTP status 409

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