What is it?
The mailbox CLI (mailbox) is a small, self-contained command line
tool for the mailbox API (api.mailbox.org). It is a single binary without
any runtime dependencies, available for Linux, macOS and Windows. It
authenticates with a static API key that you create in the mailbox console.
Installation
The install script detects your operating system and architecture, verifies
the checksum and places the binary on your PATH.
Linux / macOS (installs to /usr/local/bin, or
~/.local/bin if that is not writable; override with
MAILBOX_INSTALL_DIR):
curl -fsSL https://api.mailbox.org/v1/cli/install.sh | sh
Windows (PowerShell) (installs to
%LOCALAPPDATA%\Programs\mailbox and adds it to your user
PATH; open a new shell afterwards):
irm https://api.mailbox.org/v1/cli/install.ps1 | iex
Alternatively, download the binary for your platform directly from
https://api.mailbox.org/v1/cli/latest/:
- Linux (x86_64):
mailbox-linux-amd64 - Linux (ARM64):
mailbox-linux-arm64 - macOS (Intel):
mailbox-darwin-amd64 - macOS (Apple Silicon):
mailbox-darwin-arm64 - Windows (x86_64):
mailbox-windows-amd64.exe - SHA-256 checksums:
checksums.txt
Keep the original file name until the checksum is verified, then rename it. Example for Linux (x86_64):
curl -fLO https://api.mailbox.org/v1/cli/latest/mailbox-linux-amd64
curl -fLO https://api.mailbox.org/v1/cli/latest/checksums.txt
sha256sum --ignore-missing -c checksums.txt # must print "mailbox-linux-amd64: OK"
mv mailbox-linux-amd64 mailbox && chmod +x mailbox
./mailbox --help
On macOS, verify with shasum -a 256 --ignore-missing -c checksums.txt.
On Windows (PowerShell), compare the output of
(Get-FileHash .\mailbox-windows-amd64.exe -Algorithm SHA256).Hash
with the matching line in checksums.txt.
Every release is also available pinned to a specific version, e.g.
https://api.mailbox.org/v1/cli/1.2.3/mailbox-linux-amd64, in addition to
latest.
Set up the API key
In the mailbox console, open API access and create a new API key. Keep the page open: the complete key is shown only once. The public key ID shown in the key list is not sufficient for the import.
First start the import in your terminal:
mailbox token importThe client shows the API endpoint and the local storage location.
Only now copy the key in the mailbox console. (If you copied the key first, copying the command above would replace it in your clipboard.)
Paste the key at the prompt and press Enter. No characters are displayed while you paste. No clipboard tools,
echo, prepared key file or Ctrl+D are needed.
If the format is invalid, the client explains the problem and asks again. Ctrl+C cancels without changing an already stored key.
A successful import only confirms the format and the local storage. It does not confirm that the key is valid on the server, its expiry, owner or permissions. These are checked with every API call, for example:
mailbox hello innerworld
Error 493 means that authentication with the API key failed (key
deleted, expired or unknown). Check the key in the mailbox console and, if
necessary, create and import a new one.
Replacing and managing keys
Run
mailbox token importagain to store a new key. If a key is already stored, the client asks for confirmation;--replaceskips this question, as does the global--yesin interactive mode.Replacing a key locally does not revoke the old key. Verify the new key with an API call first, then delete the old key in the mailbox console. Other applications using the old key lose access as well.
mailbox statusandmailbox whoamionly show whether a key is stored locally and its public key ID. They do not prove identity or validity.mailbox tokenandmailbox token --out FILEexport the secret explicitly. Do not put it into logs, tickets or your shell history.One key is stored per configuration. Use separate configurations and stores for different owners or environments.
Keys do not rotate automatically.
Scripts and CI
The interactive prompt only appears in a terminal, without
--no-interaction and without an explicit key source. File and stdin
imports never prompt; an existing key is only replaced with
--replace (not with --yes alone). --stdin reads until
EOF and is meant for pipes and redirects:
mailbox token import --file ./customer.apikey
mailbox token import --stdin < ./customer.apikey
mailbox token import --file ./replacement.apikey --replace
A key can also be used directly without importing it, preferably from a protected file or stdin:
mailbox --token-file ./customer.apikey account:get <account>
cat ./customer.apikey | mailbox --token-stdin account:get <account>
MAILBOX_TOKEN_FILE=/run/secrets/mailbox-apikey mailbox domain:list <account>
MAILBOX_TOKEN and --token KEY work as well, but passing the
secret as an argument exposes it in the process list and shell history. Set
only one explicit source at a time. A set key source prevents the interactive
prompt; remove old overrides if necessary
(unset MAILBOX_TOKEN MAILBOX_TOKEN_FILE, PowerShell:
Remove-Item Env:MAILBOX_TOKEN, Env:MAILBOX_TOKEN_FILE -ErrorAction SilentlyContinue).
--no-interaction without an explicit source and redirected stdin
without --stdin fail with instructions instead of opening a
prompt.
Use separate keys for independent purposes so that they can be revoked separately.
Basic usage
mailbox hello innerworld # first authenticated API call
mailbox account:get <account>
mailbox domain:list <account>
mailbox call <method> --param k=v # generic JSON-RPC call
mailbox --help # list all available commands
mailbox <command> --help # help for a specific command
The client also supports shell auto-completion for bash, zsh and fish,
which is set up automatically on first interactive use (no network access
required; disable with MAILBOX_NO_COMPLETION_INSTALL=1). See
mailbox completion --help for details.
Uninstallation
Revoke keys you no longer need in the mailbox console. If a key is shared with other applications, consider the impact on them first.
Remove the locally stored key:
mailbox logoutmailbox logoutonly deletes the local store and does not contact the server. It does not revoke the key. External key files, environment secrets and other copies remain untouched.Remove the binary:
/usr/local/bin/mailboxor~/.local/bin/mailbox(or yourMAILBOX_INSTALL_DIR); on Windows%LOCALAPPDATA%\Programs\mailbox, and remove that folder from your userPATH. Also remove the optionalmbsymlink if you created one.Remove the shell completion files, if installed:
- bash:
~/.local/share/bash-completion/completions/mailbox - zsh:
~/.local/share/zsh/site-functions/_mailbox(and the line added to.zshrcbymailbox completion install zsh) - fish:
~/.config/fish/completions/mailbox.fish
- bash:
Remove local configuration you no longer need. The default store is
~/.config/mailbox/apikey(or$XDG_CONFIG_HOME/mailbox/apikey; on Windows%USERPROFILE%\.config\mailbox\apikey). Only delete configurations and stores that are not used for other owners or environments.
Privacy and security note
The client sends a User-Agent header of the form
mailbox-cli/<version> (<os>/<arch>) with every request. This
allows us to count aggregated usage numbers (total requests, active client
versions) on the server side. There is no "phone home" and no
installation ID; no further data is sent beyond what the API call itself
requires.
Treat API keys like passwords. The local store is a protected file
(0600 on Unix), not an encrypted vault.