A schema-driven command line tool and interactive console for administering Stalwart Mail and Collaboration Server over its JMAP API.
The tool fetches the server's schema on first use and derives every command, validation rule, form and rendered view from it. The same binary works against any compatible Stalwart deployment without recompilation.
stalwart-cli / tui |
Open the interactive console: browse and edit every object, watch the dashboard, follow live traces, run actions, apply plans. |
describe |
Inspect objects, fields, enums, filters, and sort options exposed by the server. |
get / query |
Fetch a single object or list / filter many. |
create / update / delete |
Single-object mutations. |
apply |
Apply an NDJSON plan of creates, updates, upserts, reconciles, and destroys (intended for Ansible, Terraform, NixOS, Pulumi, and CI/CD pipelines). |
snapshot |
Export live server state as an apply-ready plan. Useful for backups, cross-environment promotion, and round-trip disaster-recovery rehearsals. |
logout |
Revoke and forget the stored sign-in for a server. |
Command output is human-friendly by default (sectioned, with colour when the stream is a terminal) and switches to compact JSON or NDJSON with --json.
# macOS / Linux
curl --proto '=https' --tlsv1.2 -LsSf \
https://github.com/stalwartlabs/cli/releases/latest/download/stalwart-cli-installer.sh | sh
# Homebrew
brew install stalwartlabs/tap/stalwart-cli
# Windows
powershell -ExecutionPolicy Bypass -c "irm https://github.com/stalwartlabs/cli/releases/latest/download/stalwart-cli-installer.ps1 | iex"
# npm
npm install -g stalwart-cli
# From source
cargo install --path .A signed .msi is also published with each release.
A multi-arch image (linux/amd64, linux/arm64) is published with every release to both registries:
docker run --rm ghcr.io/stalwartlabs/cli --help
docker run --rm stalwartlabs/cli --help
docker run --rm \
-e STALWART_URL=https://mail.example.com \
-e STALWART_TOKEN \
ghcr.io/stalwartlabs/cli query Account --fields id,nameTags track releases (:2.0.0, :2.0, :latest). Images are signed with cosign and carry build-provenance attestations.
apply --file and snapshot --output need a mounted working directory, and a persistent schema cache avoids a re-fetch on every run:
docker run --rm \
-v "$PWD:/work" -w /work \
-v stalwart-cli-cache:/home/nonroot/.cache \
-e STALWART_URL -e STALWART_TOKEN \
ghcr.io/stalwartlabs/cli apply --file plan.ndjsonThe interactive console needs a terminal (-it), and a volume at /home/nonroot/.local/share keeps the device sign-in across runs:
docker run --rm -it \
-v stalwart-cli-cache:/home/nonroot/.cache \
-v stalwart-cli-data:/home/nonroot/.local/share \
-e STALWART_URL \
ghcr.io/stalwartlabs/cliRun stalwart-cli without arguments in a terminal (or stalwart-cli tui) to open a full-screen console with the same navigation, forms and dashboards as the web administration interface:
- Browse, filter, sort and edit any object, with field help and a review of every change before it is saved.
- Mark objects and act on them in bulk: delete, or run the bulk actions the schema defines.
- Jump to any view, object or setting with
:, and see the keys of every screen with?. - Watch the dashboard, follow live tracing, run delivery tests and server actions.
- Apply plans and take snapshots without leaving the console.
- Four colour themes (
--theme dark|light|ansi16|mono,Ctrl+Tto cycle).
stalwart-cli --url https://mail.example.comThere are three ways to authenticate. At a terminal, the OAuth device sign-in is the default when no credential is given and the server supports it: the CLI prints a code to approve in a browser, then stores a session that later commands reuse.
export STALWART_URL=https://mail.example.com
# Device sign-in (stored and refreshed automatically; `stalwart-cli logout` to forget it)
stalwart-cli describe
# API key, for scripts and CI
export STALWART_TOKEN='API_<key>'
# Or user and password
export STALWART_USER=admin
export STALWART_PASSWORD='changeme'Common commands:
stalwart-cli describe # list every available object
stalwart-cli describe domain # full schema for one object
stalwart-cli query domain # default columns
stalwart-cli get domain <id> # full object
stalwart-cli create domain --field name=example.com --field isEnabled=true
stalwart-cli update domain <id> --field description='Primary'
stalwart-cli delete domain --ids <id>
stalwart-cli apply --file plan.ndjson # bulk apply
stalwart-cli snapshot Tenant Domain --output backup.ndjson # export state as an apply planFull documentation, including the interactive console, sign-in options, the plan file format, and integration guides for Ansible / Terraform / NixOS / Pulumi / CI:
This project is dual-licensed under the GNU Affero General Public License v3.0 (AGPL-3.0; as published by the Free Software Foundation) OR the Stalwart Enterprise License 3.0 (SELv3):
- The GNU Affero General Public License v3.0 is a free software license that ensures your freedom to use, modify, and distribute the software, with the condition that any modified versions of the software must also be distributed under the same license.
- The Stalwart Enterprise License 3.0 (SELv3) is a proprietary license designed for commercial use. It offers additional features and greater flexibility for businesses that do not wish to comply with the AGPL-3.0 license requirements.
Each file in this project contains a license notice at the top, indicating the applicable license(s). The license notice follows the REUSE guidelines to ensure clarity and consistency. The full text of each license is available in the LICENSES directory.
Copyright (C) 2020, Stalwart Labs LLC