# CLI reference

Use pushbag to manage artifacts, publish notifications and install the packaged agent skills.

Install with `npm install -g @pushbag/cli`. Use `pushbag help` for the synopsis. Examples below use illustrative IDs and compact JSON. Human output shows the command result without progress, update notices or the agent hint.

Jump to [upload](#upload), [notify](#notify), [auth set](#auth-set), [config show](#config-show), [guide](#guide) or [exit codes](#exit-codes).

## Invocation

### Global flags

| Flag | Value | Default | Effect |
| --- | --- | --- | --- |
| `--profile` | Name | Current profile, initially `default` | Select local settings for this invocation. |
| `--base-url` | URL | Environment or profile, initially `https://api.pushbag.dev` | Select an API deployment. |
| `--json` | Switch | Off | Write a structured result to stdout. Auth, guide, help and version retain their text formats. |
| `--help` | Switch | Off | Print CLI usage. |
| `--version` | Switch | Off | Print the installed CLI version. |

Global flags are shared by the commands below. Only upload, notify and guide have additional flags. For a value flag use a separate argument, as in `pushbag list --profile work --json`. An unknown flag produces ``Unknown flag --typo. Run `pushbag help` to see each command's flags.``

### Environment variables

| Variable | Value | Default | Effect |
| --- | --- | --- | --- |
| `PUSHBAG_API_KEY` | Key | Profile credential | Override the saved key, including when overriding the deployment. |
| `PUSHBAG_BASE_URL` | URL | Profile deployment | Override the saved target. An explicit flag wins. A saved key is only reused for its matching deployment. |
| `PUSHBAG_SKIP_UPDATE_CHECK` | Nonempty string | Unset | Suppress the automatic registry check and its stderr notice. |

### Exit codes

| Code | Meaning | Example |
| --- | --- | --- |
| 0 | Success | A stored message or a matching duplicate. |
| 1 | Operation failed | Missing credential, server refusal or a failed file in a batch. |
| 2 | Usage or input error | Unknown flag, invalid priority or missing required argument. |

For machine output read stdout separately. A command-wide JSON failure has the form `{"error":{"code":"usage","message":"Usage: pushbag open <artifact-id>"}}`. Upload can return an array with successes and failures together. Check the exit code before using the result.

## Credentials and profiles

### auth login

Find the dashboard where you can create a key. Open the printed URL in your browser.

`pushbag auth login`

```sh
pushbag auth login
```

```text
Create a CLI key at:
  https://app.pushbag.dev/settings/keys

Then run:
  pushbag auth set <api-key>
```

With `--json`, the result is the same text.

A non-success response to discovery produces `https://api.pushbag.dev did not return a Pushbag discovery document. Check the base URL.` The URL in the error is your configured deployment.

### auth set

Verify a key against the selected deployment before saving it in `~/.pushbag/config.jsonc`.

`pushbag auth set <api-key>`

```sh
pushbag auth set YOUR_API_KEY
```

```text
Saved key for https://api.pushbag.dev in profile "default".
```

With `--json`, the result is the same text.

A rejected candidate leaves the previous key in place. Missing argument: `Usage: pushbag auth set <api-key>`.

### whoami

Inspect the effective account, key capabilities and artifact allowance. Notification-only keys return null for plan and usage.

`pushbag whoami`

```sh
pushbag whoami
```

```text
profile:    testing
base url:   https://pushbag.example
account:    owner@example.com
credential: artifact key
visibility: private (default for new artifacts)
plan:       Test plan
artifacts:  2 of 10
storage:    1 KiB
```

With `--json`:

```json
{"profile":"testing","baseUrl":"https://pushbag.example","defaultVisibility":"private","userId":"user-1","email":"owner@example.com","credentialKind":"artifact_key","capabilities":{"artifacts":true,"publishChannelIds":[],"readChannelIds":"owned","deviceId":null},"planName":"Test plan","artifactCount":2,"maxArtifacts":10,"retainedBytes":1024}
```

### auth logout

Remove the locally saved key. Revoke it separately in dashboard settings to invalidate other copies.

`pushbag auth logout`

```sh
pushbag auth logout
```

```text
Removed the key for profile "default".
```

With `--json`, the result is the same text.

### config set base-url

Create or update a profile with its deployment.

`pushbag config set base-url <url>`

```sh
pushbag config set base-url https://api.pushbag.dev --profile work
```

```text
Profile "work" now targets https://api.pushbag.dev.
```

With `--json`:

```json
{"profile":"work","baseUrl":"https://api.pushbag.dev"}
```

### config set default-visibility

Choose the visibility for new CLI artifacts. Appending a version preserves the existing visibility unless explicitly overridden.

`pushbag config set default-visibility <public|private>`

```sh
pushbag config set default-visibility private --profile work
```

```text
Profile "work" now defaults to private artifacts.
```

With `--json`:

```json
{"profile":"work","defaultVisibility":"private"}
```

### config use

Make an existing profile current.

`pushbag config use <profile>`

```sh
pushbag config use work
```

```text
Now using profile "work".
```

With `--json`:

```json
{"profile":"work"}
```

If you see `Unknown profile "work".`, create it with `config set` first.

### config show

Inspect resolved settings. The key field only indicates whether a credential is present.

`pushbag config show`

```sh
pushbag config show
```

```text
profile:            work
base url:           https://api.pushbag.dev
default visibility: private
api key:            not set
```

With `--json`:

```json
{"profile":"work","baseUrl":"https://api.pushbag.dev","defaultVisibility":"private","apiKey":false}
```

## Artifacts

### upload

Publish one artifact per file, or append one file to an existing artifact.

`pushbag upload <file...> [options]`

```sh
pushbag upload report.html --private
```

```text
https://slug.pushbag.example
```

With `--json`:

```json
[{"file":"report.html","id":"artifact-1","url":"https://slug.pushbag.example","versionUrl":"https://slug.pushbag.example/v/1","version":1,"kind":"html","visibility":"private","title":null,"scripts":{"tier":"none","findings":[]},"inlinedImages":[],"notification":null}]
```

Use `pushbag upload report.html --artifact artifact-1 --notify` to publish an update and send its pinned URL. The notification receipt follows the URL in text mode. A batch fails local preflight as a unit. Once transfers start, inspect each result before retrying. See [limits](/docs/limits).

| Flag | Value | Default | Effect |
| --- | --- | --- | --- |
| `--private` | Switch | Profile | Require owner access. |
| `--public` | Switch | Profile | Allow anyone with the URL to view. |
| `--artifact` | Artifact ID | New artifact | Append one version of the same kind. |
| `--title` | Text | Unset | Set the title. For multiple files prefix each filename. |
| `--description` | Text | Unset | Describe the artifact. |
| `--expires` | Duration | Unset | Set fixed expiry, e.g. `12h`, `2d`, `1w`. |
| `--retention` | Days | Account window | Shorten the inactivity window, e.g. `2d`. |
| `--no-inline` | Switch | Off | Leave local HTML image references as written. |
| `--notify` | Switch | Off | Publish a message per completed upload. |
| `--channel` | Channel ID | Personal | Select the notification target. |
| `--priority` | 1–5 or name | 3 | Set notification priority. |

Passing either notification option without enabling delivery produces `Upload --channel and --priority require --notify.`

### list

List artifacts owned by the account. Rows show ID, kind, visibility, retained bytes, title and stable URL.

`pushbag list`

```sh
pushbag list
```

```text
artifact-1  html   public       2 KiB  Plan
    https://slug.pushbag.example
```

With `--json`:

```json
[{"id":"artifact-1","slug":"slug","kind":"html","title":"Plan","description":null,"visibility":"public","retainedBytes":2048,"currentVersionId":"version-1","repoHost":null,"repoOrganization":null,"repoName":null,"updatedAt":"2026-10-22T00:00:00.000Z","url":"https://slug.pushbag.example"}]
```

### open

Print a URL to the artifact. Private artifacts receive a short-lived view grant.

`pushbag open <artifact-id>`

```sh
pushbag open artifact-1
```

```text
https://slug.pushbag.example
```

With `--json`:

```json
{"id":"artifact-1","url":"https://slug.pushbag.example","visibility":"public"}
```

Missing ID: `Usage: pushbag open <artifact-id>`.

### visibility

Change who can read an existing artifact.

`pushbag visibility <artifact-id> <public|private>`

```sh
pushbag visibility artifact-1 private
```

```text
artifact-1 is now private.
```

With `--json`:

```json
{"id":"artifact-1","visibility":"private"}
```

Invalid value: `Usage: pushbag visibility <artifact-id> <public|private>`.

### expires

Set a fixed deadline measured from now, or clear it with never.

`pushbag expires <artifact-id> <12h|2d|1w|never>`

```sh
pushbag expires artifact-1 never
```

```text
artifact-1 no longer has an expiry date.
```

With `--json`:

```json
{"id":"artifact-1","expiresAt":null,"retentionDays":null}
```

A bare number produces `Usage: pushbag expires <artifact-id> <12h|2d|1w|never>`.

### retention

Set the inactivity window in days. Use default to resume account retention.

`pushbag retention <artifact-id> <days|default>`

```sh
pushbag retention artifact-1 2d
```

```text
artifact-1 will be deleted after 2 days without a view or publish.
```

With `--json`:

```json
{"id":"artifact-1","expiresAt":null,"retentionDays":2}
```

Zero days produces `Usage: pushbag retention <artifact-id> <days|default>`.

### delete

Remove an artifact and print its recovery deadline.

`pushbag delete <artifact-id>`

```sh
pushbag delete artifact-1
```

```text
artifact-1 deleted. Until Dec 8, `pushbag restore artifact-1` brings it back.
```

With `--json`:

```json
{"id":"artifact-1","deleted":true,"restorableUntil":"2026-12-08T12:00:00.000Z"}
```

Missing ID: `Usage: pushbag delete <artifact-id>`.

### restore

Recover a deleted artifact before its deadline.

`pushbag restore <artifact-id>`

```sh
pushbag restore artifact-1
```

```text
artifact-1 restored.
https://slug.pushbag.example
```

With `--json`:

```json
{"id":"artifact-1","url":"https://slug.pushbag.example","restored":true}
```

Missing ID: `Usage: pushbag restore <artifact-id>`.

## Notifications

### channels

List readable channels with Personal first. Publish-only grants can work even when the listing is empty.

`pushbag channels`

```sh
pushbag channels
```

```text
personal-channel  Personal (personal)  read: restricted  publish: restricted
```

With `--json`:

```json
[{"id":"personal-channel","name":"Personal","isDefault":true,"readPolicy":"restricted","publishPolicy":"restricted"}]
```

### notify

Send a message to a channel. Pipe plain text into stdin, pass a quoted argument or load a JSON object.

`pushbag notify [message] [options]`

```sh
pushbag notify "Build finished" --idempotency-key build-184
```

```text
Sent to personal-channel (message-1)
```

With `--json`:

```json
{"id":"message-1","channelId":"personal-channel","receipt":"receipt-1","duplicate":false}
```

An invalid priority produces `--priority takes 1-5 or min, low, default, high, urgent.`

| Flag | Value | Default | Effect |
| --- | --- | --- | --- |
| `--payload` | File or `-` | None | Read JSON from a file or stdin. Explicit fields override it. |
| `--channel` | Channel ID | Personal | Address a specific channel. |
| `--title` | Text | Unset | Add a display title. |
| `--priority` | 1–5 or name | 3 | Names in ascending order are min, low, default, high and urgent. |
| `--tag` | Text | Unset | Repeat to replace the payload tag list. |
| `--markdown` | Switch | False | Enable Markdown rendering. |
| `--click` | URL | Unset | Open a web or app destination. |
| `--data` | JSON object | Unset | Replace the whole data object. |
| `--idempotency-key` | Text | Unset | Deduplicate retries within a channel. |
| `--artifact-version` | Version ID | Unset | Associate the message with a stored version. |

For action buttons and icon URLs use `pushbag notify --payload message.json`. See the [payload schema](/docs/http-api).

## CLI maintenance

### guide

Read packaged authoring guidance or install the selected guides as skills.

`pushbag guide [names...] [options]`

```sh
pushbag guide pbg-plan --install
```

```text
Installed  pbg-plan  .agents/skills/pbg-plan
```

With `--json`, the result is the same text.

| Flag | Value | Default | Effect |
| --- | --- | --- | --- |
| `--install` | Switch | Off | Copy each selected guide to .agents/skills. |
| `--all` | Switch | Off | Install every packaged guide. |
| `--claude` | Switch | Off | Also link the installed guides under .claude/skills. |
| `--global` | Switch | Off | Install under the home directory. |
| `--force` | Switch | Off | Replace an installation that differs from the packaged copy. |

### upgrade

Check the registry and update the global installation with its package manager.

`pushbag upgrade`

```sh
pushbag upgrade
```

```text
pushbag 0.5.0 is up to date.
```

With `--json`:

```json
{"version":"0.5.0","upgraded":false}
```

For an npx copy that needs updating: ``This copy runs through npx. Run `npx @pushbag/cli@latest` instead.``

### version

Print the installed version.

`pushbag version`

```sh
pushbag version
```

```text
0.5.0
```

With `--json`, the result is the same text.
