Skip to content
API Reference

List policy schemas

client.Zones.PolicySchemas.List(ctx, zoneID, params) (*ZonePolicySchemaListResponse, error)
GET/zones/{zone_id}/policy-schemas

List policy schemas

ParametersExpand Collapse
zoneID string
params ZonePolicySchemaListParams
After param.Field[string]optional

Query param: Return items after this cursor (forward pagination). Use after_cursor from a previous response. Mutually exclusive with before.

Before param.Field[string]optional

Query param: Return items before this cursor (backward pagination). Use before_cursor from a previous response. Mutually exclusive with after.

Expand param.Field[[]string]optional

Query param: Opt-in to additional response fields

const ZonePolicySchemaListParamsExpandTotalCount ZonePolicySchemaListParamsExpand = "total_count"
Format param.Field[ZonePolicySchemaListParamsFormat]optional

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

const ZonePolicySchemaListParamsFormatCedar ZonePolicySchemaListParamsFormat = "cedar"
const ZonePolicySchemaListParamsFormatJson ZonePolicySchemaListParamsFormat = "json"
IsDefault param.Field[bool]optional

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.

Limit param.Field[int64]optional

Query param: Maximum number of items to return

maximum100
minimum1
Order param.Field[ZonePolicySchemaListParamsOrder]optional

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

const ZonePolicySchemaListParamsOrderAsc ZonePolicySchemaListParamsOrder = "asc"
const ZonePolicySchemaListParamsOrderDesc ZonePolicySchemaListParamsOrder = "desc"
Sort param.Field[ZonePolicySchemaListParamsSort]optional

Query param: Field to sort by.

const ZonePolicySchemaListParamsSortCreatedAt ZonePolicySchemaListParamsSort = "created_at"
XAPIVersion param.Field[string]optional

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

XClientRequestID param.Field[string]optional

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

formatuuid
ReturnsExpand Collapse
type ZonePolicySchemaListResponse struct{…}
IsDefault bool

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

package main

import (
  "context"
  "fmt"

  "github.com/keycardai/keycard-go"
)

func main() {
  client := keycard.NewClient(

  )
  policySchemas, err := client.Zones.PolicySchemas.List(
    context.TODO(),
    "zone_id",
    keycard.ZonePolicySchemaListParams{

    },
  )
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", 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": "after_cursor",
    "before_cursor": "before_cursor",
    "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": "after_cursor",
    "before_cursor": "before_cursor",
    "total_count": 0
  }
}