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

# preview

> Publish, list, and delete preview URLs for a port running inside a sandbox

## `bonya preview`

> [!NOTE]
>
> Alias: `pv`

A preview publishes one guest port at an HTTPS URL a browser can open. Ports must be in the range 1024–65535; privileged ports are never previewable.

## `create`

Publishes a preview URL for a guest port.

```shell theme={null}
bonya preview create [sandbox] <port> [--auth token|public] [--name web]
```

| Flag | Default | Description |
| - | - | - |
| `--auth` | `token` | `token` (URL requires a credential) or `public` (URL is reachable by anyone who has it). |
| `--name` | — | Display name for the preview (max 80 bytes). |
| `--by-name` | `false` | Treat the sandbox argument as a name even if it looks like an id. |

> [!WARNING]
>
> `--auth public` means anyone with the URL reaches the service running in your sandbox with **no credential at all**. The CLI marks public preview URLs in red in its output as a reminder. Use the default `token` mode unless you specifically need to share the URL with people who don't have a Bonya session.

```shell Default (token-authenticated) theme={null}
bonya preview create web 3000
```

```shell Named theme={null}
bonya preview create web 3000 --name app
```

```shell Public — no credential required theme={null}
bonya preview create web 8080 --auth public
```

## `list`

Lists previews for a sandbox.

```shell theme={null}
bonya preview list [sandbox]
```

```shell theme={null}
bonya preview list web
```

## `delete`

Deletes a preview.

```shell theme={null}
bonya preview delete [sandbox] <preview-id>
```

```shell theme={null}
bonya preview delete web pv-a1b2c3
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.