Claude Platform Docs

验证外部密钥

organization.external_keys.validate(external_key_id) -> ExternalKeyValidateResponse
POST/v1/organizations/external_keys/{external_key_id}/validate

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

Anthropic 会使用所配置的 KMS 密钥执行一次加密/解密往返操作,并最多等待 30 秒获取结果。如果往返操作成功,响应状态为 success;如果失败或超时,则为 failure 并附带错误消息。

Parameters
external_key_id: str⁠Path parameter

ID of the External Key.

maxLength2048
Returns
class 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: Literal["external_key_validation"]
defaultexternal_key_validation
error: Optional[str]

Error message when status is failure. Null otherwise.

status: Literal["failure", "success"]

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

One of the following:
"failure"
"success"
验证外部密钥
import os
from anthropic import Anthropic

client = Anthropic(
    api_key=os.environ.get(
        "ANTHROPIC_API_KEY"
    ),  # This is the default and can be omitted
)
response = client.organization.external_keys.validate(
    "external_key_id",
)
print(response.error)
Returns Examples
Response 200
{
  "error": "error",
  "status": "failure",
  "type": "external_key_validation"
}