---
title: "Create or update a policy draft"
method: PUT
path: "/zones/{zone_id}/policies/{policy_id}/draft"
tags: ["PolicyDrafts"]
---

# Create or update a policy draft

`PUT /zones/{zone_id}/policies/{policy_id}/draft`

## Path parameters

- `zone_id` string, required
- `policy_id` string, required

## Query parameters

- `format` 'cedar' | 'json'
- `validate_cedar` boolean

## Headers

- `X-API-Version` string
- `X-Client-Request-ID` string, uuid

## Request body

- PdpUpsertPolicyDraftRequest
  - `cedar_json` object, nullable — Cedar policy in JSON representation. Mutually exclusive with cedar_raw.
  - `cedar_raw` string, nullable — Cedar policy in human-readable Cedar syntax. Mutually exclusive with cedar_json.
  - `schema_version` string, required

## Response `200`

The upserted policy draft

- PdpPolicyDraft
  - `policy_id` string, required
  - `cedar_json` object, nullable — Cedar policy in JSON representation. Populated by default and when `format=json` is passed; null when `format=cedar` narrows the response to the text representation only.
  - `cedar_raw` string, nullable — Cedar policy in human-readable syntax. Populated by default and when `format=cedar` is passed; null when `format=json` narrows the response to the JSON representation only.
  - `schema_version` string, required
  - `base_version_id` string, nullable — ID of the policy version this draft was hydrated from. Null when the draft was created without an existing version.
  - `created_at` string, date-time, required
  - `updated_at` string, date-time, required
  - `updated_by` string, required

## Other responses

- `400` — bad request error response when caller supplied invalid input data
- `401` — unauthorized error response when caller session is not authenticated
- `403` — forbidden error response when caller does not have permissions to a resource
- `404` — not found error response when caller does not have permission to see a resource or the resource does not exist
- `409` — Conflict - concurrency conflict
- `429` — rate limit exceeded error response when caller has exhausted api limits for the given time period
- `500` — internal server error response when server encountered error of its own creation
- `503` — service unavailable error when server you're attempting to reach is not available
- `default` — internal server error response when server encountered error of its own creation

---

[API](https://skmtc.net/keycardai/apis/untitled-api.md) · [All operations](https://skmtc.net/keycardai/apis/untitled-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/keycardai/untitled-api/versions/2f5033ed4491/schema)
