Skip to content
API Reference

List policies in a zone

GET/zones/{zone_id}/policies

List policies in a zone

Path ParametersExpand Collapse
zone_id: string
Query ParametersExpand Collapse
after: optional string

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

minLength1
maxLength255
before: optional string

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

minLength1
maxLength255
expand: optional array of "total_count"

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

"filter[owner_type]": optional array of string

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.

limit: optional number

Maximum number of items to return per page.

minimum1
maximum100
order: optional "asc" or "desc"

Sort direction. Default is desc (newest first).

Accepts one of the following:
"asc"
"desc"
query: optional array of string

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.

"query[description]": optional array of string

Case-insensitive substring search on description (policies only). Repeatable; if multiple terms are supplied they are OR-ed.

"query[name]": optional array of string

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

sort: optional "created_at"

Field to sort by.

Header ParametersExpand Collapse
"X-API-Version": optional string
"X-Client-Request-ID": optional string
formatuuid
ReturnsExpand Collapse
items: array of Policy { id, created_at, created_by, 9 more }
id: string
created_at: string
formatdate-time
created_by: string
name: string
owner_type: "platform" or "customer"

Who manages this policy:

  • "platform" — managed by the Keycard platform (system policies).
  • "customer" — managed by the tenant (custom policies).
Accepts one of the following:
"platform"
"customer"
updated_at: string
formatdate-time
zone_id: string
archived_at: optional string
formatdate-time
description: optional string
latest_version: optional number

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

latest_version_id: optional string
updated_by: optional string

List policies in a zone

curl https://api.keycard.ai/zones/$ZONE_ID/policies
{
  "items": [
    {
      "id": "id",
      "created_at": "2019-12-27T18:11:19.117Z",
      "created_by": "created_by",
      "name": "name",
      "owner_type": "platform",
      "updated_at": "2019-12-27T18:11:19.117Z",
      "zone_id": "zone_id",
      "archived_at": "2019-12-27T18:11:19.117Z",
      "description": "description",
      "latest_version": 0,
      "latest_version_id": "latest_version_id",
      "updated_by": "updated_by"
    }
  ],
  "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",
      "updated_at": "2019-12-27T18:11:19.117Z",
      "zone_id": "zone_id",
      "archived_at": "2019-12-27T18:11:19.117Z",
      "description": "description",
      "latest_version": 0,
      "latest_version_id": "latest_version_id",
      "updated_by": "updated_by"
    }
  ],
  "pagination": {
    "after_cursor": "x",
    "before_cursor": "x",
    "total_count": 0
  }
}