Skip to content
Docs
Policy Sets

List policy sets in a zone

List policy sets in a zone

client.zones.policySets.list(stringzoneID, PolicySetListParams { active, after, before, 11 more } params?, RequestOptionsoptions?): PolicySetListResponse { items, pagination }
GET/zones/{zone_id}/policy-sets

List policy sets in a zone

ParametersExpand Collapse
zoneID: string
params: PolicySetListParams { active, after, before, 11 more }
active?: boolean

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

Filter by active binding status. When true, returns only policy sets with an active binding. When false, returns only policy sets without one. Omit to return all.

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

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.

filterActive?: boolean

Query param: Filter by active binding status. When true, returns only policy sets with an active binding. When false, returns only policy sets without one. Omit to return all.

filterOwnerType?: Array<string>

Query param: Filter on owner_type. Repeatable; repeated instances OR across values (e.g. ?filter[owner_type]=platform&filter[owner_type]=customer matches either). See FilterValues in the shared spec for the full wire convention.

Allowed values: platform, customer. Unknown values return 400 with the list of allowed values. Comma-separated single values (e.g. ?filter[owner_type]=platform,customer) are rejected with a 400 pointing at the repeated-parameter OR form.

Note: the allowed-value enum is enforced in the handler (not as an OpenAPI items.enum) so the server can return a targeted error for the comma-AND form instead of a generic "not in allowed values" response.

filterScopeType?: Array<string>

Query param: Filter on scope_type (policy sets only). Repeatable; repeated instances OR across values. See FilterValues in the shared spec for the full wire convention.

Allowed values: zone, resource, user, session. Unknown values return 400 with the list of allowed values. Comma-separated single values are rejected with a 400 pointing at the repeated-parameter OR form.

Note: the allowed-value enum is enforced in the handler (not as an OpenAPI items.enum) so the server can return a targeted error for the comma-AND form instead of a generic "not in allowed values" response.

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"
query?: Array<string>

Query param: Case-insensitive substring search across all searchable fields of the resource. For policies that is name and description; for policy sets that is name. Repeatable; if multiple terms are supplied they are OR-ed.

queryName?: Array<string>

Query param: Case-insensitive substring search on name. Repeatable; if multiple terms are supplied they are OR-ed (any matching term returns the row).

sort?: "created_at" | "status"

Query param: Field to sort by. created_at (default) sorts by creation date. status sorts active-first, then by creation date within each group. When sort=status, only descending order and forward pagination are supported; order=asc or before cursors return 400.

Accepts one of the following:
"created_at"
"status"
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
PolicySetListResponse { items, pagination }
items: Array<PolicySetWithBinding { active, active_version, active_version_id, 4 more } >
active?: boolean

Whether this policy set is currently bound to a scope

active_version?: number | null

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

active_version_id?: string | null

Public ID of the currently active (bound) version

mode?: "active" | "shadow" | null
Accepts one of the following:
"active"
"shadow"
scope_target_id?: string | null
shadow_version?: number | null

Human-readable version number of the shadow version

shadow_version_id?: string | null

Public ID of the shadow (observed) version, if any

List policy sets in a zone

import KeycardAPI from '@keycardai/api';

const client = new KeycardAPI();

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

console.log(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",
      "shadow_version": 0,
      "shadow_version_id": "shadow_version_id"
    }
  ],
  "pagination": {
    "after_cursor": "x",
    "before_cursor": "x",
    "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",
      "shadow_version": 0,
      "shadow_version_id": "shadow_version_id"
    }
  ],
  "pagination": {
    "after_cursor": "x",
    "before_cursor": "x",
    "total_count": 0
  }
}