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 whoaminpx @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 --versionThe 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 whoamishowbug 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:00ZIn 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 loginTo use another environment, add its address when you log in. It is saved with the token:
showbug login --api-url https://preprod-api.showbugai.comshowbug logout deletes the saved token.
| Setting | Flag | Environment variable | Default |
|---|---|---|---|
| API token | --token | SHOWBUG_TOKEN | The token saved by login |
| API address | --api-url | SHOWBUG_API_URL | https://api.showbugai.com |
| Organisation id | --org | SHOWBUG_ORG | The 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
| Command | What it does | Scope | Asks first |
|---|---|---|---|
login | Check an API token and save it. | Any token | |
logout | Delete the saved token. | None | |
whoami | Show the user, organisation, scopes and expiry of the token. | Any token |
Organisation, members and audit log
| Command | What it does | Scope | Asks first |
|---|---|---|---|
org get | Show the organisation. | org:read | |
org rename <name> | Rename the organisation. | org:write | |
members list | List 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:write | Yes |
invites list | List 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:write | Yes |
audit | Show the audit log, newest first. | audit:read |
Projects, origins and keys
| Command | What it does | Scope | Asks first |
|---|---|---|---|
projects list | List 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:write | Yes |
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:write | Yes |
Integrations and deliveries
| Command | What it does | Scope | Asks 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:write | Yes |
integrations remove <project> <integration> | Remove an integration and cancel its pending deliveries. | integrations:write | Yes |
deliveries list <project> [flags] | List deliveries, newest first. | integrations:read | |
deliveries retry <project> <delivery> | Queue a failed delivery again. | integrations:write |
Sessions
| Command | What it does | Scope | Asks 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
| Command | What it does | Scope | Asks first |
|---|---|---|---|
api <method> <path> [--data <json>] | Call any endpoint of the REST API. | What the endpoint needs | For DELETE |
deliveries listtakes--status(pending, running, succeeded, dead or cancelled),--destination <id>and--session <id>.sessions listtakes--project <id>and--status(active, ended or abandoned).deliveries list,sessions listandauditare paged. Add--limit <n>and--cursor <cursor>to page by hand, or--allto follow every page and get one merged answer.integrations updatetakes--paused true|false,--urland--eventsfor a webhook;--team-id,--team-name,--label-idsand--linear-project-idfor Linear; and--repoand--labelsfor GitHub.integrations add-githubtakes the GitHub token as--github-token, so it never gets mixed up with your Showbug token (--token,SHOWBUG_TOKENorlogin).- 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: valuelines. Any token in the output shows assbp_…and its last four characters, so a token does not end up in a terminal log. --jsonprints 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,503or504, waiting as long asRetry-Aftersays. 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:
| Code | Meaning |
|---|---|
0 | Success. |
1 | The API answered with an error other than 401 or 403, or you answered no to a confirmation. |
2 | Usage error: an unknown command, a missing argument or flag, or a destructive command run without a terminal and without --yes. |
3 | Authentication: there is no token, or the API answered 401 or 403. That includes a token without the scope the command needs. |
4 | Network 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
doneAct 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" --yesOnly 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.