Overview
stalwart-cli is a small, schema-driven command line tool for administering a Stalwart Mail and Collaboration server. It speaks exclusively to the JMAP API and operates on the management/configuration objects (those whose JMAP type names are prefixed with xstalwart:jmap capability.
Exploring the schema
The describe command introspects the schema downloaded from the server and prints, in human-readable form, what objects exist, what fields and variants each one has, what enums are defined, and which list-level filters and sort options are supported.
Fetching a single object
The get command retrieves one object by id (or a singleton) and renders it in human-readable form by default, or as JSON with --json.
Searching and listing
The query command lists objects of a given type, with optional filters and a choice of columns. Results are paginated automatically and can be emitted as a human-friendly table or as an NDJSON stream.
Creating objects
The create command creates a single object from one of four input sources. Validation is intentionally minimal (the server is the source of truth); the CLI only checks that field names exist on the schema and that values are of the right shape.
Updating objects
The update command applies a JMAP patch to one object (or a singleton). The patch shape mirrors JMAP's Foo/set update argument: only the changed fields are sent.
Removing objects
The delete command destroys one or more objects by id. Singletons cannot be destroyed (they can only be updated; see Updating objects).
Declarative bulk operations
The apply command takes an NDJSON file describing a batch of create, update, and destroy operations, and applies them to the server in dependency-aware order. It is intended as the integration surface for infrastructure-as-code tooling (Ansible, Terraform, NixOS, Pulumi, ...) and for one-shot deployments / migrations performed by hand or by CI.
Exporting server state
The snapshot command walks the live server and emits an NDJSON plan in the exact format that apply consumes. The same file can be used for: