Metadata-Version: 2.4
Name: vgs-cli
Version: 1.37.0
Summary: VGS Client
Home-page: https://github.com/verygoodsecurity/vgs-cli
Author: Very Good Security
Author-email: dev@verygoodsecurity.com
License: BSD
Platform: any
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: BSD License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: base58<3,>=2.1.1
Requires-Dist: click-plugins<2,>=1.1.1
Requires-Dist: click<9,>=7
Requires-Dist: configobj-dev>=2019.9.1
Requires-Dist: cryptography>=44.0.1
Requires-Dist: jsonschema<5,>=3.2.0
Requires-Dist: keyring<26,>=16.1.0
Requires-Dist: keyrings.alt<6,>=3.1
Requires-Dist: pyhumps
Requires-Dist: semver<4,>=3
Requires-Dist: termcolor<3,>=2
Requires-Dist: Jinja2>=2.10
Requires-Dist: vgs-api-client<1,>=0.0.51
Requires-Dist: async-timeout
Requires-Dist: packaging<27,>=26
Requires-Dist: textual<8.3,>=8.2.8
Requires-Dist: certifi>=2026.10.18
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: license
Dynamic: license-file
Dynamic: platform
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

# VGS CLI

Command Line Tool for programmatic configurations on VGS.

[Official Documentation](https://docs.verygoodsecurity.com/vault/developer-tools/vgs-cli)

## Table of Contents

- [Requirements](#requirements)
- [Installation](#installation)
  - [PyPI](#pypi)
- [Run](#run)
- [Running in Docker](#running-in-docker)
- [AI agent skill](#ai-agent-skill)
- [Commands](#commands)
  - [Authentication](#authentication)
  - [Organizations and tenants](#organizations-and-tenants)
  - [Organization notifications](#organization-notifications)
  - [Routes](#routes)
  - [Collect Forms](#collect-forms)
  - [Access credentials and logs](#access-credentials-and-logs)
  - [Reveal sessions](#reveal-sessions)
  - [Agent gateway settings and destinations](#agent-gateway-settings-and-destinations)
  - [Service accounts](#service-accounts)
  - [Certificates](#certificates)
- [Automation with VGS CLI](#automation-with-vgs-cli)
- [VGS CLI Console](#vgs-cli-console)
- [Telemetry](#telemetry)

## Requirements
[Python 3.11 or newer](https://www.python.org/downloads/) with OpenSSL 1.1.1 or newer, or [Docker](https://docs.docker.com/get-docker/).

## Installation

### PyPI

Install from PyPI:

```bash
python3 -m pip install vgs-cli
```

## Run

Verify the installation:

```bash
vgs --version
```

## Running in Docker

Check our [official documentation](https://docs.verygoodsecurity.com/vault/developer-tools/vgs-cli/docker).

## AI agent skill

Install the agent skill:

```bash
npx skills add verygoodsecurity/skills --skill vgs-cli-guide
```

The guide covers Dashboard-assisted onboarding, the complete built-in command
surface, controlled route and Collect Form changes, service-account automation,
Docker, certificates, logs, and troubleshooting. Installation uses the
[Skills CLI](https://skills.sh/).

Update the agent skill:

```bash
npx skills update vgs-cli-guide
```

## Commands

Full command reference:

- https://docs.verygoodsecurity.com/vault/developer-tools/vgs-cli/commands
- Routes YAML format (`routes.yaml`): https://docs.verygoodsecurity.com/vault/developer-tools/vgs-cli/commands#routes.yaml

### Tenant terminology

Use **tenant** and `--tenant/-T` in new commands. Legacy vault commands and
`--vault/-V` options still work, but print a deprecation warning.

### Authentication

| Command | Purpose |
| --- | --- |
| `vgs --help` | List available commands. |
| `vgs login` | Start an interactive session. |
| `vgs logout` | End the current session. |

### Organizations and tenants

| Command | Purpose |
| --- | --- |
| `vgs get organizations` | List accessible organizations. |
| `vgs get tenants` | List all tenants visible to the authenticated identity. |
| `vgs get tenant -T <TENANT_ID>` | Get one tenant with provisioning, account, configuration, and merchant state. |
| `vgs generate tenant > tenant.yaml` | Generate a tenant template. |
| `vgs apply tenant -f tenant.yaml` | Create and configure a SANDBOX or LIVE tenant through a staged, resumable workflow. |
| `vgs apply tenant -O <ORGANIZATION_ID> -f tenant.yaml` | Create a tenant when `organizationId` is omitted from the template. |
| `vgs apply tenant-resources -T <TENANT_ID> -f resources.yaml --dry-run true` | Validate tenant resources without applying them. |
| `vgs apply tenant-resources -T <TENANT_ID> -f resources.yaml` | Apply reviewed resources to a tenant. |

`vgs get tenants` does not take an organization option. `vgs apply tenant`
requires the organization ID either in `tenant.yaml` as `data.organizationId`
or through `-O/--organization`; if both are present, they must match.


### Organization notifications

| Command | Purpose |
| --- | --- |
| `vgs get notifications -O <ORGANIZATION_ID>` | List notification integrations. |
| `vgs get notification-events -O <ORGANIZATION_ID> <INTEGRATION_ID>` | List configured events for a notification integration. |
| `vgs generate notification > notification.yaml` | Generate a notification integration template. |
| `vgs apply notification -O <ORGANIZATION_ID> -f notification.yaml` | Create or update a notification integration from a file. |
| `vgs apply notification -O <ORGANIZATION_ID> --enable <INTEGRATION_ID>` | Enable a notification integration. |
| `vgs apply notification -O <ORGANIZATION_ID> --disable <INTEGRATION_ID>` | Disable a notification integration. |
| `vgs delete notification -O <ORGANIZATION_ID> <INTEGRATION_ID>` | Delete a notification integration. |

Notification management requires an active organization, organization-admin
access. The CLI masks generated webhook secrets in its output.

### Routes

| Command | Purpose |
| --- | --- |
| `vgs generate route --protocol http > http-route.yaml` | Generate an HTTP route template. |
| `vgs generate route --protocol sftp > sftp-route.yaml` | Generate an SFTP route template. |
| `vgs get routes -T <TENANT_ID>` | List tenant routes. |
| `vgs apply routes -T <TENANT_ID> -f <FILE>` | Apply tenant routes. |
| `vgs delete routes -T <TENANT_ID> <ROUTE_ID>` | Delete one tenant route. |

### Collect Forms

| Command | Purpose |
| --- | --- |
| `vgs get forms -T <TENANT_ID>` | List Collect Forms. |
| `vgs get form -T <TENANT_ID> <FORM_ID>` | Get one Collect Form. |
| `vgs generate form > form.yaml` | Generate a Collect Form template. |
| `vgs apply form -T <TENANT_ID> -f <FILE>` | Apply a Collect Form from a file. |
| `vgs apply form -T <TENANT_ID> --json '<JSON>'` | Apply inline Collect Form JSON. |
| `vgs delete form -T <TENANT_ID> <FORM_ID>` | Delete one Collect Form. |

### Access credentials and logs

| Command | Purpose |
| --- | --- |
| `vgs get access-credentials -T <TENANT_ID>` | List tenant access credentials. |
| `vgs generate access-credentials -T <TENANT_ID>` | Generate tenant access credentials. Capture the output securely as shown below. |
| `vgs logs access -T <TENANT_ID>` | View tenant access logs. |
| `vgs logs operations -T <TENANT_ID> -R <REQUEST_ID>` | View request operation logs. |
| `vgs logs reveal-decisions -T <TENANT_ID> -R <REQUEST_ID>` | Show why a request's reveal session decisions were made (outcome, decider, reason, host, and ordered checks). |

Access-credential generation is a live mutation that returns secret material.
Write it to a new, approved absolute path outside version control with
owner-only permissions, and do not display or inspect it in shared logs:

```bash
(
  umask 077
  set -o noclobber
  vgs generate access-credentials -T <TENANT_ID> \
    > /absolute/secure/new-access-credentials.yaml
)
```

### Reveal sessions

A reveal session lets an agent platform reveal selected tokens to an allowlist
of hosts through a session proxy. Creating, listing, and ending sessions
requires the `reveal-sessions:*` scopes, which must be enabled for your
organization by VGS. Use the `agent-gateway`
[service-account template](#service-accounts) for a least-privilege account.

| Command | Purpose |
| --- | --- |
| `vgs generate reveal-session > reveal-session.yaml` | Generate a reveal session template. |
| `vgs apply reveal-session -T <TENANT_ID> -f reveal-session.yaml` | Create a reveal session. |
| `vgs get reveal-sessions -T <TENANT_ID>` | List reveal sessions with their state, expiry, allowed hosts, and counters. |
| `vgs delete reveal-session -T <TENANT_ID> <SESSION_ID>` | End a reveal session. `SESSION_ID` is `RS` plus 22 base58 characters. |

Required scopes: `apply reveal-session` and `delete reveal-session` need
`reveal-sessions:write`; `get reveal-sessions` needs `reveal-sessions:read`
(`reveal-sessions:write` does not imply read).

`apply reveal-session` prints the session's proxy URL and tokens once, and
writes `Store the proxy URL now: it carries the session secret and is not shown
again.` to stderr. The URL is `<scheme>://<session id>:<secret>@<host>:<port>`:
treat it as a secret, like a password.
Store them immediately: they are not shown again, and `get reveal-sessions`
never lists them. Capture the output as shown for
[access credentials](#access-credentials-and-logs).

The `proxy` block includes `scheme`: `https` means clients make a TLS connection
to the proxy itself, `http` a plain one (shown as `http` when the server sends none).

Point a browser at `pacUrl` (a PAC file that sends all traffic to the gateway), and still supply the session credentials when the proxy asks for them.

Example `reveal-session.yaml`:

```yaml
apiVersion: 1.0.0
kind: RevealSession
data:
  aliases:
    - alias: tok_live_card
      format: card_number     # card_number, card_cvc, or text
      bin: "411111"           # optional, 6 to 8 digits
      length: 16              # optional
      storage: VOLATILE       # optional: PERSISTENT (default) or VOLATILE
  allowedHosts:               # optional, up to 20 hosts
    - api.stripe.com
  allowedClientCidrs:         # optional, up to 10 CIDRs
    - 203.0.113.0/24
```

`vgs logs reveal-decisions -T <TENANT_ID> -R <REQUEST_ID> [-o json|yaml]` shows
the reveal decisions recorded for a request. Fields are snake_case attributes, as
the API returns them: `outcome`, `decided_by`, `reason`,
`host`, the ordered `checks` (`check`, `result`, `detail`), `occurred_at`,
`session_id`, and `alias_hashes`. `<REQUEST_ID>` is the request trace ID used by
`vgs logs access` and `vgs logs operations`. Plaintext, tokens, and raw aliases
are never included.

`vgs generate reveal-session` also shows the optional `egressProxySettings` block
(`type: custom`, `scheme`, `hostname`, `port`, `username`, `password`).

### Agent gateway settings and destinations

The agent gateway decides what a reveal session may do with hosts that are not
on its `allowedHosts` list. Three tenant preferences and a list of destination
overrides control it.

| Command | Purpose |
| --- | --- |
| `vgs get agent-gateway -T <TENANT_ID>` | Print the three preferences (an unset `autoGuardedRoutes` prints `null`, an unset webhook `""` and an unset hold `0`) and every destination with its `id`, `hostPattern`, `action` and `origin`, sorted by `hostPattern`. |
| `vgs apply agent-gateway -T <TENANT_ID> -f agent-gateway.yaml` | Set the preferences in the file and make the destination overrides match it, then print the result. |

Required scopes: `get agent-gateway` needs `preferences:read` and
`agent-gateway:read`; `apply agent-gateway` needs `preferences:write`,
`agent-gateway:write` and `agent-gateway:read` (`agent-gateway:write` does not
imply read, and `apply` reads the configuration back; without
`agent-gateway:read` the API leaves the agent gateway preferences out of the
preference list). The `agent-gateway` service-account
template grants only the `reveal-sessions:*` scopes, so a service account that
runs these commands needs the extra scopes.

The `get agent-gateway` output can include the step-up webhook URL, which may
embed a secret in its path, so do not log it.

Example `agent-gateway.yaml`:

```yaml
apiVersion: 1.0.0
kind: AgentGateway
data:
  autoGuardedRoutes: true                        # agentGatewayAutoGuardedRoutes; null leaves it as it is
  stepUpWebhookUrl: https://hooks.example.com/vgs # agentGatewayStepUpWebhookUrl
  stepUpHoldSeconds: 15                          # 0 (default 20) or 5 to 30
  destinations:                                  # optional; omit to leave destinations alone
    - hostPattern: "*.bad.example.com"
      action: block                              # block, trust, or guarded
    - hostPattern: checkout.shop.example.com
      action: trust
    - hostPattern: pay.example.net
      delete: true                               # the only way apply removes an auto row
```

`allowedHosts` on a reveal session is optional; without it, the settings above
decide every host.

Unlisted hosts are `guarded` by default. A tenant that never set
`autoGuardedRoutes` gets `guarded` sessions unless `stepUpWebhookUrl` is set,
which makes them `step_up`. `autoGuardedRoutes: true` is `guarded` even with a
webhook, and `autoGuardedRoutes: false` is `step_up` with a webhook and
`strict` without one. `get agent-gateway` prints an unset `autoGuardedRoutes` as
`null`, with a comment, and `apply` treats `null` as "leave it as it is": it
never writes or deletes the preference. `apply` also skips a preference whose
value already matches what `get` prints (`unchanged <field>`), so applying the
output of `get` writes no preference. While `autoGuardedRoutes` is unset,
setting a webhook where there was none tightens (guarded to step-up); changing
or clearing it loosens.

`apply agent-gateway` prints one line per change (`created`, `updated`,
`deleted` or `unchanged`) as it is made, restrictive-first: `block` destinations,
preferences that tighten, `trust` and `guarded` destinations, deletes, then
preferences that loosen. A `hostPattern` may appear only once in the file.

Destinations are matched by `hostPattern`, ignoring
case, surrounding spaces and one trailing dot. Destinations missing from the
server are created, a different `action` is updated, and `origin: manual`
destinations that the file does not list are deleted. Omit `destinations` to
leave all of them as they are. Each preference is set only when it appears in
the file.

Destinations with `origin: auto` are staged by the gateway for your review and
do not affect decisions until you act on them. `apply` keeps them unless the
file names them with `delete: true`. Listing an auto destination with an
`action` makes it a manual one. A `destinations` entry has either an `action`
or `delete: true`, not both. The server refuses patterns that can never receive
plaintext (`never_host`) and invalid values, and `apply` prints the server's
`code` and `detail`.

### Service accounts

Generate a service-account resource and save the YAML so you can review it
before applying it. The general `vgs-cli` template accepts zero or more tenants;
when no tenant is supplied, the generated account has no tenant access.

```bash
vgs generate service-account --template vgs-cli -T <TENANT_ID> > service-account.yaml
```

The `agent-gateway` template accepts zero or more tenants and needs no
`--var name`; without `-T` it prints a warning and the account has no tenant
access.

For the Agent Web Gateway Control Panel, use `agent-web-gateway-admin`. It
accepts the same tenant options and generates the account name `agent-gateway-admin`
(within the 20-character account-name limit):

```bash
vgs generate service-account --template agent-web-gateway-admin -T <TENANT_ID> > service-account.yaml
```

It grants `cards:create`, `cards:read`, and `cards:update` for saved-card creation,
metadata retrieval and CVC/expiry updates, plus
`aliases:write`, `reveal-sessions:read/write`, and `agent-gateway:read/write`.
It excludes `cards:write`, `cards:delete`, and `cards:read-pci`: the template does
not grant card deletion or access to raw PAN/CVC values.
Tenant IDs supplied with `-T` are included in the CLI account export for the
control panel. Preference and tenant-management permissions are outside this
template's scope. Product scopes must be enabled for the organization.

Payment-credential templates require exactly one tenant and a name containing
1–20 characters:

```bash
vgs generate service-account --template <TEMPLATE> -T <TENANT_ID> --var name=<NAME> > service-account.yaml
```

| Template | Purpose |
| --- | --- |
| `vgs-cli` | Automate common CLI organization, tenant, route, and access-log operations. |
| `public-credential-collect` | Collect payment credentials without read access. |
| `read-credentials-no-pci` | Read tokenized credentials without PCI data. |
| `read-credentials-with-pci` | Read credentials including PCI data. |
| `credentials-admin` | Read and write payment credentials. |
| `agent-web-gateway-admin` | Create, read and update cards without deletion or PCI read; create aliases and manage reveal sessions and agent-gateway resources for the control panel. |
| `agent-gateway` | Create, list, and end reveal sessions (`reveal-sessions:read`, `reveal-sessions:write`), with no route, vault, or credential access, for agent platforms. The `reveal-sessions:*` scopes must be enabled for the organization. |

After reviewing the generated scopes, apply the resource to the organization:

```bash
vgs apply service-account -O <ORGANIZATION_ID> -f service-account.yaml
```

The apply response contains a one-time client secret. Run the command only in
your private terminal, store the secret in an approved secret manager, and do
not commit or share the response. See the
[service-account documentation](https://docs.verygoodsecurity.com/vault/developer-tools/vgs-cli/service-account)
for the full workflow.

### Certificates

| Command | Purpose |
| --- | --- |
| `vgs certificate --help` | Show certificate commands. |

## Automation with VGS CLI

If you want to use the VGS CLI for automation, create a [service account](https://docs.verygoodsecurity.com/vault/developer-tools/vgs-cli/service-account).

## VGS CLI Console

VGS CLI Console is a keyboard-first interactive workspace for managing VGS
resources in SANDBOX tenants.

![VGS CLI Console](docs/images/vgs-cli-console.png)

Launch it from an installed VGS CLI:

```bash
vgs console
```

In the Console:

1. Complete browser authentication and select a SANDBOX context.
2. Open **Organization**, select **Tenants**, then choose **Create tenant**.
3. Enter a unique tenant name and complete one of the CMP, HTTP, SFTP, or
   no-use-case paths.
4. Review the retained answers before selecting **Create tenant**. This action
   creates real SANDBOX resources.
5. Confirm that the completed tenant becomes the active Console context.

## Telemetry

VGS CLI collects limited usage analytics to help VGS understand how the CLI is
used and improve the product. To disable telemetry, set
`VGS_CLI_TELEMETRY_OPTOUT=1` or `DO_NOT_TRACK=1`.
