# List only users with stalwart-cli

**URL:** https://support.stalw.art/t/list-only-users-with-stalwart-cli/255
**Category:** Questions
**Created:** [May 18, 2026, 11:13am UTC](https://support.stalw.art/t/list-only-users-with-stalwart-cli/255 "2026-05-18T11:13:34Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![andreim](https://support.stalw.art/letter_avatar_proxy/v4/letter/a/c2a13f/32.png) [@andreim](https://support.stalw.art/u/andreim)
#### Post date: [May 18, 2026, 11:13am UTC](https://support.stalw.art/t/list-only-users-with-stalwart-cli/255/1 "2026-05-18T11:13:34Z")

</div>

### Your question

Hi,

I’m trying to create a dynamically mailing list with all the users from the servers. In order to do this I’m thinking to create a script which is listing the users with stalwart-cli and updating the mailing list.  
I couldn’t found out how to filter only users in Account query. Is it possible?

Thanks,  
Andrei

---

<div class="post-metadata">

### Author: ![helpbot](https://support.stalw.art/user_avatar/support.stalw.art/helpbot/32/13_2.png) [@helpbot](https://support.stalw.art/u/helpbot)
#### Post date: [May 18, 2026, 11:14am UTC](https://support.stalw.art/t/list-only-users-with-stalwart-cli/255/2 "2026-05-18T11:14:03Z")

</div>

Let me look up the CLI account commands and how filtering works.

Based on the docs, the `x:Account/query` filter does **not** expose a `type` or `role` condition directly - the supported filter conditions are only `text`, `name`, `domainId`, `memberTenantId`, and `memberGroupIds`. There is no `--where type=User` equivalent in the CLI query for accounts.

However, there are two practical workarounds:

**Option 1: Use `stalwart-cli describe Account` to confirm available filters**

Run this first to see exactly what filter keys your version exposes:

```sh
stalwart-cli describe Account

```

Look at the `Filters:` section output. If a `type`/`variant` filter isn’t listed, you’ll need the approach below.

**Option 2: Post-filter with `jq` on the `roles` field**

Since accounts are created with `"roles": {"@type": "User"}` (vs `"@type": "Admin"` or `"@type": "Group"`), you can fetch all accounts with `--json` and filter in `jq`:

```sh
stalwart-cli query Account --fields id,name,roles --json \
  | jq -r 'select(.roles["@type"] == "User") | .name'

```

This streams all accounts and keeps only those whose `roles` variant is `User`, which you can then pipe into your mailing list update script.

**Option 3: Use `memberGroupIds` filter (if users share a group)**

If all regular users are members of a specific group, you can filter by that:

```sh
stalwart-cli query Account --where memberGroupIds=<group-id> --json

```

The query docs are at: [Searching and listing | Stalwart](https://stalw.art/docs/management/cli/query) and the Account object reference (including all supported filter conditions) is at: [Account | Stalwart](https://stalw.art/docs/ref/object/account)

_This is an automated reply from the Stalwart Help Bot. Other community members may follow up if this answer is incomplete or wrong. If you found it useful, mention `@helpbot` in any reply to ask follow-up questions and the bot will respond again._

---

<div class="post-metadata">

### Author: ![andreim](https://support.stalw.art/letter_avatar_proxy/v4/letter/a/c2a13f/32.png) [@andreim](https://support.stalw.art/u/andreim)
#### Post date: [May 19, 2026, 5:45am UTC](https://support.stalw.art/t/list-only-users-with-stalwart-cli/255/3 "2026-05-19T05:45:49Z")

</div>

> [@helpbot](#):
>
> ```auto
> stalwart-cli query Account --fields id,name,roles --json \
> | jq -r 'select(.roles["@type"] == "User") | .name'
> 
> ```

Thanks helpbot.

It is working.

---

<div class="post-metadata">

### Author: ![jmw](https://support.stalw.art/letter_avatar_proxy/v4/letter/j/ac8455/32.png) [@jmw](https://support.stalw.art/u/jmw)
#### Post date: [August 19, 2026, 12:14pm UTC](https://support.stalw.art/t/list-only-users-with-stalwart-cli/255/4 "2026-08-19T12:14:42Z")

</div>

Just to follow up on this, while it is not documented as a filter when running `describe Account`, you can actually use `--where @type=User` and it works.

In case the dev reads this and views it as undocumented behaviour, please don’t remove it, it’s fantastically useful and saves a lot of inefficient post filtering work. In general I wish there were more filters, for example to find a `User` by their email address I can’t filter with `--where emailAddress=...` because I get the error:

`error: jmap error: unsupportedFilter: Filter on property emailAddress is not supported or invalid`

Instead I need to first find the `Domain` with a query and then query `Account` with `--where name=... --where DomainId=... --where @type=User`. It’s a multistep process for a simple query. If I couldn’t also filter by `@type` that would mean another step to remove Groups.
