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

# baseten sandbox preview token

> Manage tokens for private sandbox previews (PRE-RELEASE)

> [!NOTE]
>
> PRE-RELEASE: Sandbox commands are not GA yet. Their arguments, flags, and output may change.

Tokens grant access to a private preview until they expire. Append one to the preview URL as `?preview_token=<token>`; the first request sets a cookie so a browser can keep navigating without it.

## create

```sh theme={"system"}
baseten sandbox preview token create [OPTIONS]
```

Creates a token granting access to a private preview until `--expires-at`.

### Options

**--expires-at** `TEXT` *required*

Time the token stops working. ISO 8601, local when no timezone is given.

**--if-not-exists** `BOOL`

Return an existing unexpired token of the preview that stays valid at least until --expires-at, instead of creating one. A token created moments before may not be found yet, so a new one may be created anyway.

**-q, --jq** `TEXT`

Filter JSON output with a jq expression; implies --output json (or jsonl for streamed commands)

**--name** `TEXT` *required*

Name of the sandbox.

**-o, --output** `TEXT` (default: text)

Output format

One of: `text`, `json`, `jsonl`, `none`

**--preview-name** `TEXT` *required*

Name of the preview.

**--profile** `TEXT`

Use a specific stored profile for this command, overriding BASETEN\_PROFILE and the current profile

**--team** `TEXT`

Team name or ID the sandbox belongs to. Defaults to your only team; required if you belong to more than one. Run 'baseten org team list' to see teams.

**-v, --verbose** `BOOL`

Enable verbose logging

### Examples

Create a token valid until a given time

```sh theme={"system"}
baseten sandbox preview token create --name my-sandbox --preview-name web --expires-at 2026-11-01T12:00:00Z
```

### Filter output with `--jq`

Create a token and print it

```sh theme={"system"}
baseten sandbox preview token create --name my-sandbox --preview-name web --expires-at 2026-11-01T12:00:00Z --jq '.token'
```

### Output

**Text mode (`--output text`):** One field per line describing the token, then the preview URL with the token appended.

**JSON mode (`--output json`):** payload type `managementapi.SandboxPreviewToken`.

## list

```sh theme={"system"}
baseten sandbox preview token list [OPTIONS]
```

Lists a private preview's tokens, including expired ones until they are removed. A public preview has no tokens.

### Options

**-q, --jq** `TEXT`

Filter JSON output with a jq expression; implies --output json (or jsonl for streamed commands)

**--name** `TEXT` *required*

Name of the sandbox.

**-o, --output** `TEXT` (default: text)

Output format

One of: `text`, `json`, `jsonl`, `none`

**--preview-name** `TEXT` *required*

Name of the preview.

**--profile** `TEXT`

Use a specific stored profile for this command, overriding BASETEN\_PROFILE and the current profile

**--team** `TEXT`

Team name or ID the sandbox belongs to. Defaults to your only team; required if you belong to more than one. Run 'baseten org team list' to see teams.

**-v, --verbose** `BOOL`

Enable verbose logging

### Examples

List a preview's tokens

```sh theme={"system"}
baseten sandbox preview token list --name my-sandbox --preview-name web
```

### Filter output with `--jq`

Print every unexpired token's name

```sh theme={"system"}
baseten sandbox preview token list --name my-sandbox --preview-name web --jq '.items[] | select(.expired | not) | .name'
```

### Output

**Text mode (`--output text`):** Table with columns: NAME, EXPIRES, EXPIRED. Prints "No tokens found." to stderr when the list is empty.

**JSON mode (`--output json`):** payload type `cmd.SandboxPreviewTokenList`.

## delete

```sh theme={"system"}
baseten sandbox preview token delete [OPTIONS]
```

Revokes a token. Requests using it are rejected at once.

### Options

**-q, --jq** `TEXT`

Filter JSON output with a jq expression; implies --output json (or jsonl for streamed commands)

**--name** `TEXT` *required*

Name of the sandbox.

**-o, --output** `TEXT` (default: text)

Output format

One of: `text`, `json`, `jsonl`, `none`

**--preview-name** `TEXT` *required*

Name of the preview.

**--profile** `TEXT`

Use a specific stored profile for this command, overriding BASETEN\_PROFILE and the current profile

**--team** `TEXT`

Team name or ID the sandbox belongs to. Defaults to your only team; required if you belong to more than one. Run 'baseten org team list' to see teams.

**--token-name** `TEXT` *required*

Name of the token.

**--yes** `BOOL`

Skip the interactive confirmation prompt. Required when stdin is not a terminal.

**-v, --verbose** `BOOL`

Enable verbose logging

### Examples

Delete a token without the confirmation prompt

```sh theme={"system"}
baseten sandbox preview token delete --name my-sandbox --preview-name web --token-name 7f3k2m9q1x8c4v6b0n5z --yes
```

### Output

**Text mode (`--output text`):** A confirmation line on stderr.
