Skip to main content

CLI reference

openbucket is a dependency-free command-line client over the admin JSON API: bucket and key management, backup/restore, and replication status. It ships in the @openbucket/nestjs package, credentials never touch argv, and every error path is redacted before it reaches stderr — safe to script.

# List buckets on a running instance (log in with a prompted password):
npx openbucket buckets ls --endpoint http://localhost:9000 --username admin

The password is read from $OPENBUCKET_PASSWORD or an interactive non-echoing prompt — never a flag. Set $OPENBUCKET_TOKEN to reuse a bearer token and skip login entirely.

Default endpoint

--endpoint defaults to http://127.0.0.1:3900 (the dev-serve port). For a standalone Docker instance, pass --endpoint http://127.0.0.1:9000 or set $OPENBUCKET_ENDPOINT.

Global options

FlagEnvNotes
--endpoint <url>OPENBUCKET_ENDPOINTAdmin endpoint. Default http://127.0.0.1:3900.
--username <u>OPENBUCKET_USERNAMEAdmin username.
--jsonMachine-readable JSON output.
--quietSuppress notices; emit only the essential datum.
--insecureAllow credentials over non-loopback plaintext http.
-h, --helpShow usage.
--versionPrint the version.

Credentials env vars: $OPENBUCKET_PASSWORD (or a prompt) supplies the password; $OPENBUCKET_TOKEN supplies a bearer token to skip login. Set OPENBUCKET_DEBUG=1 for a redacted stack trace on failure.

Commands

buckets

CommandArgumentsDescription
buckets lsList buckets (name, versioning, object-lock, count, size, created).
buckets mb <name>[--versioning enabled|disabled] [--object-lock] [--region <r>]Create a bucket. Name validated client-side; --versioning defaults to disabled, --region to us-east-1.
buckets rb <name>Remove an empty bucket (409 if not empty).
openbucket buckets mb photos --versioning enabled --object-lock
openbucket buckets ls --json

keys

CommandArgumentsDescription
keys listList access keys (id, access-key-id, label, role, disabled, scope, last-used).
keys create--label <l> [--scope prefix:<bucket>/<prefix>]Mint an access key. The secretAccessKey is printed once as data on stdout.
keys revoke <id>Disable (reversibly) an access key.
openbucket keys create --label tenant-42 --scope prefix:uploads/tenant-42/
The secret is shown once

keys create prints secretAccessKey exactly once — capture it immediately. Under --json the whole created-key DTO is emitted so it can be captured machine-readably.

backup

CommandArgumentsDescription
backup create[--bucket <b>] [-o, --output <file.zip>] [--force]Download a .zip snapshot — whole-instance, or one bucket with --bucket. Default filename is timestamped. --force overwrites an existing file.
backup restore-f, --file <file.zip> [--bucket <b>] --yesRestore from a snapshot. Resets the target — gated behind explicit --yes.
openbucket backup create -o nightly.zip
openbucket backup restore -f nightly.zip --yes
Restore resets the target

backup restore resets the instance (or the named bucket) before restoring. It issues no request at all — not even a login — unless you pass --yes.

replication

CommandArgumentsDescription
replication statusShow replication health: enabled, pending/inflight/failed depth, oldest-pending age, last error, and a per-bucket breakdown. Never surfaces a remote endpoint or credential. Exits 0 even when replication is disabled.
openbucket replication status --quiet # prints "enabled" or "disabled"

Exit codes

CodeMeaning
0Success.
1Generic / runtime error.
2Bad arguments or unknown command (usage error).
3Authentication failed (401 — invalid credentials).
4Rate limited (429; the CLI does not auto-retry).

Next steps