Skip to content
API Reference

List policy sets in a zone

client.Zones.PolicySets.List(ctx, zoneID, params) (*ZonePolicySetListResponse, error)
GET/zones/{zone_id}/policy-sets

List policy sets in a zone

ParametersExpand Collapse
zoneID string
params ZonePolicySetListParams
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 ZonePolicySetListParamsExpandTotalCount ZonePolicySetListParamsExpand = "total_count"
Limit param.Field[int64]optional

Query param: Maximum number of items to return

maximum100
minimum1
Order param.Field[ZonePolicySetListParamsOrder]optional

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

const ZonePolicySetListParamsOrderAsc ZonePolicySetListParamsOrder = "asc"
const ZonePolicySetListParamsOrderDesc ZonePolicySetListParamsOrder = "desc"
Sort param.Field[ZonePolicySetListParamsSort]optional

Query param: Field to sort by.

const ZonePolicySetListParamsSortCreatedAt ZonePolicySetListParamsSort = "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 ZonePolicySetListResponse struct{…}
Active booloptional

Whether this policy set is currently bound to a scope

ActiveVersion int64optional

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

ActiveVersionID stringoptional

Public ID of the currently active (bound) version

Mode stringoptional
Accepts one of the following:
const PolicySetWithBindingModeActive PolicySetWithBindingMode = "active"
const PolicySetWithBindingModeShadow PolicySetWithBindingMode = "shadow"
ScopeTargetID stringoptional

List policy sets in a zone

package main

import (
  "context"
  "fmt"

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

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

  )
  policySets, err := client.Zones.PolicySets.List(
    context.TODO(),
    "zone_id",
    keycard.ZonePolicySetListParams{

    },
  )
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", policySets.Items)
}
{
  "items": [
    {
      "id": "id",
      "created_at": "2019-12-27T18:11:19.117Z",
      "created_by": "created_by",
      "name": "name",
      "owner_type": "platform",
      "scope_type": "zone",
      "updated_at": "2019-12-27T18:11:19.117Z",
      "zone_id": "zone_id",
      "archived_at": "2019-12-27T18:11:19.117Z",
      "latest_version": 0,
      "latest_version_id": "latest_version_id",
      "updated_by": "updated_by",
      "active": true,
      "active_version": 0,
      "active_version_id": "active_version_id",
      "mode": "active",
      "scope_target_id": "scope_target_id"
    }
  ],
  "pagination": {
    "after_cursor": "after_cursor",
    "before_cursor": "before_cursor",
    "total_count": 0
  }
}
Returns Examples
{
  "items": [
    {
      "id": "id",
      "created_at": "2019-12-27T18:11:19.117Z",
      "created_by": "created_by",
      "name": "name",
      "owner_type": "platform",
      "scope_type": "zone",
      "updated_at": "2019-12-27T18:11:19.117Z",
      "zone_id": "zone_id",
      "archived_at": "2019-12-27T18:11:19.117Z",
      "latest_version": 0,
      "latest_version_id": "latest_version_id",
      "updated_by": "updated_by",
      "active": true,
      "active_version": 0,
      "active_version_id": "active_version_id",
      "mode": "active",
      "scope_target_id": "scope_target_id"
    }
  ],
  "pagination": {
    "after_cursor": "after_cursor",
    "before_cursor": "before_cursor",
    "total_count": 0
  }
}