Claude Platform Docs

列出外部密钥

client.Organization.ExternalKeys.List(ctx, query) (*PageCursor[ExternalKey], error)
GET/v1/organizations/external_keys

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

结果按创建时间排序(最新的在前)。请使用响应中的 next_page 游标获取后续页面。

Parameters
query OrganizationExternalKeyListParams
Limit param.Opt[int64] OptionalQuery parameter

Number of results per page.

minimum1
maximum100
Page param.Opt[string] OptionalQuery parameter

Opaque cursor from a previous response's next_page.

Returns
type ExternalKey struct { Type: "external_key"; ID; Attachment; /* 5 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).

列出外部密钥
package main

import (
	"context"
	"fmt"

	"github.com/anthropics/anthropic-sdk-go"
	"github.com/anthropics/anthropic-sdk-go/option"
)

func main() {
	client := anthropic.NewClient(
		option.WithAPIKey("my-anthropic-api-key"),
	)
	page, err := client.Organization.ExternalKeys.List(context.TODO(), anthropic.OrganizationExternalKeyListParams{})
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", page)
}
Returns Examples
Response 200
{
  "data": [
    {
      "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"
    }
  ],
  "next_page": "next_page"
}