Skip to content
API Reference

Policies

List policies in a zone
client.Zones.Policies.List(ctx, zoneID, params) (*ZonePolicyListResponse, error)
GET/zones/{zone_id}/policies
Create a new policy
client.Zones.Policies.New(ctx, zoneID, params) (*Policy, error)
POST/zones/{zone_id}/policies
Get a policy by ID
client.Zones.Policies.Get(ctx, policyID, params) (*Policy, error)
GET/zones/{zone_id}/policies/{policy_id}
Update a policy
client.Zones.Policies.Update(ctx, policyID, params) (*Policy, error)
PATCH/zones/{zone_id}/policies/{policy_id}
Archive a policy
client.Zones.Policies.Archive(ctx, policyID, params) (*Policy, error)
DELETE/zones/{zone_id}/policies/{policy_id}
ModelsExpand Collapse
type Policy struct{…}
ID string
CreatedAt Time
formatdate-time
CreatedBy string
Name string
OwnerType PolicyOwnerType

Who manages this policy:

  • "platform" — managed by the Keycard platform (system policies).
  • "customer" — managed by the tenant (custom policies).
Accepts one of the following:
const PolicyOwnerTypePlatform PolicyOwnerType = "platform"
const PolicyOwnerTypeCustomer PolicyOwnerType = "customer"
UpdatedAt Time
formatdate-time
ZoneID string
ArchivedAt Timeoptional
formatdate-time
Description stringoptional
LatestVersion int64optional

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

LatestVersionID stringoptional
UpdatedBy stringoptional
type PolicyDraft struct{…}
CreatedAt Time
formatdate-time
PolicyID string
SchemaVersion string
UpdatedAt Time
formatdate-time
UpdatedBy string
BaseVersionID stringoptional

ID of the policy version this draft was hydrated from. Null when the draft was created without an existing version.

CedarJson anyoptional

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

CedarRaw stringoptional

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

PoliciesVersions

List versions of a policy
client.Zones.Policies.Versions.List(ctx, policyID, params) (*ZonePolicyVersionListResponse, error)
GET/zones/{zone_id}/policies/{policy_id}/versions
Create a new immutable policy version
client.Zones.Policies.Versions.New(ctx, policyID, params) (*PolicyVersion, error)
POST/zones/{zone_id}/policies/{policy_id}/versions
Get a specific policy version
client.Zones.Policies.Versions.Get(ctx, versionID, params) (*PolicyVersion, error)
GET/zones/{zone_id}/policies/{policy_id}/versions/{version_id}
Archive a policy version
client.Zones.Policies.Versions.Archive(ctx, versionID, params) (*PolicyVersion, error)
DELETE/zones/{zone_id}/policies/{policy_id}/versions/{version_id}
ModelsExpand Collapse
type PolicyVersion struct{…}
ID string
CreatedAt Time
formatdate-time
CreatedBy string
OwnerType PolicyVersionOwnerType

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:
const PolicyVersionOwnerTypePlatform PolicyVersionOwnerType = "platform"
const PolicyVersionOwnerTypeCustomer PolicyVersionOwnerType = "customer"
PolicyID string
SchemaVersion string

Schema version this policy was validated against when created.

Sha string

Hex-encoded content hash

Version int64
ZoneID string
ArchivedAt Timeoptional
formatdate-time
ArchivedBy stringoptional
CedarJson anyoptional

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

CedarRaw stringoptional

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