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"
}