Claude Platform Docs

コンプライアンス設定を更新

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

組織のコンプライアンス設定を更新します。

state を enabled に設定すると、Compliance API が有効になり、組織のアクティビティイベントの記録が開始されます。disabled に設定すると、両方が無効になります。ただし、Access Transparency イベントは例外です。これらは Compliance API が無効になっている間も記録され、Compliance API が再び有効になると Compliance API のアクティビティフィードで返されます。state は Compliance API が有効かどうかを示します。

state を現在の値に設定するリクエストは成功し、リソースは変更されません。disabled リクエストは、後続の enabled リクエスト、または Access Transparency を有効にする組織の次回のプロビジョニング操作が行われるまで有効です。Access Transparency を有効にすると、そのアクティビティイベントを提供する Compliance API も有効になるため、このようなプロビジョニング(再実行を含む)は、disabled リクエストの後であっても Compliance API を再度有効にします。自動プロビジョニングによってコンプライアンス設定が無効になることはありません。

Parameters
body OrganizationComplianceSettingUpdateParams

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 OrganizationComplianceSettings struct { Type: "compliance_settings"; State }
Type ComplianceSettings
defaultcompliance_settings

Whether the Compliance API is enabled for this organization.

One of the following:
type ComplianceSettingsStateEnabled struct { Type: "enabled" }
Type Enabled
defaultenabled
type ComplianceSettingsStateDisabled struct { Type: "disabled" }
Type Disabled
defaultdisabled
Errors

Any method can also return the general HTTP errors.

ErrorCodeSandboxEgressRestrictedHTTP status 403error code sandbox_egress_restricted

The request came from a Claude sandbox with restricted network access, which is not allowed to make this request. Send it from outside the sandbox, or from a sandbox with unrestricted network access.

コンプライアンス設定を更新
package main

import (
	"context"
	"fmt"

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

func main() {
	client := anthropic.NewClient(
		option.WithAPIKey("my-anthropic-api-key"),
	)
	organizationComplianceSettings, err := client.Organization.ComplianceSettings.Update(context.TODO(), anthropic.OrganizationComplianceSettingUpdateParams{
		State: anthropic.ComplianceSettingsStateParamUnion{
			OfEnabled: &anthropic.ComplianceSettingsStateEnabledParam{},
		},
	})
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", organizationComplianceSettings.State)
}
Returns Examples
Response 200
{
  "state": {
    "type": "enabled"
  },
  "type": "compliance_settings"
}