Skip to content

Advanced usage

The CLI in CI, in scripts, and when something is going wrong.

Everything here is the CLI doing work you would otherwise do by hand: proving a deploy is healthy, producing a report, or telling you which of seven possible things is broken.

In a pipeline

There is no browser in CI, so the key comes from the environment. Every command reads WAJUB_API_KEY, and when it is set it wins over any profile, --profile included.

A smoke test after deploy
#!/usr/bin/env bash
set -euo pipefail

export WAJUB_API_KEY="$WAJUB_SANDBOX_KEY"   # from your CI secret store

# Fail the job if the key, the network or the account is wrong
wajub doctor --json > doctor.json

# Fail the job if the webhook endpoint disappeared
wajub webhooks list --json \
  | jq -e '.items[] | select(.url == "https://example.com/webhooks/wajub")' > /dev/null

--json on every command makes the output parseable, and jq -e turns "no match" into a non zero exit status, which is what makes the step actually fail.

Exit codes and runs without a terminal

A step fails on the exit status, so here is what the CLI returns.

StatusWhen
0The command did what it was asked
1Anything that failed: an API error, a wajub doctor check, a confirmation that could not be asked, and a wajub trigger whose scenario did not end as promised. trigger waits up to 30 seconds for the sandbox to settle the payment or refund before it gives up
127The command does not exist, as a shell's "command not found". The CLI suggests the closest one and never runs it for you

A pipeline has no terminal, so the CLI cannot ask anything there. A command that would ask for confirmation (a deletion, a payment, transfer or refund with a live key, wajub logout) fails with status 1 unless you pass --yes. wajub skills install needs --scope. A hidden prompt for a key (wajub config set, wajub login --manual) fails too: set WAJUB_API_KEY instead.

Reports from the terminal

The list commands plus jq replace a lot of small scripts.

Two reports worth having
# Yesterday's failures, with the reason
wajub payments list --status failed -f date_from=2026-01-14 -f date_to=2026-01-14 -f per_page=100 --json \
  | jq -r '.items[] | [.created_at, .id, .amount, .currency, .failure_reason] | @tsv'

# Payouts still not settled
wajub transfers list --status processing --json \
  | jq -r '.items[] | [.id, .amount, .currency, .created_at] | @tsv'

--since and --until are not read by the API, so the dates go through -f date_from and -f date_to, which only payments, refunds and disputes accept. They are whole calendar days: for a shorter window, filter the timestamps in jq after listing the day.

Environment variables

Every variable below applies to every command, and a flag on the command line still wins over it, except for the key.

VariableEffect
WAJUB_API_KEYThe key to use. Wins over every profile, --profile included
WAJUB_PROFILEThe profile to use when no --profile is given
WAJUB_MAX_RETRIESHow many times a failed request is retried. 2 by default, 0 turns retries off
WAJUB_TIMEOUT_MSHow long a request may take, in milliseconds, before it fails with Network Error
WAJUB_NO_SKILLS1 stops the CLI installing Agent Skills on its own
WAJUB_NO_LOGO1 hides the Wajub logo above wajub, wajub help, wajub version and wajub doctor. It never shows in a pipe or with --json anyway

Shell completion

Install completion for your shell
wajub completion install

TAB then completes commands, flags and their values: the statuses --status accepts on each list command, event types and payment.* wildcards for wajub listen --events (one after the other, comma-separated), wajub trigger events, your profiles for --profile and wajub config use, and API paths for wajub get, post and delete. It works in bash (3.2 and later, the one macOS ships included), zsh, fish and PowerShell.

The command detects your shell, or takes --shell bash|zsh|fish|powershell. It adds one block, between # >>> wajub completion >>> markers, to ~/.zshrc, ~/.bashrc (~/.bash_profile on macOS) or $PROFILE; for fish it writes ~/.config/fish/completions/wajub.fish. Open a new terminal, and that is all: the scripts are regenerated by the first command after each upgrade, so completion always matches the version installed.

Check or remove it
wajub completion            # which shells have it, and where
wajub completion zsh        # the lines to add yourself, if you keep your dotfiles by hand
wajub completion uninstall  # removes the block, the fish file and the scripts

Before 1.7, wajub autocomplete set completion up differently. Those setups keep working after the upgrade, now with the new completion; wajub completion install replaces their line in your startup file.

Starting from a working example

wajub samples
$ wajub samples --list

Available samples:
  webhooks               Minimal webhook receiver with signature verification (Node.js, no dependencies)

$ wajub samples webhooks my-receiver

The webhook sample is deliberately dependency free, so you can read the whole verification in one file rather than through a framework.

Jumping to the Dashboard

wajub open
wajub open              # the dashboard home
wajub open payments
wajub open keys

The pages it knows are balance, customers, dashboard, disputes, keys, payments, refunds, settings, transfers and webhooks.

When something is wrong

Three commands, in increasing order of how much they tell you.

From cheapest to most thorough
$ wajub version
@wajub/cli/1.7.3 darwin-arm64 node-v22.11.0

$ wajub status
● Wajub API is reachable, https://api.wajub.com (HTTP 200)

$ wajub doctor
Wajub CLI diagnostics
  …seven checks, in order

status answers "is it them or me" and needs no credentials. doctor answers "which of my seven things is broken" and ends with a request id to hand to support.

SymptomLikely check
401 on every commandCredentials, and the source field beside it
Commands hit the wrong accountsource=env, a WAJUB_API_KEY left exported
A command does not existwajub help, and remember topics use a space
Nothing arrives in wajub listenCredentials, and whether the profile is sandbox or live
A stack trace on startupNode version, 22 is the minimum

An unknown command fails clearly rather than doing something surprising.

A typo does not guess
$ wajub payment

 ›   Error: "payment" is not a wajub command. Run `wajub help` for the list.

Telling us what is missing

wajub feedback
wajub feedback

It opens the feedback form in your browser. Pair it with the request id from wajub doctor and the first two messages of a support thread are already answered.

What did you think of this content?