Skip to content
API Reference

Create a new policy set

POST/zones/{zone_id}/policy-sets

Creates an unbound policy set. Use updatePolicySet to bind after creating a version.

Path ParametersExpand Collapse
zone_id: string
Header ParametersExpand Collapse
"X-API-Version": optional string
"X-Client-Request-ID": optional string
formatuuid
Body ParametersJSONExpand Collapse
name: string
scope_type: optional "zone" or "resource" or "user" or "session"

The scope at which this policy set applies:

  • "zone" — applies to all requests in the zone.
  • "resource" — scoped to a specific resource.
  • "user" — scoped to a specific user.
  • "session" — scoped to a specific session.
Accepts one of the following:
"zone"
"resource"
"user"
"session"
ReturnsExpand Collapse
PolicySetWithBinding = PolicySet { id, created_at, created_by, 9 more }
active: optional boolean

Whether this policy set is currently bound to a scope

active_version: optional number

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

active_version_id: optional string

Public ID of the currently active (bound) version

mode: optional "active" or "shadow"
Accepts one of the following:
"active"
"shadow"
scope_target_id: optional string

Create a new policy set

curl https://api.keycard.ai/zones/$ZONE_ID/policy-sets \
    -H 'Content-Type: application/json' \
    -d '{
          "name": "name"
        }'
{
  "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"
}
Returns Examples
{
  "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"
}