Skip to content
Docs
Policy Schemas

List policy schemas

List policy schemas

client.zones.policySchemas.list(stringzoneID, PolicySchemaListParams { after, before, expand, 8 more } params?, RequestOptionsoptions?): PolicySchemaListResponse { items, pagination }
GET/zones/{zone_id}/policy-schemas

List policy schemas

ParametersExpand Collapse
zoneID: string
params: PolicySchemaListParams { after, before, expand, 8 more }
after?: string

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

minLength1
maxLength255
before?: string

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

minLength1
maxLength255
expand?: Array<"total_count">

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

filterDefault?: boolean

Query param: Filter schemas by default status. When true, returns only the zone's default schema. When false, returns only non-default schemas. Omit to return all schemas.

format?: "cedar" | "json"

Query param: Schema representation format. cedar returns human-readable Cedar syntax in cedar_schema, json returns Cedar JSON schema object in cedar_schema_json.

Accepts one of the following:
"cedar"
"json"
is_default?: boolean

Query param: Deprecated. Use filter[default] instead.

Filter schemas by default status. When true, returns only the zone's default schema. When false, returns only non-default schemas. Omit to return all schemas.

Still honored for backward compatibility. Supplying both is_default and filter[default] with conflicting values returns 400 Bad Request.

limit?: number

Query param: Maximum number of items to return per page.

minimum1
maximum100
order?: "asc" | "desc"

Query param: Sort direction. Default is desc (newest first).

Accepts one of the following:
"asc"
"desc"
sort?: "created_at"

Query param: Field to sort by.

xAPIVersion?: string

Header param: API version header (date-based, e.g. 2026-02-01)

xClientRequestID?: string

Header param: Unique request identifier specified by the originating caller and passed along by proxies.

formatuuid
ReturnsExpand Collapse
PolicySchemaListResponse { items, pagination }
items: Array<SchemaVersionWithZoneInfo { is_default } >
is_default: boolean

Whether this is the zone's default schema. Clients use this to pre-select which schema to write policies against. Has no effect on evaluation.

List policy schemas

import KeycardAPI from '@keycardai/api';

const client = new KeycardAPI();

const policySchemas = await client.zones.policySchemas.list('zone_id');

console.log(policySchemas.items);
{
  "items": [
    {
      "created_at": "2019-12-27T18:11:19.117Z",
      "status": "active",
      "updated_at": "2019-12-27T18:11:19.117Z",
      "version": "version",
      "archived_at": "2019-12-27T18:11:19.117Z",
      "cedar_schema": "cedar_schema",
      "cedar_schema_json": {},
      "deprecated_at": "2019-12-27T18:11:19.117Z",
      "is_default": true
    }
  ],
  "pagination": {
    "after_cursor": "x",
    "before_cursor": "x",
    "total_count": 0
  }
}
Returns Examples
{
  "items": [
    {
      "created_at": "2019-12-27T18:11:19.117Z",
      "status": "active",
      "updated_at": "2019-12-27T18:11:19.117Z",
      "version": "version",
      "archived_at": "2019-12-27T18:11:19.117Z",
      "cedar_schema": "cedar_schema",
      "cedar_schema_json": {},
      "deprecated_at": "2019-12-27T18:11:19.117Z",
      "is_default": true
    }
  ],
  "pagination": {
    "after_cursor": "x",
    "before_cursor": "x",
    "total_count": 0
  }
}