Skip to content
Docs
Versions

Archive a policy version

Archive a policy version

zones.policies.versions.archive(strversion_id, VersionArchiveParams**kwargs) -> PolicyVersion
DELETE/zones/{zone_id}/policies/{policy_id}/versions/{version_id}

Archive a policy version

ParametersExpand Collapse
zone_id: str
policy_id: str
version_id: str
x_api_version: Optional[str]
x_client_request_id: Optional[str]
formatuuid
ReturnsExpand Collapse
class PolicyVersion:
id: str
created_at: datetime
formatdate-time
created_by: str
owner_type: Literal["platform", "customer"]

Who manages this policy version:

  • "platform" — managed by the Keycard platform (system policy versions).
  • "customer" — managed by the tenant (custom policy versions).
Accepts one of the following:
"platform"
"customer"
policy_id: str
schema_version: str

Schema version this policy was validated against when created.

sha: str

Hex-encoded content hash

version: int
zone_id: str
archived_at: Optional[datetime]
formatdate-time
archived_by: Optional[str]
cedar_json: Optional[object]

Cedar policy in JSON representation. Populated by default and when format=json is passed; null when format=cedar narrows the response to the text representation only.

cedar_raw: Optional[str]

Cedar policy in human-readable syntax. Populated by default and when format=cedar is passed; null when format=json narrows the response to the JSON representation only.

Archive a policy version

from keycardai_api import KeycardAPI

client = KeycardAPI()
policy_version = client.zones.policies.versions.archive(
    version_id="version_id",
    zone_id="zone_id",
    policy_id="policy_id",
)
print(policy_version.id)
{
  "id": "id",
  "created_at": "2019-12-27T18:11:19.117Z",
  "created_by": "created_by",
  "owner_type": "platform",
  "policy_id": "policy_id",
  "schema_version": "schema_version",
  "sha": "sha",
  "version": 0,
  "zone_id": "zone_id",
  "archived_at": "2019-12-27T18:11:19.117Z",
  "archived_by": "archived_by",
  "cedar_json": {},
  "cedar_raw": "cedar_raw"
}
Returns Examples
{
  "id": "id",
  "created_at": "2019-12-27T18:11:19.117Z",
  "created_by": "created_by",
  "owner_type": "platform",
  "policy_id": "policy_id",
  "schema_version": "schema_version",
  "sha": "sha",
  "version": 0,
  "zone_id": "zone_id",
  "archived_at": "2019-12-27T18:11:19.117Z",
  "archived_by": "archived_by",
  "cedar_json": {},
  "cedar_raw": "cedar_raw"
}