Skip to content

Automate

CLI

Manage projects, keys, integrations and sessions from a terminal or a CI job.

The Showbug CLI does everything the REST API does, from a terminal or a script. It prints readable tables for people and JSON for scripts and AI agents, and it signs in with an API token.

Install and run

The package is @showbug/cli and the command is showbug. It needs Bun or Node.js 20 or later. Run it without installing:

bunx @showbug/cli whoami

npx @showbug/cli does the same with Node.js. To install it, so that showbug is on your path:

bun add --global @showbug/cli
# or
npm install --global @showbug/cli

showbug --version

The examples below use showbug. If you have not installed it, put bunx @showbug/cli in its place.

Signing in and configuration

Create a token under Settings → API tokens (see API tokens), then:

showbug login
showbug whoami

showbug login asks for the token, hides what you type, checks the token with the API and saves it. whoami shows who the token acts for:

user:    Dana <dana@example.com>
org:     Acme (org_…), role admin
token:   GitHub Actions deploy (tok_…)
scopes:  keys:write, projects:write
expires: 2026-12-28T10:15:00Z

In a script, pipe the token in, or skip login and set the environment variable SHOWBUG_TOKEN, which the CLI reads on every run:

printf '%s\n' "$TOKEN" | showbug login

To use another environment, add its address when you log in. It is saved with the token:

showbug login --api-url https://preprod-api.showbugai.com

showbug logout deletes the saved token.

SettingFlagEnvironment variableDefault
API token--tokenSHOWBUG_TOKENThe token saved by login
API address--api-urlSHOWBUG_API_URLhttps://api.showbugai.com
Organisation id--orgSHOWBUG_ORGThe token’s own organisation, which the CLI looks up

A flag beats the environment, the environment beats the saved file, and the saved file beats the default. The file is ~/.config/showbug/config.json, or showbug/config.json under $XDG_CONFIG_HOME if that is set. It holds the token, the API address and the organisation, and is readable only by you. Treat it like a password. In CI, prefer SHOWBUG_TOKEN from your secret store.

Commands

showbug --help lists every command, and showbug <command> --help shows one command’s arguments and flags. <project>, <key>, <integration>, <delivery>, <session>, <user> and <invite> are ids, as the matching list command shows them. Scope is what the token needs.

Sign in

CommandWhat it doesScopeAsks first
loginCheck an API token and save it.Any token
logoutDelete the saved token.None
whoamiShow the user, organisation, scopes and expiry of the token.Any token

Organisation, members and audit log

CommandWhat it doesScopeAsks first
org getShow the organisation.org:read
org rename <name>Rename the organisation.org:write
members listList members.members:read
members role <user> <role>Change a member’s role: viewer, member or admin. A token cannot make an owner.members:write
members remove <user>Remove a member.members:writeYes
invites listList pending invites.members:read
invites create <email> --role <role>Invite someone. The invite is emailed, and its link is shown once.members:write
invites resend <invite>Email an invite again. This makes a new link and ends the old one.members:write
invites revoke <invite>Revoke a pending invite.members:writeYes
auditShow the audit log, newest first.audit:read

Projects, origins and keys

CommandWhat it doesScopeAsks first
projects listList projects.projects:read
projects get <project>Show a project and its keys.projects:read
projects create <name> [--origin <url>]Create a project. It comes with a Default key. Repeat --origin for more than one.projects:write
projects update <project> [flags]Change a project. Only the flags you pass change: --name, --status, --review-required, --limit name=n.projects:write
origins list <project>List the allowed origins.projects:read
origins add <project> <origin>Allow an origin.projects:write
origins remove <project> <origin>Stop allowing an origin.projects:writeYes
keys list <project>List a project’s SDK keys.keys:read
keys create <project> [--label <label>]Create an SDK key.keys:write
keys revoke <project> <key>Revoke an SDK key.keys:writeYes

Integrations and deliveries

CommandWhat it doesScopeAsks first
integrations list <project>List a project’s integrations.integrations:read
integrations add-webhook <project> --url <url> [--events <list>]Send signed events to a URL. The signing secret is shown once.integrations:write
integrations add-linear <project> --api-key <key>Connect Linear with an API key.integrations:write
integrations add-github <project> --github-token <token>Connect GitHub Issues with a token.integrations:write
integrations update <project> <integration> [flags]Change an integration. Only the flags you pass change.integrations:write
integrations test <project> <integration>Send a test delivery, or check the credentials.integrations:write
integrations rotate-secret <project> <integration>Make a new webhook signing secret. The old one works for 24 more hours.integrations:writeYes
integrations remove <project> <integration>Remove an integration and cancel its pending deliveries.integrations:writeYes
deliveries list <project> [flags]List deliveries, newest first.integrations:read
deliveries retry <project> <delivery>Queue a failed delivery again.integrations:write

Sessions

