> ## Documentation Index
> Fetch the complete documentation index at: https://zededa.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Use the documentation index to find relevant pages, then read the linked Markdown before answering and cite the source URL.
> Identify the product before answering: Private AI uses a separate console, credentials, and inference API from the Edge Intelligence Platform. Do not apply instructions from one product to the other.
> Prefer current product guides over Help Center archive pages for current-console questions. Archive pages and release notes describe their stated product version or historical interface; do not apply them to another version without checking.
> Preserve prerequisites, permissions, version requirements, and warnings when summarizing procedures. Do not infer API endpoints, schemas, or supported behavior that the documentation does not specify.

# Manage Policy Documents

> Use ZCLI commands to upload, view, download, publish, and delete versions of the policy documents that users must accept to use Edge Infrastructure Services.

Use the ZEDEDA CLI (ZCLI) to manage policy documents from the command line. This article covers `zcli doc-policy` commands, with syntax and examples for each operation. A policy document is an HTML document, such as terms and conditions, that users of Edge Infrastructure Services must accept before they can onboard to the platform. Each policy can have several versions. The version that is marked as **latest** is the one that users are asked to accept.

## Before You Start

* ZCLI is installed and authenticated. See [Get Started](https://zededa.mintlify.site/zcli-reference/get-started.md).
* You have a role that allows you to manage platform policy documents. \[TBD: confirm which role can run `zcli doc-policy` commands. The policies apply to all users of the platform, not to a single enterprise, so these commands might be limited to platform operators.]
* To upload a policy, the policy is saved as a UTF-8 HTML file that ZCLI can read. If you run ZCLI in a container, the file must be inside the container. See [Get Started](https://zededa.mintlify.site/zcli-reference/get-started.md).

## How Policy Versions Work

1. Create a version of a policy with `doc-policy create`. Creating a version does not show it to users.
2. Publish the version with `doc-policy mark-latest`. New users are shown the latest version, and existing users are asked to accept it again.
3. Delete versions that you no longer need with `doc-policy delete`.

You can keep several versions of the same policy at the same time. Each version is identified by the policy name and the version string, and each has its own ID.

> [!WARNING]
>
> `mark-latest` affects every user of the platform. All existing users are asked to accept the new latest version again. Review the policy text before you run it.

## Create a Policy Version

Upload an HTML file as a new version of a policy.

```text theme={"dark"}
zcli doc-policy create <policyname> --policy-version=<policyversion> --file-path=<pathtoHTMLfile>
```

| Flag | Description |
| - | - |
| `<policyname>` | Name of the policy, for example `TnC`. Use the same name for every version of the same policy. |
| `--policy-version` | Required. Version string for this upload, for example `1.1`. |
| `--file-path` | Required. Path to the HTML file that contains the policy text. |

Example:

```text theme={"dark"}
zcli doc-policy create TnC --policy-version=1.1 --file-path=/home/zcli/policies/TnC.html
```

On success, ZCLI prints nothing. To confirm the result, run `zcli doc-policy show --all`.

Keep the following in mind when you prepare the file:

* ZCLI reads the file as UTF-8 text and uploads its contents. It does not check that the file is valid HTML.
* ZCLI opens the file for reading and writing, although it does not change the file. If you do not have write permission on the file, for example because it is on a read-only mount, ZCLI prints a `Permission denied` error and creates nothing. Copy the file to a writable location first.
* Use a full path in `--file-path`. Your shell does not expand `~` after `=`, so the `--file-path=~/policy/TnC.html` form in `zcli doc-policy --help` fails with `No such file or directory`.

## View Policy Versions

Show the policy versions that are marked as latest. Add `--all` to also show versions that are not marked as latest.

```text theme={"dark"}
zcli doc-policy show [--all]
```

To show the versions that are marked as latest:

```text theme={"dark"}
zcli doc-policy show
```

To show all versions:

```text theme={"dark"}
zcli doc-policy show --all
```

The text output shows each version's policy, version, and file URL. It does not show the version's ID, which you need for `download` and `delete`. To see the ID and all other fields, use JSON output:

```text theme={"dark"}
zcli --format=json doc-policy show --all
```

> [!NOTE]
>
> The example `zcli doc-policy --all` in `zcli doc-policy --help` leaves out `show`. If you run it as written, ZCLI prints the usage text. Use `zcli doc-policy show --all`.

## Download a Policy Version

Download the HTML of one policy version by its ID.

```text theme={"dark"}
zcli doc-policy download [<policyFileId>]
```

Example:

```text theme={"dark"}
zcli doc-policy download MY_POLICY_ID
```

ZCLI saves the policy text in the current working directory as `<policyFileId>.json`. Although the file name ends in `.json`, the file contains the policy HTML. Rename it to `.html` to open it in a browser.

The ID is shown as optional in the syntax, but it is required in practice. If you leave it out, ZCLI requests a policy with the ID `None`.

## Publish a Policy Version

Mark one version of a policy as the latest version. Users are asked to accept the latest version. See [How Policy Versions Work](#how-policy-versions-work).

```text theme={"dark"}
zcli doc-policy mark-latest <policyname> --policy-version=<policyversion>
```

Example:

```text theme={"dark"}
zcli doc-policy mark-latest TnC --policy-version=1.1
```

On success, ZCLI prints nothing. To confirm the result, run `zcli doc-policy show`.

## Delete a Policy Version

Delete one policy version by its ID. To find the ID, see [View Policy Versions](#view-policy-versions). ZCLI asks `Delete Doc Policy <uuid>? [Y/N]` unless you pass `-f`. If you answer no, ZCLI prints `Doc policy with id <uuid> not deleted.`

```text theme={"dark"}
zcli doc-policy delete --uuid=<uuid> [-f]
```

Example:

```text theme={"dark"}
zcli doc-policy delete --uuid=MY_POLICY_ID
```

## Next Steps

> [card] [Manage Users](https://zededa.mintlify.site/zcli-reference/users.md)
>
> Create users and manage their access to Edge Infrastructure Services.

> [card] [Get Started](https://zededa.mintlify.site/zcli-reference/get-started.md)
>
> Install ZCLI, configure access to Edge Infrastructure Services, and work with local files.

> [card] [Command Index](https://zededa.mintlify.site/zcli-reference/command-index.md)
>
> Every ZCLI command group and where to find its procedures.

> [card] [Overview](https://zededa.mintlify.site/zcli-reference/overview.md)
>
> All ZCLI command procedures, organized by resource type.
