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

# Views

> List, create, and edit views and the prompts in them from the TPC CLI.

# Views

A view is a named subset of a product's prompts. Analytics commands take `--view` to report on that subset. Pass `--scope <org-slug>/<product-slug>` to select the product. The CLI does not save an active view.

```bash theme={null}
tpc view list --scope pro-org/my-product
tpc view get "Enterprise" --scope pro-org/my-product
tpc analytics sov --scope pro-org/my-product --view Enterprise
```

`get`, `add-prompts`, and `remove-prompts` take a view ID or the exact view name (case-insensitive). If two views share a name, the CLI lists their IDs and asks you to pick one.

## Create a view

```bash theme={null}
tpc view create --name "Enterprise" --scope pro-org/my-product
tpc view create --name "Enterprise" --description "Enterprise buyers" --scope pro-org/my-product
tpc view create --name "Enterprise" --prompt-id <prompt-id> --prompt-id <prompt-id> --scope pro-org/my-product
```

| Flag | Description |
| - | - |
| `--name` | Required. Up to 100 characters. |
| `--description` | Optional. Up to 500 characters. |
| `--prompt-id` | Optional. Prompt from the product in `--scope` to add when the view is created. Repeat the flag or pass a comma-separated list. |

## Add and remove prompts

```bash theme={null}
tpc view add-prompts "Enterprise" --prompt-id <prompt-id> --scope pro-org/my-product
tpc view add-prompts view_123 --prompt-id <prompt-id>,<prompt-id> --scope pro-org/my-product
tpc view remove-prompts "Enterprise" --prompt-id <prompt-id> --scope pro-org/my-product
```

`--prompt-id` is required and can be repeated or comma-separated. Find prompt IDs with `tpc prompts list`.

A prompt runs once per answer engine and persona. The dashboard calls each run a conversation query, and views hold those runs. Adding a prompt adds all of its runs. Removing a prompt removes all of its runs from the view but does not delete the prompt. `create` and `add-prompts` fail before changing anything if a prompt ID isn't in the product in `--scope` or has no runs. When adding prompts, runs already in the view are skipped. `remove-prompts` also removes runs of archived prompts that are still in the view.

## JSON output

Pass `--format json` for machine-readable output. `create` prints the new view. `add-prompts` and `remove-prompts` print:

```json theme={null}
{
  "viewId": "view_123",
  "viewName": "Enterprise",
  "promptIds": ["<prompt-id>"],
  "conversationQueryIds": ["<conversation-query-id>", "<conversation-query-id>"],
  "addedCount": 2,
  "removedCount": 0
}
```


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