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

# Publish & Unpublish

The CLI's `publish` and `unpublish` commands control the visibility of a sandbox template. **Publishing** makes a template public to everyone outside your team; **unpublishing** makes it private to your team again. Under the hood both set the template's `public` flag.

<Warning>
  **Note:** By default the command asks for confirmation before changing visibility, warning that publishing makes the template public to everyone outside your team. Pass `-y` / `--yes` to skip the prompt.
</Warning>

***

## Prerequisites

Set your API key in the environment:

```bash CLI icon="terminal" theme={"system"}
export NOVITA_API_KEY=<your API key>
```

***

## Usage

```bash CLI icon="terminal" theme={"system"}
# Publish (alias: tpl pb)
novita-sandbox-cli template publish [template]

# Unpublish (alias: tpl upb)
novita-sandbox-cli template unpublish [template]
```

The `[template]` argument is optional. There are three ways to choose which template(s) to act on:

| Way to select     | Behavior                                                                     |
| ----------------- | ---------------------------------------------------------------------------- |
| Pass `[template]` | Act on the template with the given template ID                               |
| Omit `[template]` | Use the template defined by `novita.toml` in the root directory              |
| `-s` / `--select` | Pick from an interactive list (only shows templates eligible for the action) |

### Options

| Option                   | Description                                                     |
| ------------------------ | --------------------------------------------------------------- |
| `-p, --path <path>`      | Change the root directory where the command runs                |
| `--config <novita-toml>` | Path to the sandbox config toml (defaults to `./novita.toml`)   |
| `-s, --select`           | Select template(s) from an interactive list                     |
| `-t, --team <team-id>`   | Team ID the operation is associated with (used with `--select`) |
| `-y, --yes`              | Skip the manual confirmation prompt                             |

***

## Examples

```bash CLI icon="terminal" theme={"system"}
novita-sandbox-cli template publish <templateID>
```

```bash CLI icon="terminal" theme={"system"}
novita-sandbox-cli template publish -y
```

```bash CLI icon="terminal" theme={"system"}
novita-sandbox-cli template unpublish --select --team <teamID>
```

On success, publishing prints the public names the template was published as:

```text Output icon="code" theme={"system"}
- Publishing sandbox template <template>
  Published as: <name>
```
