Skip to content
API Reference
Versions

Get a specific policy version

Get a specific policy version

GET/zones/{zone_id}/policies/{policy_id}/versions/{version_id}

Get a specific policy version

Path ParametersExpand Collapse
zone_id: string
policy_id: string
version_id: string
Query ParametersExpand Collapse
format: optional "cedar" or "json"

Narrows which Cedar representation the response includes. When omitted, both cedar_json and cedar_raw are populated. Pass json to receive only cedar_json, or cedar to receive only cedar_raw. Callers that don't care about payload size can skip this parameter.

Accepts one of the following:
"cedar"
"json"
Header ParametersExpand Collapse
"X-API-Version": optional string
"X-Client-Request-ID": optional string
formatuuid
ReturnsExpand Collapse
PolicyVersion = object { id, created_at, created_by, 10 more }
id: string
created_at: string
formatdate-time
created_by: string
owner_type: "platform" or "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: 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: optional string
formatdate-time
archived_by: optional string
cedar_json: optional unknown

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 string

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.

Get a specific policy version

curl https://api.keycard.ai/zones/$ZONE_ID/policies/$POLICY_ID/versions/$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"
}