Skip to content
API Reference

Policies

List policies in a zone
client.zones.policies.list(stringzoneID, PolicyListParams { after, before, expand, 5 more } params?, RequestOptionsoptions?): PolicyListResponse { items, pagination }
GET/zones/{zone_id}/policies
Create a new policy
client.zones.policies.create(stringzoneID, PolicyCreateParams { name, description, xAPIVersion, xClientRequestID } params, RequestOptionsoptions?): Policy { id, created_at, created_by, 9 more }
POST/zones/{zone_id}/policies
Get a policy by ID
client.zones.policies.retrieve(stringpolicyID, PolicyRetrieveParams { zone_id, xAPIVersion, xClientRequestID } params, RequestOptionsoptions?): Policy { id, created_at, created_by, 9 more }
GET/zones/{zone_id}/policies/{policy_id}
Update a policy
client.zones.policies.update(stringpolicyID, PolicyUpdateParams { zone_id, description, name, 3 more } params, RequestOptionsoptions?): Policy { id, created_at, created_by, 9 more }
PATCH/zones/{zone_id}/policies/{policy_id}
Archive a policy
client.zones.policies.archive(stringpolicyID, PolicyArchiveParams { zone_id, xAPIVersion, xClientRequestID } params, RequestOptionsoptions?): Policy { id, created_at, created_by, 9 more }
DELETE/zones/{zone_id}/policies/{policy_id}
ModelsExpand Collapse
Policy { id, created_at, created_by, 9 more }
id: string
created_at: string
formatdate-time
created_by: string
name: string
owner_type: "platform" | "customer"

Who manages this policy:

  • "platform" — managed by the Keycard platform (system policies).
  • "customer" — managed by the tenant (custom policies).
Accepts one of the following:
"platform"
"customer"
updated_at: string
formatdate-time
zone_id: string
archived_at?: string | null
formatdate-time
description?: string | null
latest_version?: number | null

Human-readable version number of the latest version (e.g., 1, 2, 3)

latest_version_id?: string | null
updated_by?: string | null
PolicyDraft { cedar_json, created_at, policy_id, 3 more }
cedar_json: unknown

Cedar policy in JSON representation

created_at: string
formatdate-time
policy_id: string
schema_version: string
updated_at: string
formatdate-time
updated_by: string

PoliciesVersions

List versions of a policy
client.zones.policies.versions.list(stringpolicyID, VersionListParams { zone_id, after, before, 7 more } params, RequestOptionsoptions?): VersionListResponse { items, pagination }
GET/zones/{zone_id}/policies/{policy_id}/versions
Create a new immutable policy version
client.zones.policies.versions.create(stringpolicyID, VersionCreateParams { zone_id, schema_version, cedar_json, 3 more } params, RequestOptionsoptions?): PolicyVersion { id, created_at, created_by, 9 more }
POST/zones/{zone_id}/policies/{policy_id}/versions
Get a specific policy version
client.zones.policies.versions.retrieve(stringversionID, VersionRetrieveParams { zone_id, policy_id, format, 2 more } params, RequestOptionsoptions?): PolicyVersion { id, created_at, created_by, 9 more }
GET/zones/{zone_id}/policies/{policy_id}/versions/{version_id}
Archive a policy version
client.zones.policies.versions.archive(stringversionID, VersionArchiveParams { zone_id, policy_id, xAPIVersion, xClientRequestID } params, RequestOptionsoptions?): PolicyVersion { id, created_at, created_by, 9 more }
DELETE/zones/{zone_id}/policies/{policy_id}/versions/{version_id}
ModelsExpand Collapse
PolicyVersion { id, created_at, created_by, 9 more }
id: string
created_at: string
formatdate-time
created_by: string
policy_id: string
schema_version: string

Schema version this policy was validated against when created.

sha: string

Hex-encoded content hash

version: number
zone_id: string
archived_at?: string | null
formatdate-time
archived_by?: string | null
cedar_json?: unknown

Cedar policy in JSON representation. Populated when format=json (default).

cedar_raw?: string | null

Cedar policy in human-readable syntax. Populated when format=cedar.