Claude Platform Docs

更新合规设置

client.Beta.Organization.ComplianceSettings.Update(ctx, body) (*BetaComplianceSettings, error)
POST/v1/organizations/compliance_settings

更新您组织的合规设置。

将 state 设置为 enabled 会开启 Compliance API 并开始捕获组织活动事件。将其设置为 disabled 会同时关闭两者。state 反映 Compliance API 是否已启用。

将 state 设置为其当前值的请求会成功,且资源保持不变。disabled 请求会一直有效,直到后续出现 enabled 请求,或组织下一次启用 Access Transparency 的配置操作:启用 Access Transparency 也会启用 Compliance API(由其提供活动事件),因此即使在 disabled 请求之后,此类配置操作(包括重新运行)也会重新启用 Compliance API。自动配置永远不会禁用合规设置。

Parameters
body BetaOrganizationComplianceSettingUpdateParams

Desired state. Accepts the string shorthand "enabled" or "disabled" in place of the object form; the response always returns the canonical object form.

Returns
type BetaComplianceSettings struct { Type: "compliance_settings"; State }
Type ComplianceSettings
defaultcompliance_settings

Whether the Compliance API is enabled for this organization.

One of the following:
type BetaComplianceSettingsStateEnabled struct { Type: "enabled" }
Type Enabled
defaultenabled
type BetaComplianceSettingsStateDisabled struct { Type: "disabled" }
Type Disabled
defaultdisabled
更新合规设置
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"),
	)
	betaComplianceSettings, err := client.Beta.Organization.ComplianceSettings.Update(context.TODO(), anthropic.BetaOrganizationComplianceSettingUpdateParams{
		State: anthropic.BetaComplianceSettingsStateParamUnion{
			OfEnabled: &anthropic.BetaComplianceSettingsStateEnabledParam{},
		},
	})
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", betaComplianceSettings.State)
}
Returns Examples
Response 200
{
  "state": {
    "type": "enabled"
  },
  "type": "compliance_settings"
}