Skip to content
Docs
Versions

List versions of a policy set

List versions of a policy set

zones.policy_sets.versions.list(strpolicy_set_id, VersionListParams**kwargs) -> VersionListResponse
GET/zones/{zone_id}/policy-sets/{policy_set_id}/versions

List versions of a policy set

ParametersExpand Collapse
zone_id: str
policy_set_id: str
after: Optional[str]

Cursor for forward pagination. Returned in Pagination.after_cursor. Mutually exclusive with before.

minLength1
maxLength255
before: Optional[str]

Cursor for backward pagination. Returned in Pagination.before_cursor. Mutually exclusive with after.

minLength1
maxLength255
expand: Optional[List[Literal["total_count"]]]

Opt-in to additional response fields. Repeatable; matches the expand[] convention used across the Keycard API.

limit: Optional[int]

Maximum number of items to return per page.

minimum1
maximum100
order: Optional[Literal["asc", "desc"]]

Sort direction. Default is desc (newest first).

Accepts one of the following:
"asc"
"desc"
sort: Optional[Literal["created_at"]]

Field to sort by.

x_api_version: Optional[str]
x_client_request_id: Optional[str]
formatuuid
ReturnsExpand Collapse
class VersionListResponse:
items: List[PolicySetVersion]
id: str
created_at: datetime
formatdate-time
created_by: str
entries: List[PolicySetManifestEntry]
policy_id: str
policy_version_id: str
sha: Optional[str]

SHA-256 of the policy version content, populated by the server

manifest_sha: str

Hex-encoded SHA-256 of the canonicalized manifest

owner_type: Literal["platform", "customer"]

Who manages this policy set version:

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

Schema version pinned to this policy set version. Determines the Cedar schema used for evaluation when activated.

version: int
active: Optional[bool]

Whether this policy set version is currently bound with mode='active'

archived_at: Optional[datetime]
formatdate-time
archived_by: Optional[str]
attestation: Optional[AttestationStatement]

Decoded content of an Attestation JWS payload. Describes the exact policy set version composition at attestation time. This schema defines what consumers see after base64url-decoding the Attestation.payload field.

attested_at: datetime
formatdate-time
attested_by: str
key_id: str

Key ID of the signing key used to produce the attestation signature. Matches the "kid" in the JWS protected header.

manifest_sha: str

SHA-256 of the policy set version manifest. Verifiers MUST check this matches the policy_set_version.manifest_sha to detect attestation/version mismatches.

policy_set_id: str
policy_set_version: int
status: Literal["created", "re_signed"]

Event that produced this attestation. "created" is the initial attestation at version creation; "re_signed" is a re-attestation after key rotation (same content, new signature).

Accepts one of the following:
"created"
"re_signed"
type: Literal["policy_set_attestation"]

Statement type discriminator

v: Literal[1]

Statement schema version

zone_id: str

List versions of a policy set

from keycardai_api import KeycardAPI

client = KeycardAPI()
versions = client.zones.policy_sets.versions.list(
    policy_set_id="policy_set_id",
    zone_id="zone_id",
)
print(versions.items)
{
  "items": [
    {
      "id": "id",
      "created_at": "2019-12-27T18:11:19.117Z",
      "created_by": "created_by",
      "manifest": {
        "entries": [
          {
            "policy_id": "policy_id",
            "policy_version_id": "policy_version_id",
            "sha": "sha"
          }
        ]
      },
      "manifest_sha": "manifest_sha",
      "owner_type": "platform",
      "policy_set_id": "policy_set_id",
      "schema_version": "schema_version",
      "version": 0,
      "active": true,
      "archived_at": "2019-12-27T18:11:19.117Z",
      "archived_by": "archived_by",
      "attestation": {
        "attested_at": "2019-12-27T18:11:19.117Z",
        "attested_by": "attested_by",
        "key_id": "key_id",
        "manifest_sha": "manifest_sha",
        "policy_set_id": "policy_set_id",
        "policy_set_version": 0,
        "status": "created",
        "type": "policy_set_attestation",
        "v": 1,
        "zone_id": "zone_id"
      }
    }
  ],
  "pagination": {
    "after_cursor": "x",
    "before_cursor": "x",
    "total_count": 0
  }
}
Returns Examples
{
  "items": [
    {
      "id": "id",
      "created_at": "2019-12-27T18:11:19.117Z",
      "created_by": "created_by",
      "manifest": {
        "entries": [
          {
            "policy_id": "policy_id",
            "policy_version_id": "policy_version_id",
            "sha": "sha"
          }
        ]
      },
      "manifest_sha": "manifest_sha",
      "owner_type": "platform",
      "policy_set_id": "policy_set_id",
      "schema_version": "schema_version",
      "version": 0,
      "active": true,
      "archived_at": "2019-12-27T18:11:19.117Z",
      "archived_by": "archived_by",
      "attestation": {
        "attested_at": "2019-12-27T18:11:19.117Z",
        "attested_by": "attested_by",
        "key_id": "key_id",
        "manifest_sha": "manifest_sha",
        "policy_set_id": "policy_set_id",
        "policy_set_version": 0,
        "status": "created",
        "type": "policy_set_attestation",
        "v": 1,
        "zone_id": "zone_id"
      }
    }
  ],
  "pagination": {
    "after_cursor": "x",
    "before_cursor": "x",
    "total_count": 0
  }
}