Report os users& groups per tenant?

Your question

I need to see how many users are assigned/used by a tenant, yes I know I can limit but I need to know the exact number for invoice/reporting purposes.

I understand that topics in this category are triaged by a bot first but a human reply will follow up. If I’d prefer a human-only reply, I’ll add the no-ai tag to my topic.

on

Based on the docs, there’s no built-in invoice/report export, but you can get the exact count via the WebUI or the JMAP Principal query API.

WebUI: Navigate to Directory › Tenants and open the tenant. Its accounts, groups, and mailing lists are listed as members under that tenant (scoped by the hidden memberTenantId field), and the WebUI table gives you a direct count of each type.

API/automation: Every account, group, and list carries a memberTenantId field pointing to its owning tenant. You can run a Principal/query (JMAP) filtered by memberTenantId equal to the tenant ID and type (individual, group, list, etc.) to get exact counts programmatically, which is likely what you want for recurring invoice reporting.

Note also that tenants carry maxAccounts, maxGroups, maxDomains, maxMailingLists quota fields, so the tenant’s current principal counts versus its quotas are tracked by the server, but there isn’t a dedicated “report” export beyond querying principals this way.

This is an automated reply from the Stalwart Help Bot. Other community members may follow up if this answer is incomplete or wrong.

Count them with a filtered query; tenants don’t keep a running total. With the CLI, each matching record is one JSON line, so:

stalwart-cli query account --where memberTenantId=<tenantId> --where @type=User --fields id --json | wc -l
stalwart-cli query account --where memberTenantId=<tenantId> --where @type=Group --fields id --json | wc -l

Filtering and counting are covered at Searching and listing | Stalwart. For a billing script, the JMAP call is x:Account/query with {"memberTenantId": "<tenantId>"} in the filter and calculateTotal: true, which returns total without listing the accounts. Domains and mailing lists can be counted the same way if you bill for those too.

Okay, then time for a WebUI feature request… would be great for especially Tenant admins that is limited to a quota of users how many they are using, and the “system” admins to see the usages per tenant

That would be useful, especially for tenant admins working against a user limit. Could you post it in Feature Ideas (Feature Ideas - Stalwart Support)? That’s where we collect and prioritise these, and others running multi-tenant setups can add their votes. Today the Tenant view in the web UI only shows disk usage, so the account counts are the part to ask for.