Claude Platform Docs

更新合規設定

organization.compliance_settings.update(**kwargs) -> OrganizationComplianceSettings
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

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

One of the following:
class ComplianceSettingsStateEnabledParam { type: :enabled }
type: :enabled
class ComplianceSettingsStateDisabledParam { type: :disabled }
type: :disabled
Returns
class OrganizationComplianceSettings { type: :compliance_settings, state }
type: :compliance_settings

Whether the Compliance API is enabled for this organization.

One of the following:
class ComplianceSettingsStateEnabled { type: :enabled }
type: :enabled
class ComplianceSettingsStateDisabled { type: :disabled }
type: :disabled
Errors

Any method can also return the general HTTP errors.

SandboxEgressRestrictedErrorHTTP 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.

更新合規設定
require "anthropic"

anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key")

organization_compliance_settings = anthropic.organization.compliance_settings.update(state: {type: :enabled})

puts(organization_compliance_settings)
Returns Examples
Response 200
{
  "state": {
    "type": "enabled"
  },
  "type": "compliance_settings"
}