Claude Platform Docs

更新合規設定

OrganizationComplianceSettings organization().complianceSettings().update(params, requestOptions = RequestOptions.none())
POST/v1/organizations/compliance_settings

更新您組織的合規設定。

將 state 設為 enabled 會開啟 Compliance API 並開始擷取組織活動事件。將其設為 disabled 則會同時關閉兩者。Access Transparency 事件是例外:即使 Compliance API 已停用,這些事件仍會被擷取,並在 Compliance API 重新啟用後由其活動摘要傳回。state 反映 Compliance API 是否已啟用。

將 state 設為其目前值的請求會成功,且資源保持不變。disabled 請求會持續生效,直到後續的 enabled 請求,或組織下一次啟用 Access Transparency 的佈建動作為止:啟用 Access Transparency 也會啟用提供其活動事件的 Compliance API,因此此類佈建(包括重新執行)即使在 disabled 請求之後也會重新啟用 Compliance API。自動化佈建絕不會停用合規設定。

Parameters
ComplianceSettingUpdateParams params

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

Returns
class OrganizationComplianceSettings { type = "compliance_settings"; state; }
JsonValue type = "compliance_settings"

Whether the Compliance API is enabled for this organization.

One of the following:
class ComplianceSettingsStateEnabled { type = "enabled"; }
JsonValue type = "enabled"
class ComplianceSettingsStateDisabled { type = "disabled"; }
JsonValue type = "disabled"
Errors

Any method can also return the general HTTP errors.

SandboxEgressRestrictedExceptionHTTP 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 com.anthropic.example;

import com.anthropic.client.AnthropicClient;
import com.anthropic.client.okhttp.AnthropicOkHttpClient;
import com.anthropic.models.organization.compliancesettings.ComplianceSettingUpdateParams;
import com.anthropic.models.organization.compliancesettings.ComplianceSettingsStateEnabledParam;
import com.anthropic.models.organization.compliancesettings.OrganizationComplianceSettings;

public final class Main {
    private Main() {}

    public static void main(String[] args) {
        AnthropicClient client = AnthropicOkHttpClient.fromEnv();

        ComplianceSettingUpdateParams params = ComplianceSettingUpdateParams.builder()
            .state(ComplianceSettingsStateEnabledParam.builder().build())
            .build();
        OrganizationComplianceSettings organizationComplianceSettings = client.organization().complianceSettings().update(params);
    }
}
Returns Examples
Response 200
{
  "state": {
    "type": "enabled"
  },
  "type": "compliance_settings"
}