Skip to content
API Reference

Update a policy

client.Zones.Policies.Update(ctx, policyID, params) (*Policy, error)
PATCH/zones/{zone_id}/policies/{policy_id}

Update a policy

ParametersExpand Collapse
policyID string
params ZonePolicyUpdateParams
ZoneID param.Field[string]

Path param: The zone identifier

Description param.Field[string]optional

Body param

Name param.Field[string]optional

Body param

IfMatch param.Field[string]optional

Header param: ETag value from a previous GET/POST/PATCH response. When provided, the update only succeeds if the resource has not been modified; otherwise 412 Precondition Failed is returned.

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 Policy struct{…}
ID string
CreatedAt Time
formatdate-time
CreatedBy string
Name string
OwnerType PolicyOwnerType

Who manages this policy:

  • "platform" — managed by the Keycard platform (system policies).
  • "customer" — managed by the tenant (custom policies).
Accepts one of the following:
const PolicyOwnerTypePlatform PolicyOwnerType = "platform"
const PolicyOwnerTypeCustomer PolicyOwnerType = "customer"
UpdatedAt Time
formatdate-time
ZoneID string
ArchivedAt Timeoptional
formatdate-time
Description stringoptional
LatestVersion int64optional

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

LatestVersionID stringoptional
UpdatedBy stringoptional

Update a policy

package main

import (
  "context"
  "fmt"

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

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

  )
  policy, err := client.Zones.Policies.Update(
    context.TODO(),
    "policy_id",
    keycard.ZonePolicyUpdateParams{
      ZoneID: "zone_id",
    },
  )
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", policy.ID)
}
{
  "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"
}
Returns Examples
{
  "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"
}