CommandWhat it doesScopeAsks first
sessions list [flags]List sessions, newest first.sessions:read
sessions get <session>Show a session with its transcript and ticket state.sessions:read
sessions retry-tickets <session>Queue a session’s failed ticket deliveries again.integrations:write

Any endpoint

CommandWhat it doesScopeAsks first
api <method> <path> [--data <json>]Call any endpoint of the REST API.What the endpoint needsFor DELETE
  • deliveries list takes --status (pending, running, succeeded, dead or cancelled), --destination <id> and --session <id>. sessions list takes --project <id> and --status (active, ended or abandoned).
  • deliveries list, sessions list and audit are paged. Add --limit <n> and --cursor <cursor> to page by hand, or --all to follow every page and get one merged answer.
  • integrations update takes --paused true|false, --url and --events for a webhook; --team-id, --team-name, --label-ids and --linear-project-id for Linear; and --repo and --labels for GitHub.
  • integrations add-github takes the GitHub token as --github-token, so it never gets mixed up with your Showbug token (--token, SHOWBUG_TOKEN or login).
  • Commands that create something send an Idempotency-Key, a new one each time. Pass your own with --idempotency-key.

api calls any endpoint. Paths are under /api/v1, and {org} becomes your organisation’s id. --data takes JSON, @file to read a file, or - to read standard input.

showbug api GET '/orgs/{org}/projects'
showbug api POST '/orgs/{org}/projects' --data '{"name": "Docs site"}'

Output and exit codes

  • For people. A list prints as a table and one thing prints as name: value lines. Any token in the output shows as sbp_… and its last four characters, so a token does not end up in a terminal log.
  • --json prints the API’s JSON answer on one line to standard output. Errors then go to standard error as JSON. A delete that has no body prints {"ok":true}.
  • Retries. Reads, deletes and creates are tried again, up to three times, after a network error, 429, 502, 503 or 504, waiting as long as Retry-After says. Other changes, such as an update, are not retried, because they could be applied twice.

For example, showbug projects list prints:

ID     NAME            STATUS  ORIGINS
prj_…  Marketing site  active  https://www.example.com
prj_…  Docs site       active  -

With --json, a failure looks like this on standard error:

{"error":{"code":"not_found","message":"Not found, or you do not have access to it.","status":404}}

The exit code says what kind of failure it was:

CodeMeaning
0Success.
1The API answered with an error other than 401 or 403, or you answered no to a confirmation.
2Usage error: an unknown command, a missing argument or flag, or a destructive command run without a terminal and without --yes.
3Authentication: there is no token, or the API answered 401 or 403. That includes a token without the scope the command needs.
4Network error: the API could not be reached.

Scripting

Use --json in scripts and read the answer with jq. The JSON is the same as the REST API’s, so the field names on the REST API page apply.

showbug projects list --json | jq -r '.projects[] | [.id, .name] | @tsv'

Retry every failed delivery of a project:

showbug deliveries list "$PROJECT" --status dead --all --json \
  | jq -r '.deliveries[].id' \
  | while read -r id; do
      showbug deliveries retry "$PROJECT" "$id" --json
    done

Act on the exit code, and read the error from standard error:

showbug projects get "$PROJECT" --json > project.json 2> error.json
status=$?
if [ "$status" -eq 3 ]; then
  echo "The token is missing, expired or not allowed to do this." >&2
elif [ "$status" -ne 0 ]; then
  jq -r '.error.code' error.json >&2
fi
exit "$status"

A CI job that creates a project for each pull request and prints its key. The token needs only projects:write, and a new project comes with its first key, so no other call is needed. The idempotency key means that re-running the job returns the same project instead of making another.

name: Preview
on: pull_request

jobs:
  showbug:
    runs-on: ubuntu-latest
    steps:
      - name: Create a Showbug project for this pull request
        env:
          SHOWBUG_TOKEN: ${{ secrets.SHOWBUG_TOKEN }}
        run: |
          npm install --global @showbug/cli
          key=$(showbug projects create "PR ${{ github.event.number }}" \
            --origin "https://pr-${{ github.event.number }}.preview.example.com" \
            --idempotency-key "preview-${{ github.run_id }}" \
            --json | jq -r '.keys[0].publicKey')
          echo "Showbug key: $key"
          echo "SHOWBUG_KEY=$key" >> "$GITHUB_ENV"

Destructive commands

A command that deletes or revokes something asks before it runs: keys revoke, origins remove, integrations remove, integrations rotate-secret, members remove, invites revoke, and api with DELETE. --help on a command says if it does.

  • In a terminal, the command says what it will do and waits for y. Any other answer cancels it, nothing changes, and the exit code is 1.
  • Without a terminal, in a script, a CI job or an agent, it refuses to run and exits with code 2 unless you pass --yes (or -y).
showbug keys revoke "$PROJECT" "$KEY" --yes

Only pass --yes when the ids come from somewhere you trust. Give a token that an agent uses only the write scopes its task needs, so a wrong command is refused by the API as well.