Table of Contents

Administering a deployment

How the mfctl command reaches a running deployment, and what that deployment has to have enabled before it will answer.

MailFathom is administered over HTTP. The command never reads the service's configuration, never opens its database, and never touches its secret store — every operation it performs is a request to the administrative endpoint. That is what lets it run on your own machine, on Linux or Windows, against a deployment running somewhere else entirely.

The endpoint is off unless you turn it on

A deployment that configures nothing serves no administrative surface. Enabling it opens a listener of its own:

{
  "AdminEndpoint": {
    "Enabled": true,
    "BindAddress": "127.0.0.1",
    "Port": 8090,
    "Authentication": [
      { "Method": "password" },
      { "Method": "api-key" }
    ]
  }
}

The first start records the default administrator, admin, and an Authentication entry accepting password is what lets it sign in. Everybody else who administers the deployment is a user holding an administrative role — who administers the deployment says how one is admitted.

The listener is its own, and that is the point. Administrative routes answer on the administrative listener and nowhere else, and nothing else answers on it — a request for /mcp that arrives on the administrative port is refused before it reaches the protocol surface, and a request for /api/admin that arrives on the MCP port is refused before it reaches any credential check. Both are answered 404, because the honest answer is that nothing is served there. The one thing that also answers on this listener is the HTTP API document and the explorer, which belong to no surface and exist only in a Development process.

A port another listener in this process already binds fails startup naming the section, rather than failing later with an address-in-use error that names a socket.

Browser origins

AdminEndpoint:Cors:AllowedOrigins is the same setting the MCP and client endpoints carry, configured separately. Absent, it serves every browser origin — which is the default a first run and a local orchestration need. An operator who knows the origin they serve names it; an empty list advertises nothing to a browser, which is what a deployment whose only clients are command-line tools wants. The credential a caller presents is still what authenticates, on every posture.

Credentials do not cross surfaces

Every credential belongs to a user and lists the endpoints it may be presented on: mcp, client, and admin. A credential provisioned without naming any lists the two mail-serving endpoints and not this one, so admin is reached only by a credential somebody provisioned for it — mfctl credential create --surface admin — and a key handed to an agent to read a mailbox authenticates nothing here. A credential presented on an endpoint it does not list is answered 401, exactly as one nobody holds, so a probe learns nothing about which credentials exist. Reading a mailbox and administering the service that reads it are different authorities, and each endpoint also registers its own authentication schemes and its own authorization policy, which consults only its own schemes.

Each method is documented once, under the MCP endpoint: what a password and a key are, what a key pair is and what a client signs to present one, and what a token must prove. The difference here is the audience an assertion names — urn:mailfathom:admin rather than urn:mailfathom:mcp — which is what keeps an assertion minted to read a mailbox from administering the service even where one key pair is registered for both.

Who administers the deployment

An administrator is a user holding an administrative role. There is no second identity system: the people and systems that administer this deployment are users like the ones whose mail it reads, recorded on the roster, and what makes one of them an administrator is a role assignment whose role grants at least one name from the administrative half, listed by name or reached by a pattern. How a caller's grant is computed is the model; this surface reads the administrative half of it. A role is given with mfctl assignment add, described under roles, groups, and assignments; an assignment at the deployment scope is what an administrative question naming no target asks about:

$ mfctl role list
$ mfctl assignment add --role <the Administrator role's identifier> --user <the user's identifier> --deployment

A request is served when three things hold, in this order:

  1. A credential of a method the endpoint accepts resolves a user, and the credential lists admin among the endpoints it may be presented on. A credential lists it only where it was provisioned with mfctl credential create --surface admin — see user credentials.
  2. The request arrived from a network the credential accepts, where it names any — see where a credential may be presented from.
  3. The credential's user holds at least one administrative permission, at any scope, that the credential's own --permission list keeps where it names one. A credential narrowed to user-facing names alone, or to nothing, is therefore refused here however much its user holds.

A credential failing any of the three is answered 401, the answer a credential nobody holds gets, so a refusal says nothing about whether what was presented was good somewhere else. A user's mail endpoint switches do not decide this surface: they keep a user off the MCP and client endpoints, and the default administrator holds both off.

AdminEndpoint:Authentication names the methods the endpoint accepts, one entry per method, in the shape the MCP and client endpoints take — the MCP endpoint documents each method, its own block, and what startup refuses in an entry. password, api-key, public-key, and oauth-subject are all accepted here, and a password entry's Basic block bounds how often a password may be tried exactly as it does there. A password is accepted here and never asked for: a refused request carries the bearer challenge alone, never WWW-Authenticate: Basic, because a browser answers that challenge with a dialog and then attaches what was typed to every request it sends the origin, a cross-site form post included. A password a browser was prompted for on another surface sharing the origin — the MCP endpoint's, on the port every surface uses by default — can still arrive that way, so a password on a request a browser page made is refused here before it is read: one carrying an Origin header, which a browser sends on a cross-origin request over HTTP and HTTPS alike, or a Sec-Fetch-Site of cross-site or same-site. mfctl login --mode password composes the header itself and sends neither. The entries are this endpoint's own: a method accepted on the MCP endpoint is not thereby accepted here, even where both name one authorization server.

"Authentication": [
  { "Method": "password", "Basic": { "AttemptsPerMinute": 10 } },
  { "Method": "public-key" },
  {
    "Method": "oauth-subject",
    "PermissionsFromTokenScopes": true,
    "OAuth": {
      "Resource": "https://mail.example.test/api/admin",
      "AuthorizationServers": [
        { "Name": "workforce", "Issuer": "https://sso.example.test/realms/mailfathom" }
      ]
    }
  }
]

An oauth-subject entry names a Resource ending in /api/admin — the path these routes answer beneath. Startup refuses anything else, naming the setting. The reason is discovery rather than OAuth: mfctl is handed a host and a port and finds the metadata document by appending that prefix, which reaches the document's RFC 9728 location exactly when the resource names the same one. A deployment whose resource said something else would publish a document nothing could find, and OAuth sign-in would be unreachable for a reason no refusal would explain. Behind a reverse proxy, write the public URL and keep the path: https://mail.example.test/api/admin. Which person a token is is the issuer and subject an oauth-subject credential maps to a user, provisioned like any other credential; a token that validates and maps to no credential listing admin is answered 401, exactly as a token that did not validate.

An endpoint naming no method authenticates nobody, and serves every caller as the default administrator. That is the posture startup warns about, and the one the default administrator below exists to make safe to leave behind: write an entry, sign in, and the warning goes. Where the default administrator was removed, an endpoint naming no method serves nobody at all, and startup says so.

A configuration still carrying AdminEndpoint:Administrators stops the start, naming the setting and what replaces it: Authentication entries for the methods the endpoint accepts, and a credential listing admin for each user who administers the deployment, carrying the source networks the entry named. Nothing is imported from the section, because which user an entry was is the operator's to say.

The default administrator

The first start records a user named admin, in no organization, holding the seeded Administrator role at deployment scope, with both of its mail endpoint switches off so no MCP or client caller is ever admin. Its record states both switches off, so a later write of that record leaves them off and so does a settings policy that defaults one on; turning one on is a decision somebody takes, with mfctl user endpoints or by forcing it in a policy. It happens once per deployment, whichever replica starts first. Removing admin afterwards is final: no later start records it again, because a deployment whose operator removed the default account and then found it back with a known password would be worse off than one that never had it.

MAILFATHOM_ADMIN_PASSWORD gives it a password, once. The first start that finds the variable set while admin holds no password credential provisions one — signed in as admin, presented on this endpoint alone — and records that the setting was applied. Every later start ignores it, whatever happened to that credential since, so changing the variable changes nothing and no removed or disabled credential turns the next restart into a sign-in with the value the variable carries. mfctl credential rotate is how the password changes. It is an environment-only setting: a configuration file carrying it is not where it is read from.

  • The shipped value admin is exempt from the password policy's minimum, and nothing else is. A value printed in every deployment asset is public whatever its length, while any other value is one an operator chose: one the password policy refuses stops the start that would apply it, naming the variable and the rule it broke and never the value. Once the setting was applied, no value it carries stops a start.
  • Every start warns while admin still signs in with admin, until the password is rotated.
  • A password credential signed in as admin in no organization that belongs to another user stops the start that would apply the setting, because applying it would either fail or sign that user in as the administrator. Unset the variable and start, remove that credential and provision the user's password under another username, then set the variable again and restart. The same check comes first for a value the policy refuses: where admin already holds a password, nothing would be written, so the start goes on with a warning and the value is left unrecorded.

The Compose and Quadlet assets set the variable to admin, which is safe only while the administrative port stays on loopback; the Helm chart sets none and reads it from a Secret when one is named. A deployment that never sets it has an admin nobody can sign in as, which is the right shape where every administrator signs in with a credential of their own.

Startup records what it did, one line each:

info: The default administrator 'admin' was given the password MAILFATHOM_ADMIN_PASSWORD carried. Later starts ignore the
      setting; change the password with 'mfctl credential rotate'.
warn: The default administrator 'admin' still signs in with the password every copy of the deployment assets ships with.
      Change it with 'mfctl credential rotate'.

A start that stopped over the default administrator reports error code 14003 DefaultAdministratorUnusable.

Recovery is the database's, deliberately. An operator locked out of every administrative account deletes the user_credentials row holding admin's password, sets PasswordSettingAppliedAt on the one default_administrator row back to NULL, and restarts with MAILFATHOM_ADMIN_PASSWORD carrying a new value. No route does either half: anybody able to change those rows already holds the deployment's data, and a route that restored access would be one more way in. The stored schema describes the row.

A user holding the Administrator role reaches every administrative operation, and every one a later release adds: the role lists the pattern *, so its holders hold whatever the running release publishes. The grant is what bounds a caller here, so give each person or system a user of its own with a role holding what it does, and rotate its credentials like any other secret.

Weigh that against what the operations are. The endpoint serves reads — who a credential makes the caller, two records of what a mailbox has had done to it and what has been read from it, where semantic search stands, and what synchronization is doing — and writes that store a mailbox refresh token, start a provider bill, erase what a folder has stored, and change the deployment's own persisted configuration. An administrator holding every name can do all of them, so its credentials are as sensitive as the mailbox credentials it can place, the histories it can read, the spend it can begin, the mail it can dispose of, and the deployment it can redefine — the last of those reaching every other, since a configuration write can widen another credential's grant.

What a credential may do

A caller here holds its user's grant — what the roles assigned to the user grant, at the scope each assignment gives, the user-facing names among it held only as the ceiling a credential written here and a role given here are bounded by — and that grant holds on every credential the user presents here, narrowed by what the credential keeps. A credential's own --permission list may name names of both halves, and each surface reads the half it guards, so --permission mailfathom.admin.read makes a credential that reads this deployment's state and changes nothing; a credential naming no permission keeps whatever its user's roles grant. A token on an oauth-subject entry carrying PermissionsFromTokenScopes is kept to what its scopes carry as well, which is how a token minted to read the deployment cannot change it. The grant is read per request, so a revoked assignment reaches a signed-in administrator on their next command within the bound how a caller's grant is computed states. This surface's half of the published set is allocated so that the separations an operator would plausibly want to make are the ones they can: reading state, reading what was derived from mail, causing work, placing a credential, starting a bill, destroying what the deployment holds, and changing what the deployment itself is. What a credential may do states what each name reaches, which two permissions the twelve commands that read before they write need together, and how a grant is written; what the endpoint serves names the permission every route is published under.

GET /api/admin/session is the one route that requires none, which is what lets an administrator read who the deployment took them for and what they hold. mfctl status prints what that route reports, and is how an operator reads their own grant back. The caller is named by the user and the credential it presented, which is also how every administrative act, log scope, and audit record names it — a credential is what an operator revokes when the act was not the user's. Beside that, the route reports the user by identifier and display name, every role the user holds directly or through a group with the scope that assignment reaches — the deployment, or the organization or user it names by identifier — and what this request holds of them, which is those roles' administrative names narrowed by the credential presented:

'production' (https://mail.example.test:8443) accepts the stored credential as 'user 0198f0c4-… credential 41d7e2b0-…' (MailFathom 0.2.0).
Signed in as Alice Example (0198f0c4-…).
The user holds Administrator over the deployment, Auditor over organization 0199a1b2-….
It holds mailfathom.admin.read, mailfathom.admin.operate.

The roles say where each permission came from and the scope it was assigned at, before the credential narrows them; the lines after them are what this credential carries. A user holding no role is told so rather than shown an empty line.

A caller of an endpoint naming no method is named user <the default administrator> credential none.

The route reports the grant twice over, beside the user and the roles those two lines are printed from. permissions names what the caller holds over the whole deployment, which is what an operation naming no target asks for — the listings apart, which answer with what any scope covers. scopes names each scope the caller holds anything at — the deployment first, then each organization, then each user, by identifier — with the administrative names held there, and with any name held there that only the deployment scope grants listed apart under reachingNothing. Neither reports a user-facing name: this endpoint performs none, whatever the caller's roles list:

{
  "service": "MailFathom",
  "version": "0.2.0",
  "credential": "user 0198f0c4-… credential 41d7e2b0-…",
  "permissions": [],
  "scopes": [
    {
      "scope": "organization",
      "target": "0198f0aa-…",
      "permissions": ["mailfathom.admin.read", "mailfathom.admin.operate"],
      "reachingNothing": ["mailfathom.admin.spend"]
    }
  ],
  "user": { "id": "0198f0c4-…", "displayName": "Alice Example" },
  "roles": [{ "role": "Operator", "scope": "organization", "target": "0198f0aa-…" }]
}

mfctl status prints each scope narrower than the deployment on a line of its own. Those lines report what the caller is granted at each scope, and how far it acts: a name held only over an organization or a user reaches what that scope covers and nothing else. It admits the routes a grant below the deployment reaches for a target inside that scope, and the listings of users, of organizations, of mail accounts, of their synchronization status, of groups, and of role assignments, which answer with what that scope covers, beside the list of roles; it admits no other route that names no target, and each scope's line says so whatever the first line holds:

It holds no administrative permission over the whole deployment, so every operation is refused but this one, those naming something a scope below covers, and the listings, which answer with what such a scope covers.
Over organization 0198f0aa-… it is granted mailfathom.admin.read, mailfathom.admin.operate, which reaches only what that scope covers. mailfathom.admin.spend reaches nothing there, because only the deployment scope grants it.

Some operations are the deployment's alone, and a grant below the deployment never reaches them whatever else does: the configuration reads and writes under /api/admin/configuration, the embedding routes under /api/admin/embeddings, the loaded rules, the stopped jobs naming no account, the outbox's summary and listing, the content move and the release of what it left behind, creating and deleting an organization, changing its short name, and defining a role. What only the deployment scope grants lists them per permission.

Startup records what every Authentication entry admits, one line each:

info: MailFathom.Host.Hosting.Warnings.TransportGrantStartupReport
      The administrative endpoint entry AdminEndpoint:Authentication:0 accepts password from a credential listing the
      'admin' surface, and each caller it admits is that credential's user, holding what their administrative roles
      grant. A user holding none is refused. A route here is served only to a caller whose grant holds the one
      permission that route publishes, and every other caller is refused with that permission named.

Every line closes with what a grant on that surface does, which differs in what a refusal looks like rather than in whether the grant is enforced: the MCP endpoint answers a call naming a tool the grant omits as a tool that does not exist, and this one names the permission. An entry carrying PermissionsFromTokenScopes says each token is kept to the scopes it carries, and an endpoint naming no method says every caller acts as the default administrator admin.

The contact book needed no name of its own on this surface and is reachable from the other one under that surface's name — the contact book draws from both halves is why, and which of the administrative names each of its routes falls under.

What a refusal says

A caller the endpoint admitted and a route then refuses is answered 403 with a problem document, and that document names the one permission that would have sufficed and nothing else: no inventory of the other routes, nothing about which credential would have worked, and nothing about how this deployment is configured.

{
  "status": 403,
  "detail": "The credential is not granted 'mailfathom.admin.read'.",
  "permission": "mailfathom.admin.read"
}

The permission member carries the same name on its own, so a client reads what to grant instead of parsing the sentence. mfctl does exactly that, and reports it as the operator's next action rather than as a credential to replace:

The deployment refused the operation: this credential does not hold 'mailfathom.admin.read' at the deployment, either
because its user's roles do not grant it or because the credential's own permission list or its token's scopes leave
it out. Give the user an administrative role that holds it, provision a credential whose list keeps it, or sign in as
an administrator who already holds it.

A caller holding that permission only over an organization or a user is refused all the same wherever a route admits it only at the deployment scope — which is every route here but the routes a grant below the deployment reaches, and the acts behind those that are the deployment's alone — and the document says so, carrying heldBelowDeployment beside the name:

{
  "status": 403,
  "detail": "The credential holds 'mailfathom.admin.read' only over an organization or a user, and this operation is admitted only at the deployment scope.",
  "permission": "mailfathom.admin.read",
  "heldBelowDeployment": true
}

What is missing there is the scope rather than the name, so mfctl says that instead, and does not prescribe a deployment-wide role for somebody meant to administer one organization:

The deployment refused the operation: this credential holds 'mailfathom.admin.read' only over an organization or a
user, and the deployment admits this operation only at the deployment scope. Sign in as an administrator who holds it
there, or assign the user a role holding it at the deployment scope only if they should administer the whole
deployment.

Saying so discloses nothing about the deployment, because the answer is the same whatever target the request names, so it says nothing about whether that target exists.

A third document answers a write that would give somebody a role that lists a pattern, or place a credential for a user who holds one, reached by a caller who does not hold mailfathom.admin.roles.write over the whole deployment. It names that permission and carries widensOnUpgrade beside it:

{
  "status": 403,
  "detail": "A role this write gives, or signs somebody in with, lists a pattern, which comes to hold whatever a later release publishes in its reach. Only a credential holding 'mailfathom.admin.roles.write' over the whole deployment gives one.",
  "permission": "mailfathom.admin.roles.write",
  "widensOnUpgrade": true
}

The member is there because the name alone would mislead: the write may name one organization, and a caller holding mailfathom.admin.roles.write over that organization would read the refusal as a grant to go looking for. It carries no heldBelowDeployment, because the operation is not the deployment's alone — the same route gives a role of names at any scope its writer covers. mfctl reports the reason rather than the name:

The deployment refused the operation: a role this would give, or sign somebody in with, lists a pattern, which comes
to hold whatever a later release publishes in its reach, so only an administrator holding
'mailfathom.admin.roles.write' over the whole deployment gives one. Sign in as one, or have the role given by one;
holding 'mailfathom.admin.roles.write' over an organization or a user is not enough.

Naming the permission is a deliberate difference from the MCP surface, which discloses nothing to a refused caller. ADR 0012 records why: the caller here is an operator at their own terminal, and a refusal they can act on is worth more than a refusal that says nothing.

The transport is not the authority. Each route's use case asks for the same permission itself, so an entrypoint added later cannot widen the surface by forgetting a filter, and a use case's own refusal is answered in the shape above rather than reaching the caller as a fault in the deployment. A route mapped without deciding a permission is refused outright — nobody reaches it — so forgetting to decide costs a route rather than opening one.

Whichever of the two refused it, the deployment records it once: mailfathom.authorization.refusals counts it by surface, route, and the permission that was missing, and a warning beside it names the caller as the user and the credential it was admitted as. One operator reading one 403 is not a rate anybody can watch, and a credential that starts asking for what it was never granted is what the record exists to make visible. Telemetry says what it carries and what it deliberately does not.

A grant held below the deployment

A role assigned at an organization or at one user grants its administrative names over that part of the deployment alone. The routes listed below check the grant against the mail account, the user, the organization, the group, or the role assignment they name:

  • The deployment covers everything.
  • An organization covers itself, its members, its groups, and the mail accounts that belong to it.
  • A user covers that user, and a mail account only while it is assigned to that user and nobody else — a mailbox somebody else reads as well is not one person's to administer. It covers no organization.

A user or an account in no organization is covered by the deployment scope alone, and a user in none by a scope naming them as well.

These routes accept a grant held at any of the three, and check it against the target in the second column:

Route Checked against
GET /api/admin/mailbox/mutations/audit The mail account account names
GET /api/admin/answering/audit The mail account account names
GET /api/admin/rules/history The mail account account names
GET /api/admin/spam/classifications The mail account account names
GET /api/admin/outbox/{id} The mail account the message was queued from
GET /api/admin/contacts, GET /api/admin/contacts/by-address, GET /api/admin/contacts/{id}, GET /api/admin/contacts/{id}/export The user user names, and each mail account whose collected book that user reads
POST /api/admin/contacts, PUT and DELETE /api/admin/contacts/{id}, POST /api/admin/contacts/{id}/promotion The user user names, and each mail account whose collected book the act would reach
DELETE /api/admin/contacts/collected The mail account account names
POST /api/admin/mailbox/refresh-token The mail account the request names
GET /api/admin/mailbox/synchronization — reports the mail accounts the caller's scopes for mailfathom.admin.read cover
GET and POST /api/admin/mailbox/rewind, GET and POST /api/admin/mailbox/rederivation The mail account the request names
GET /api/admin/accounts/custody, POST /api/admin/accounts/custody/switch, POST /api/admin/accounts/custody/restore/settle The mail account the request names
GET and POST /api/admin/rules/runs, GET and POST /api/admin/spam/runs The mail account the request names
POST /api/admin/folders/erasure The mail account the request names
GET /api/admin/exports/measurement, GET and POST /api/admin/exports, GET and DELETE /api/admin/exports/{id}, POST /api/admin/exports/{id}/cancellation, GET /api/admin/exports/{id}/archive The mail account the request names
GET /api/admin/users — lists the users the caller's scopes for mailfathom.admin.read cover
POST /api/admin/users The organization the body's organizationId names; recording a user into none is the deployment's alone
DELETE /api/admin/users/{userId} The user, and every mail account assigned to them alone, which the erasure deletes with them
PUT /api/admin/users/{userId}/display-name The user
PUT /api/admin/users/{userId}/endpoint-access The user
GET /api/admin/users/{userId}/record The user
POST /api/admin/users/{userId}/record The user
POST /api/admin/users/{userId}/secrets The user
GET /api/admin/users/{userId}/credentials The user
POST /api/admin/users/{userId}/credentials The user, each scope the user holds each of their administrative names at, and every user-facing name the user holds, held at any scope; where a role the user holds lists a pattern, the whole deployment under mailfathom.admin.roles.write as well
PUT /api/admin/users/{userId}/credentials/{credentialId}/material The user, each scope the user holds each of their administrative names at, and every user-facing name the user holds, held at any scope; where a role the user holds lists a pattern, the whole deployment under mailfathom.admin.roles.write as well
PUT /api/admin/users/{userId}/credentials/{credentialId}/enablement The user, and — to enable — each scope the user holds each of their administrative names at, and every user-facing name the user holds, held at any scope; where a role the user holds lists a pattern, the whole deployment under mailfathom.admin.roles.write as well
DELETE /api/admin/users/{userId}/credentials/{credentialId} The user
PUT /api/admin/users/{userId}/organization The user where they stand, and the organization the body moves them into; a move out of every organization is the deployment's alone
GET /api/admin/mail-accounts — lists the mail accounts the caller's scopes for mailfathom.admin.read cover
POST /api/admin/mail-accounts The user the account is recorded for; recording one for a user in no organization is the deployment's alone
GET, POST, and DELETE /api/admin/mail-accounts/{id} The mail account the path names
POST /api/admin/mail-accounts/{id}/assignments, POST /api/admin/mail-accounts/{id}/assignments/removal The mail account the path names and the user the request names, both
POST /api/admin/mail-accounts/{id}/organization The mail account where it sits now, and the organization the body moves it into; a move out of every organization is the deployment's alone
GET /api/admin/organizations — lists the organizations the caller's scopes for mailfathom.admin.read cover; a user scope covers none
PUT /api/admin/organizations/{organizationId}/display-name The organization
GET and POST /api/admin/organizations/{organizationId}/policy The organization

A target outside the caller's scope is answered exactly as one that does not exist, because a refusal naming the missing scope would tell an organization's administrator that the account, the person, or the organization exists elsewhere in the deployment. So an account outside it is refused with 400 as an account this deployment does not configure on a route that reads the account from the request and with 404 on a route under /api/admin/mail-accounts, a queued message from one is 404, a contact read for a user outside it is answered with an empty page or no contact, and a contact write or an export for one is refused with 400 as a user this deployment holds no record for. A user or an organization a route names in its path is 404, a credential listing for a user outside the scope is empty, an erasure or an unassignment of one removes nothing, and a body naming an organization outside it is refused with 400 as an organization this deployment does not hold. The check runs before anything else about the request is answered, so a malformed cursor or filter on an account outside the scope draws the same refusal as the account itself.

A read across several targets returns the ones the scope covers. The books a user reads are their own beside the collected book of each mail account assigned to them, and a scope covering the user but not one of those accounts — a user scope, where the account is assigned to somebody else too — reads the user's own book and every collected book it does cover, and leaves that one out rather than refusing the user. The synchronization status answers the same way: the accounts the scope covers, and nothing about the rest.

A grant below the deployment changes a mail account's settings only while every secret they name was provisioned for a user the account is assigned to — material whose own name begins with user-, that user's identifier, and -. The server an account names is whatever its declaration says, so any other reference would present what stands behind it to a machine the writer chose: the database password, a private key, a client secret a whole workspace shares. That holds for a reference left in place as much as for one newly written, because moving the host or the token endpoint beside it presents it somewhere new all the same, so the rule names no particular setting and judges any change to them. An account carrying such a reference is therefore the deployment's to redeclare. A narrower grant still reads it, renames it, assigns and unassigns it, operates on its mailbox, and erases it, and redeclares it once its references are material held for its users, which POST /api/admin/users/{userId}/secrets provisions under that same grant. An administrator holding mailfathom.admin.configuration.write over the whole deployment names any reference as before. A declaration refused this way is refused in the write's own answer, naming each setting, and nothing is written.

A listing never refuses over a scope. It answers with what the caller's scopes cover, a page at a time, so an organization's administrator lists that organization's people, mail accounts, groups, and role assignments and nobody else's, and a caller holding mailfathom.admin.read over one user alone lists that user, the mail accounts assigned to them alone, the assignments made to them at their own scope, and no organization and no group.

One refusal does reach past a scope: a label already taken. A user's label is unique across the deployment rather than within an organization, so an organization's administrator recording or relabelling one of their own people with a label somebody outside that organization carries is refused with 400 saying another user is already recorded under it. That tells them such a label exists somewhere in the deployment and nothing else about who carries it.

The routes that read and keep roles, groups, and role assignments accept a grant held at any of the three as well, under mailfathom.admin.read for a read and mailfathom.admin.roles.write for a write:

Route Checked against
GET /api/admin/roles Nothing further: a role is defined once for the whole deployment, and any holder of mailfathom.admin.read, at any scope, reads them
GET /api/admin/groups, GET /api/admin/role-assignments Each row, so the listing answers with the groups and the assignments the scope covers
POST /api/admin/groups, PUT /api/admin/groups/{groupId}/name, DELETE /api/admin/groups/{groupId}, GET /api/admin/groups/{groupId}/members The organization the group belongs to; recording a group into none is the deployment's alone
PUT and DELETE /api/admin/groups/{groupId}/members/{userId} The organization the group belongs to, and the user; adding a member to a group given a role that lists a pattern is the root's alone
POST /api/admin/role-assignments, DELETE /api/admin/role-assignments/{assignmentId} The user or the group the role is given to, and the scope it is given at; giving a role at the deployment scope is the deployment's alone, and giving one that lists a pattern is the root's alone at any scope
GET /api/admin/users/{userId}/permissions The user, and then each row: the answer lists what the user holds through the groups and at the scopes the caller's own scope covers

A group belongs to an organization and to nobody alone, so a user scope covers no group; one in no organization is the deployment's. A group, a user, an organization, or an assignment outside the caller's scope is answered as one that does not exist: 404 where the path names it, and 400 where the body of a write names it. The four routes that define a role — creating, renaming, changing the permissions of, and deleting one — are not among these: they are the deployment's alone. Roles, groups, and assignments names the commands, and administering them what a writer may give.

Six acts behind these routes are the deployment's alone, because nothing narrower than the deployment covers a user, a mail account, or a group in no organization, or the deployment itself. Five are decided before anything the request names is read — recording a user into no organization, moving a user out of every organization, moving a mail account out of every organization, recording a group into no organization, and giving a role at the deployment scope — so a caller holding the permission only narrower is refused each with the 403 above that carries heldBelowDeployment, the same answer whoever the request names, which discloses nobody. The sixth is recording a mail account for a user in no organization, which is known only once that user is read: a caller whose scope covers them is refused with 403 naming the permission, and one whose scope does not is answered as for any user outside it.

Every other route is reached only by a grant held over the whole deployment, and refuses one held at a narrower scope with that same 403. Apart from the five acts decided before the request is read, none of the routes in the two tables ever answers with that document: a caller holding the route's permission nowhere is refused on it naming the permission, and one holding it at a scope that does not cover the target is answered as a target that does not exist. A write that would give somebody a name wider than its writer holds it is refused with a 403 of its own, naming that name in permission and saying it is held at a scope narrower than the write gives it at — which is as often an organization as the deployment, so it carries no heldBelowDeployment either. A write that gives a role listing a pattern, or places a credential for a user who holds one, is refused below the root with the 403 that carries widensOnUpgrade — what a refusal says shows it.

The mfctl command behind each route is checked where the route is, since the command does nothing the route does not: mfctl user add --organization <id> records a user straight into an organization, which is how an organization's administrator records a colleague, and mfctl user add without it records one into none.

Where a credential may be presented from

A credential may name the networks it is accepted from: a network such as 10.20.0.0/16, or a single address, which reads as /32 or /128, written with --source-network when the credential is provisioned and repeated once per network, up to 32. A credential naming none is accepted from anywhere. The restriction belongs to the credential rather than to the person, because a person's workstation key and their scheduled job's key are used from different places, and it holds on every endpoint the credential lists, this one included. A request presenting the credential from anywhere else is answered 401, the same answer a wrong key gets, so a refusal says nothing about whether the credential was good.

The entries are validated the way ReverseProxy:TrustedProxies is. A value that is neither an address nor a network, a DNS name, and a network with bits set past its prefix — 10.20.30.0/16, which means 10.20.0.0/16 and was almost certainly meant as something narrower — are each refused, naming the value. An IPv4-mapped IPv6 address, which is what a dual-stack listener reports for an IPv4 client, is compared as the IPv4 address it carries, so ::ffff:10.20.30.40 is inside 10.20.0.0/16.

The address compared is the client's, and that has to be stated. A request that reached this process through a reverse proxy arrives from the proxy's address, and the only record of the client's is the X-Forwarded-For header the proxy wrote. That header is believed only from a proxy ReverseProxy:TrustedProxies names, and never where that list is empty or trusts a whole address family — otherwise any client could write the address a restriction compares. So provisioning refuses a source network while ReverseProxy:TrustedProxies names no proxy narrower than an address family, and says so; name the proxy in front of this process first. A deployment whose configuration stops naming one after restrictions were written warns on every start, because each restriction is then judged against the address that opened the connection — behind a proxy, the proxy's own, which every client shares.

Two deployment shapes need care beyond that, because in both the address the process sees is not the client's even without a proxy of your own in front:

  • A Kubernetes Service of type LoadBalancer or NodePort rewrites the source address to a node's unless its externalTrafficPolicy is Local. With the default Cluster, every request arrives from inside the cluster and a restriction to an office network refuses everyone. See preserving the client address.
  • A load balancer passing TCP through — rather than terminating HTTP and writing X-Forwarded-For — hands the process its own address unless it speaks the PROXY protocol, which MailFathom does not read. Put an HTTP-terminating proxy that writes X-Forwarded-For between the two and name it in ReverseProxy:TrustedProxies.

The restriction is checked after the credential is: a request from a permitted network still needs a valid credential, and a request with none is refused as any other.

What the endpoint serves

Route Permission What it does
GET /api/admin/session none Reports the credential that authenticated, the user it belongs to and the roles they hold, the running version, and what the credential holds at each scope. login and status report what it answers; every other command reads it first to check the two versions against each other.
POST /api/admin/mailbox/refresh-token mailfathom.admin.credentials.write Stores a mailbox refresh token for one configured account, sealed under the deployment's data-encryption key. This is what mfctl mailbox authorize --account sends.
GET /api/admin/mailbox/synchronization mailfathom.admin.read Reports what synchronization is doing, per account and per mapped folder. This is what mfctl mailbox status asks.
GET /api/admin/mailbox/rewind mailfathom.admin.read Reports how much mail discarding an account's synchronization progress would have fetched again, discarding nothing.
POST /api/admin/mailbox/rewind mailfathom.admin.operate Discards it, so the next runs read the scope's folders from the start of the account's window. This is the one route that makes a deployment pull a mailbox over IMAP again.
POST /api/admin/mailbox/rederivation mailfathom.admin.operate Asks for the raw MIME already stored to be re-read into the properties a newer release records from it, and answers with the run already under way where there is one. It records the request and re-reads nothing inside it.
GET /api/admin/mailbox/rederivation mailfathom.admin.read Reports where that run has got to, or how the last one ended.
GET /api/admin/mailbox/mutations/audit mailfathom.admin.audit.read Reads one account's record of the changes MailFathom made to its mailbox, where that account keeps one.
GET /api/admin/answering/audit mailfathom.admin.audit.read Reads one account's record of the questions answered from its mailbox, where that account keeps one.
GET /api/admin/embeddings mailfathom.admin.read Reports whether semantic search is working and how far behind it is. This is what mfctl embedding status asks.
GET /api/admin/embeddings/activation mailfathom.admin.read Reports what activating the declared model would do and what it would cost, writing nothing.
POST /api/admin/embeddings/activation mailfathom.admin.spend Takes up the declared model and begins embedding under it. This is the one route that starts a provider bill.
POST /api/admin/embeddings/reindex/cancellation mailfathom.admin.operate Stops the reindex under way, leaving the generation that is serving where it is.
GET /api/admin/rules mailfathom.admin.read Reports the mail rules this deployment has loaded, in the order they run, and whether the configuration as it now stands is the one they were read from.
POST /api/admin/rules/runs mailfathom.admin.operate Asks for one account's rules to be run over every message already stored for it, and answers with the run already under way where there is one.
GET /api/admin/rules/runs mailfathom.admin.read Reports where that run has got to, or how the last one ended.
GET /api/admin/rules/history mailfathom.admin.audit.read Reads one account's record of what its rules concluded and what those conclusions asked for.
POST /api/admin/spam/runs mailfathom.admin.operate Asks for every message already stored for one account to be classified, and answers with the run already under way where there is one. It is a dry run unless the body asks to apply.
GET /api/admin/spam/runs mailfathom.admin.read Reports where that run has got to, or how the last one ended.
GET /api/admin/spam/classifications mailfathom.admin.audit.read Reads one account's classifications, newest first, and the changes each verdict asked the mailbox for.
GET /api/admin/jobs/dead-letters mailfathom.admin.read Reads the background work that stopped and will not be attempted again, newest first, with what ended each piece of it.
POST /api/admin/jobs/dead-letters/retry mailfathom.admin.operate Returns one stopped job to the queue under the identity it was enqueued with.
POST /api/admin/jobs/dead-letters/drop mailfathom.admin.operate Decides one stopped job will never run, keeping the record of it.
GET /api/admin/outbox/summary mailfathom.admin.read Reports how many queued messages stand at each stage of the outbox, naming no message.
GET /api/admin/outbox mailfathom.admin.read Reads one bounded, keyset-paginated page of what this deployment has been asked to send, newest first. It names no recipient and no subject.
GET /api/admin/outbox/{id} mailfathom.admin.audit.read Reads one queued message by identity, with who it is offered to and what each of them was told. It is the one outbox reading that names people, and is published under the grant every other reading of identified third parties is.
POST /api/admin/outbox/cancellation mailfathom.admin.operate Withdraws one queued message that has not begun transmitting. This is the only point at which sending is reversible.
POST /api/admin/outbox/requeue mailfathom.admin.operate Offers one queued message again. This is the one route that can put a second copy of a message in somebody's mailbox.
GET /api/admin/content/move mailfathom.admin.read Reports how much mail content the database still holds, where the move of it has got to, and whether this deployment has a bucket to move it into. This is what mfctl content move-status asks.
POST /api/admin/content/move mailfathom.admin.operate Asks for every payload the database still holds to be carried into the object backend, and answers with the move already under way where there is one. It records the request and copies nothing inside it.
POST /api/admin/content/move/pause mailfathom.admin.operate Stops that move where it is, cancelling nothing and keeping everything it has carried.
POST /api/admin/content/move/resume mailfathom.admin.operate Sets a stopped move going again from the position it stopped at.
GET /api/admin/content/release mailfathom.admin.read Reports how much of this deployment's database is a copy of what its bucket already holds, and how much the move has not yet carried. This is what mfctl content release reads first, and what mfctl content move-status reports beside the backlog.
POST /api/admin/content/release mailfathom.admin.erase Frees one bounded batch of those copies, leaving the object the only place that mail is held. Refused with 409 while any payload is still waiting to be carried.
GET /api/admin/accounts/custody mailfathom.admin.read Reports which copy of one account's mailbox is the truth, whether a switch is still under way, and — for an account holding its mailbox — how much of its source server is still to be emptied, or, for one switching off, how much is still to be put back and which appends an operator has still to settle. This is what mfctl account custody show asks.
POST /api/admin/accounts/custody/switch mailfathom.admin.custody.write Asks for one account's custody to become HoldMailbox or MirrorSource. Switching on ends with a mail server no longer holding a copy of the mailbox, message by message, as the account's own runs empty it. A refusal is answered 200 with one sentence per reason rather than an error status, because each names something about the deployment an operator corrects — a replica holding work under a build that does not know the mode, a synchronized folder playing a virtual role, an account whose deletes only flag a message \Deleted and leave it on the server, or, switching off, a folder mapping naming nothing the source advertises. Asking for the custody the account already has is accepted and changes nothing. This is what mfctl account custody switch sends.
POST /api/admin/accounts/custody/restore/settle mailfathom.admin.custody.write Records what an operator found in the folder an unanswered APPEND was issued against. An append whose answer never came back leaves a folder that may hold the copy and may not, and MailFathom reissues nothing on its own — so this is the one act of the mode only a person can perform, and the account stays Restoring until every such record is settled. Found keeps the record for good, so the message is never appended a second time; not there deletes it, and the next run appends the message as it would any other. A record nothing is standing for is answered 200 reporting that nothing was settled. This is what mfctl account custody settle sends.
POST /api/admin/folders/erasure mailfathom.admin.erase Erases one bounded pass of the mail stored for a folder the account no longer mirrors. This is the one route that disposes of mail.
GET /api/admin/exports/measurement mailfathom.admin.export Reports what an export of one mailbox, or of one folder of it, would carry — per folder and in total — without starting one. The figures are summed from the recorded lengths, so no payload is read to produce them.
GET /api/admin/exports mailfathom.admin.export Lists the exports one account has, newest first.
POST /api/admin/exports mailfathom.admin.export Records an export and queues the work that writes its archive, answering with the measurement it was decided on. An export of the same scope already being written is answered with itself; a different scope is refused with 409 while one is running. Refused with 400 where this deployment keeps its content in the database, where the export is past the configured size limit, or where the stored-content ceiling has no room for a second copy of the mailbox.
GET /api/admin/exports/{exportId} mailfathom.admin.export Reads where one export stands, including how much of it has reached the archive.
POST /api/admin/exports/{exportId}/cancellation mailfathom.admin.export Stops an export still being written and deletes whatever it had produced. One that has already finished is answered as it stands rather than cancelled.
GET /api/admin/exports/{exportId}/archive mailfathom.admin.export Serves the finished archive as application/zip, streamed from the object store rather than held in this process. Refused with 409 once the archive has expired, been deleted, or never finished.
DELETE /api/admin/exports/{exportId} mailfathom.admin.export Deletes a finished archive before its retention ends. Repeating it on one already gone succeeds, because the caller asked for a state the deployment is already in.
GET /api/admin/contacts mailfathom.admin.audit.read Reads one bounded, keyset-paginated page of the books user reads — their own beside the collected book of each mail account assigned to them — optionally narrowed to one origin. The contact book holds which book answers where two of them carry one address.
POST /api/admin/contacts mailfathom.admin.operate Records a person into the own book of user, as a contact they asserted. It never writes a mail account's collected book. A user this deployment holds no record for is refused with 400, as it is on every contact route that acts under the user the request names.
GET /api/admin/contacts/by-address mailfathom.admin.audit.read Reads whoever uses one address across the books user reads, in whichever casing the book that answers recorded it.
GET /api/admin/contacts/{id} mailfathom.admin.audit.read Reads one contact by the identity its book gave it, from the books user reads.
PUT /api/admin/contacts/{id} mailfathom.admin.operate Amends one contact of the own book of user to the whole record the body states. A collected record is not amended in place; it is promoted first. A user this deployment holds no record for is refused with 400 rather than answered that the books hold no such contact.
POST /api/admin/contacts/{id}/promotion mailfathom.admin.operate Writes an asserted copy of a collected contact into the own book of user, under a new identity. The mail account's own record stays where it is, because the account's other users still read it. A user this deployment holds no record for is refused with 400.
DELETE /api/admin/contacts/{id} mailfathom.admin.erase Erases one person, from whichever of the books user reads holds them, and everything that book derived from them. A collected record leaves for every user assigned that mail account. A user this deployment holds no record for is refused with 400 rather than answered that nothing was erased. This is the one route that disposes of a contact, and it cannot be undone.
DELETE /api/admin/contacts/collected mailfathom.admin.erase Erases the whole collected book of the mail account account names, leaving every user's own book where it is. It names an account rather than a user, because collection is switched on per account. An account this deployment does not serve is refused with 400 rather than answered with nothing erased, which would read exactly like a mistyped identifier succeeding. This cannot be undone either.
GET /api/admin/contacts/{id}/export mailfathom.admin.audit.read Produces everything the books user reads hold about one person, as of the instant it was taken. A user this deployment holds no record for is refused with 400 rather than answered that the books hold nobody.
GET /api/admin/configuration mailfathom.admin.read Reports the settings at or beneath a path as this deployment reads them, each with the layer that decided it, and the persisted version they were composed over. Secret-bearing values read back as the redaction marker. This is what mfctl config get and mfctl config show ask.
POST /api/admin/configuration mailfathom.admin.configuration.write Applies keyed changes to the persisted configuration document, together or not at all, over the version the body states.
GET /api/admin/configuration/document mailfathom.admin.read Hands over the persisted document itself, secrets redacted, with the version it was read at. This is what an editing session opens.
POST /api/admin/configuration/document mailfathom.admin.configuration.write Takes that document back edited and commits it as one change against the version it was opened over.
GET /api/admin/configuration/adoption mailfathom.admin.read Reports what adopting a path would copy out of the deployment's files, naming the file behind each setting, and writes nothing.
POST /api/admin/configuration/adoption mailfathom.admin.configuration.write Copies those values into the persisted document. This is the one route that moves a decision out of a deployment's files and into its database.
GET /api/admin/users mailfathom.admin.read Reads one page of the users this deployment holds records for, each with the label it tells them apart by, whether the running process serves them, and whether they are served on the MCP endpoint and on the client endpoint. It is what a user or credential command reads before it acts, so that a deployment serving one person needs no --user.
POST /api/admin/users mailfathom.admin.configuration.write Records a user this deployment did not hold, from the display name the body carries, into the organization its organizationId names or into none where it names none, and answers with the identifier they were minted under. It refuses, naming what to change, a second user while a user-facing endpoint admits a caller who names nobody, a label another user already carries, and an organization this deployment does not hold.
PUT /api/admin/users/{userId}/display-name mailfathom.admin.configuration.write Replaces the label the user is told apart by. It answers with no body — the label the request carried is the whole of what changed — refuses a label another user carries, naming what to change, and answers 404 for a user this deployment holds no record for, as every other user-scoped route does.
PUT /api/admin/users/{userId}/endpoint-access mailfathom.admin.configuration.write Keeps the user off the MCP endpoint, the client endpoint, or both, or lets them back on, from mcpEndpoint and clientEndpoint in the body; a switch the body leaves out stays where it is and a body naming neither is refused. It writes them into the user's record, answers both switches as the record now states them, and answers 404 for a user this deployment holds no record for and 409 where another write moved the record first.
DELETE /api/admin/users/{userId} mailfathom.admin.erase Erases the user and every message, folder, attachment, and derived index this deployment holds for them, once the work bound to their own mailboxes has stopped. This is the one route here that destroys mail, and it cannot be undone. A user this deployment does not hold is reported as nothing erased rather than as a refusal, and work that will not stop within its bound is answered 409 naming it, with nothing erased. So is a user who alone is assigned a mail account the caller's scope does not cover — one in no organization, which only the deployment scope covers, under a scope naming the user.
GET /api/admin/users/{userId}/record mailfathom.admin.read Hands over one user's record as the redacted JSON an editing session opens, with the version it was read at. The record carries no mail accounts: those are read on their own routes, under /api/admin/mail-accounts.
POST /api/admin/users/{userId}/record mailfathom.admin.configuration.write Takes that record back edited and commits it as one change against the version it was opened over. It is what mfctl user edit sends when the editor exits, and a record another writer moved past is refused as superseded rather than merged.
GET /api/admin/mail-accounts mailfathom.admin.read Reads one page of the mail accounts this deployment holds, each with its identifier, its version, the users it is assigned to, its address, its display name, and the organizationId it belongs to or null for none, and nextCursor naming where the following page continues. The declaration itself is read one account at a time.
POST /api/admin/mail-accounts mailfathom.admin.configuration.write Creates a mail account from the declaration the body carries, in the organization of the user userId names, and assigns it to that user, answering with the identifier it was generated under. An address another account already holds is refused.
GET /api/admin/mail-accounts/{accountId} mailfathom.admin.read Hands over one account's declaration as the redacted JSON an editing session opens, with the version it was read at, the organizationId it belongs to, and each of its settings as the settings policies governing it resolve it, or 400 naming the row to correct when the stored declaration is not one of settings.
POST /api/admin/mail-accounts/{accountId} mailfathom.admin.configuration.write Takes that declaration back edited and commits it against the version it was opened over, judged against every user the account is assigned to and against the settings policies governing it: a declaration moving a setting a policy forces is refused naming the setting and who holds it.
DELETE /api/admin/mail-accounts/{accountId} mailfathom.admin.erase Erases the account, every assignment to it, and every message this deployment holds for it. This cannot be undone.
POST /api/admin/mail-accounts/{accountId}/assignments mailfathom.admin.configuration.write Assigns the account to the user named by userId: beside the other members already assigned it where it belongs to an organization, and to nobody else where it belongs to none. Assigning it to somebody who already holds it writes nothing. An account and a user of different organizations — counting none as one of them — are refused, naming both; so is a second user of an account in no organization, which is one person's; and so is an account already assigned to 256 users.
POST /api/admin/mail-accounts/{accountId}/organization mailfathom.admin.configuration.write Moves the account into the organization the body's organizationId names, or out of every organization where the body says "none": true. A body stating neither, or both, is refused with 400 rather than read as a move out. This is what mfctl account set-organization sends. It answers 204, 404 for an account this deployment does not hold, 400 for an organization it does not hold, and 409 naming how many of the users it is assigned to the target would not admit — or, for a move out of every organization, how many users it is assigned to when that is more than one — or naming what the settings policy the account would move under refuses about it.
POST /api/admin/mail-accounts/{accountId}/assignments/removal mailfathom.admin.erase Ends one user's assignment and erases what that user authored under the account, their drafts and their standing instructions; the mail itself stays whole while anybody else is assigned. Ending the last one erases the account and every message this deployment holds for it.
POST /api/admin/users/{userId}/secrets mailfathom.admin.configuration.write Seals the material carried in the body under the active data-encryption key and answers only with its database:<uuid> reference. Sending the same declared name for that user rotates the existing row and returns the same reference. It refuses when the user does not exist or the deployment configures no data-encryption key ring.
GET /api/admin/organizations mailfathom.admin.read Reads one page of the organizations this deployment holds, each with its display name, its short name, how many users belong to it, how many mail accounts belong to it as mailAccounts, and when it was recorded, and nextCursor naming where the following page continues. A row on the page whose stored short name is not one this build reads is reported beside them under unreadable, by identifier, display name, and a correction naming what a short name may contain, rather than refusing the listing. The stored short name itself is never echoed. This is what mfctl organization list asks.
POST /api/admin/organizations mailfathom.admin.configuration.write Records an organization from the display name and short name the body carries, and answers with the identifier it was minted under. It answers 409 for a short name another organization holds, and 400 naming what was wrong with either name.
PUT /api/admin/organizations/{organizationId}/display-name mailfathom.admin.configuration.write Replaces the name an operator reads the organization by. It answers 204, 404 for an organization this deployment does not hold, and 400 for a name it does not accept.
PUT /api/admin/organizations/{organizationId}/short-name mailfathom.admin.credentials.write Replaces the short name its members sign in under, which moves every member's login with it. It answers 204, 404, 409 for a short name another organization holds, and 400.
DELETE /api/admin/organizations/{organizationId} mailfathom.admin.configuration.write Removes an organization with neither members nor mail accounts. It answers 204, 404, and 409 naming how many members and how many mail accounts it still has.
GET /api/admin/policy mailfathom.admin.read Hands over the settings policy the deployment holds, as the JSON an editing session opens, with the version it was read at. A deployment that has stored none answers {} at version 0.
POST /api/admin/policy mailfathom.admin.configuration.write Takes that policy back edited and commits it as one change against the version it was opened over. It is what mfctl policy edit sends when the editor exits; a policy that does not validate, and one another writer moved past, are refused in the answer rather than merged or written in part.
GET /api/admin/organizations/{organizationId}/policy mailfathom.admin.read Hands over the settings policy one organization holds, the same way. It answers 404 for an organization this deployment does not hold.
POST /api/admin/organizations/{organizationId}/policy mailfathom.admin.configuration.write Takes that organization's policy back edited and commits it as one change, the same way. It answers 404 for an organization this deployment does not hold.
GET /api/admin/roles mailfathom.admin.read Reads one page of the roles this deployment holds, each with its list as it was written under permissions, what each pattern on that list reaches in this build under patterns, and any stored entry granting nothing in this build under unpublished.
POST /api/admin/roles mailfathom.admin.roles.write at the deployment Records a role from the name and the list of permissions the body carries — published names, and patterns — and answers with the identifier it was minted under. A name another role carries is answered 409, and a name it does not accept, a missing list, a permission this build does not publish, or a pattern reaching nothing it publishes 400.
PUT /api/admin/roles/{roleId}/name mailfathom.admin.roles.write at the deployment Replaces the name an operator reads the role by. It answers 204, 404, 409 for a name already taken, and 400 for a name it does not accept.
PUT /api/admin/roles/{roleId}/permissions mailfathom.admin.roles.write at the deployment Replaces the whole list the role grants, names and patterns alike, which everybody it is assigned to holds from their next request. It answers 204, 404, 400 for a missing list, a name this build does not publish, or a pattern reaching nothing it publishes, and 409 when it would take the root from the last role giving it.
DELETE /api/admin/roles/{roleId} mailfathom.admin.roles.write at the deployment Removes a role nothing is assigned. It answers 204, 404, and 409 naming how many assignments still give it.
GET /api/admin/groups mailfathom.admin.read Reads one page of the groups the caller's scope covers, each with its organization and how many members it has.
POST /api/admin/groups mailfathom.admin.roles.write Records a group in the organization the body names, or in none when it says "none": true, and answers with the identifier it was minted under. A group in no organization needs the grant at the deployment. It answers 400 for a name it does not accept and for an organization that does not exist within the caller's scope, and 409 for a name already taken.
PUT /api/admin/groups/{groupId}/name mailfathom.admin.roles.write Replaces the name an operator reads the group by. It answers 204, 404 for a group outside the caller's scope, 409 for a name already taken, and 400 for a name it does not accept.
DELETE /api/admin/groups/{groupId} mailfathom.admin.roles.write Removes a group nothing is assigned, and its memberships with it. It answers 204, 404, and 409 naming how many assignments still name it.
GET /api/admin/groups/{groupId}/members mailfathom.admin.read Reads one page of the group's members.
PUT /api/admin/groups/{groupId}/members/{userId} mailfathom.admin.roles.write Makes the user a member, which gives them every assignment the group holds; repeating it changes nothing, is answered 204 again, and is not recorded. It answers 204, 403 naming a name those assignments give that the caller does not hold widely enough, or naming mailfathom.admin.roles.write where one of them gives a role that lists a pattern and the caller is not the root, 404, and 409 for a user of a different organization from the group's.
DELETE /api/admin/groups/{groupId}/members/{userId} mailfathom.admin.roles.write Ends the user's membership; for somebody who is not a member it changes nothing, is answered 204, and is not recorded. It answers 204, 404, and 409 when the user is the last through whom the deployment's root is held.
GET /api/admin/role-assignments mailfathom.admin.read Reads one page of the role assignments whose principal and scope the caller's scope both cover.
POST /api/admin/role-assignments mailfathom.admin.roles.write Gives a role to a user or a group at the deployment, one organization, or one user, and answers with the identifier it was minted under. It answers 403 naming a name the role grants that the caller does not hold widely enough, or naming mailfathom.admin.roles.write where the role lists a pattern and the caller is not the root, 400 for a role, principal, or scope that does not exist within the caller's scope, and 409 for the same role already given to the same principal at the same scope.
DELETE /api/admin/role-assignments/{assignmentId} mailfathom.admin.roles.write Revokes one assignment. It answers 204, 404, and 409 when it is the last one giving the deployment's root.
GET /api/admin/users/{userId}/permissions mailfathom.admin.read Explains why the user holds each permission they hold within the caller's own scope — the role, the pattern on its list that reaches the permission where the role does not list it by name, directly or through which group, and the scope — and what each of their credentials keeps of what it listed. It answers at most 1000 rows, and sourcesTruncated says when the user holds more there.
GET /api/admin/records/held-back mailfathom.admin.read Reads the records this deployment will not read, as three lists — users, mailAccounts, and organizations — each entry naming the record's identifier, the label it carries, the version refused where its kind has one, and one sentence per setting to correct. A deployment holding nothing back answers three empty lists.
PUT /api/admin/users/{userId}/organization mailfathom.admin.credentials.write Moves the user into the organization the body's organizationId names, or out of every organization where the body says "none": true, re-scoping their passwords in the same transaction. A body stating neither, or both, is refused with 400 rather than read as a move out. This is what mfctl user set-organization sends. It answers 204, 404 for a user this deployment does not hold, 400 for an organization it does not hold, and 409 naming the username the target already holds for another user, or how many of the user's mail accounts the target would not admit.
GET /api/admin/users/{userId}/credentials mailfathom.admin.read Reads one user's credentials, each with its method, what it grants, the endpoints it may be presented on and the networks it is accepted from, whether it still authenticates, and when its material was last replaced. It publishes what each is resolved by, except where that value is derived from the secret, and for a password the login a person types to sign in with it. A credential whose method this build does not know, and one scoped to an organization whose short name it will not read, are left out rather than published without the login they would be typed as; the user's other credentials are listed as before.
POST /api/admin/users/{userId}/credentials mailfathom.admin.credentials.write Provisions one of the four methods, from what that method needs, with the endpoints it may be presented on and the networks it is accepted from where the request names them. This is one of the two routes that mint a way into somebody's mail, and into this endpoint for a credential listing admin, and the one that answers with a minted key where the method mints one. It answers 409 where the value the credential resolves by is already taken — for a password within the user's organization, or among users in none, and for every other method across the deployment — and where the user already holds the hundred credentials one user may.
PUT /api/admin/users/{userId}/credentials/{credentialId}/material mailfathom.admin.credentials.write Replaces what one credential's client presents, in a single statement, which stops the previous material working at that instant. This is the other. It is refused for a method holding no material to replace.
PUT /api/admin/users/{userId}/credentials/{credentialId}/enablement mailfathom.admin.credentials.write Stops one credential authenticating, or lets it authenticate again, keeping everything else about it either way.
DELETE /api/admin/users/{userId}/credentials/{credentialId} mailfathom.admin.credentials.write Removes the record and frees the value it was resolved by. This cannot be undone, and it is the reason mfctl credential delete shows the credential and asks before sending it. What that command shows comes from the listing and what it reports comes from here, so an identifier the listing does not carry is still sent rather than answered locally.

Four of those routes carry a credential in the body, which is what makes the clear-text warning below matter more here than it does for a session probe: the stored-secret route, the refresh-token route, and the two user-credential routes that provision a password or replace one.

POST /api/admin/mailbox/refresh-token carries a long-lived credential for a named mailbox user. It refuses, with 400 and a sentence naming what was wrong, an account this deployment does not hold and a body missing either field; a second grant for the same account replaces the first rather than adding to it. It reads at most 16 KB, which is far more than any authorization server's refresh token and far less than the server's own default. It answers with no body at all, so nothing it stores can be read back out through it.

Storing seals the token under the deployment's data-encryption key. A deployment that configures no key ring cannot store one, and the route answers 500 rather than a refusal it can explain, because nothing about the request was wrong.

Reading the users, mail accounts, and organizations a page at a time

GET /api/admin/users, GET /api/admin/mail-accounts, and GET /api/admin/organizations each answer one page. Paging is what lets a listing hold more rows than one answer carries, not a limit on how many there are: no total count bounds the users, the mail accounts, or the organizations a deployment holds, so every one of them is listed a page at a time, while the per-user bounds on assigning and listing mail accounts stay. Each listing takes the same two parameters:

Parameter Meaning
pageSize Between 1 and 1000; 200 when omitted.
cursor The nextCursor the previous page of the same listing returned.
curl -fsS -H "Authorization: Bearer $MAILFATHOM_ADMIN_KEY" \
    "http://127.0.0.1:8090/api/admin/mail-accounts?pageSize=2"

Every page carries nextCursor beside its rows, and a walk ends when it comes back null, never by comparing a short page against the size you asked for. The rows are in identifier order, which is the order the primary key is indexed in and — every identifier MailFathom mints being a version 7 UUID — the order the rows were recorded in. A cursor names the last row a page held rather than a position counted from the start, so a row recorded or removed while you walk moves nothing you have not read yet, and a cursor naming a row removed since is still a place to continue from. A cursor another listing issued, a cursor one group's members were listed with presented to another group's, or anything this deployment did not issue, is refused with 400, and so is a page size outside the range.

mfctl user list, mfctl account list, and mfctl organization list follow the cursor to the end themselves and print the whole listing; mfctl organization list sorts it by short name before printing. A script reading a listing directly follows nextCursor the same way. An organization page also carries, under unreadable, the rows on that page this deployment will not read; the route reporting held-back records reads every organization rather than one page.

Reading what synchronization is doing

mfctl mailbox status is the command to run when mail is not arriving. Nothing else a deployment ships answers that question: a run that is failing, backing off, or standing still on one folder is visible in telemetry and in the log, and without a metrics stack it reaches you as a mailbox that looks empty rather than as a worker that has stopped.

$ mfctl mailbox status
Deployment:       production (https://mail.example.test:8443)
Synchronization:  on
Answered by:      mailfathom-7c9f4d8b6-2xql:1

Account:            work
Supervised by:      mailfathom-7c9f4d8b6-2xql:1, the replica that answered; its hold runs until 2026-08-15 12:25:00Z unless it is renewed
Phase:              waiting; next run due at 2026-08-15 12:20:00Z
Backoff:            4 runs failed in a row, which is what the wait above was grown from
Last run:           failed at 2026-08-15 11:55:00Z; 1 of 2 folders failed
Attachments:        980 of 1,240 messages with attachments read; 412 attachments left over 88,104,336 octets
Attachment yield:   1,504 document extracts and 96 described images; 3,918,220 characters of lexical index
Attachment skips:   61 in a format this deployment does not read; 12 encrypted, so nothing could be opened; 4 carrying no text to read, which is what a scan looks like

Folder   Progress                                                         Last run
INBOX    UID 12,410 in UIDVALIDITY 3, last moved at 2026-08-15 11:55:00Z  synchronized at 2026-08-15 11:55:00Z; stored 0, 0 oversized, 0 unreadable, more to fetch: False
archive  UID 6,997 in UIDVALIDITY 3, last moved at 2026-08-14 09:00:00Z   at 2026-08-15 11:55:00Z, failed unexpectedly; the deployment's log holds what happened

The two folder columns only mean something together. Progress is the durable checkpoint: how far the forward pass has committed, and when it last moved. Last run is what happened the last time a run took that folder in hand. A folder whose progress stopped a day ago and whose last run succeeded has nothing left to fetch; a folder whose progress stopped a day ago and whose runs keep ending is stuck, and only the pair distinguishes them. That is the reading this output exists for — a folder that raises before its checkpoint commits reads the same batch on every run, the account's backoff grows behind it, and each individual run still reports itself as finished.

A folder's outcome names its remedy where it has one. An alias matching no advertised folder and an alias matching several are both corrected by editing the mapping rather than by waiting, so both lines say so. A deferral after the mail server stopped answering, and one after a concurrency conflict, are waited out. An unexpected failure is the one that sends you to the log. A folder interrupted because the deployment was shutting down is none of those: the restart ended its turn, its checkpoint holds whatever that turn had already committed, and the first run after the deployment comes back resumes from there.

Phase says which of five things the account is doing — running now, ready to run and waiting for one of the MailSynchronization:MaxConcurrentAccounts slots, waiting out the delay its last run chose, not yet run on the replica that holds it, or supervised on another replica of the same deployment. The instant is the deployment's clock rather than yours. Backoff is the consecutive failure count that delay was grown from, so a wait far longer than MailSynchronization:Interval is explained rather than merely observed.

The answer covers the deployment, and it names which replica read the parts that are one process's. An account is supervised by exactly one replica at a time, and Supervised by is read from the lease table rather than from the answering process — so an account held elsewhere is reported as supervised, with the replica holding it and how long that hold runs, instead of as an account nothing has ever run. Phase, Backoff, and Last run beside it are that holder's scheduling state, which lives only in the holder's memory, so all three stand aside where the answering replica is not the holder and name it instead of reading their absent figures as none:

Account:            work
Supervised by:      mailfathom-7c9f4d8b6-9tmqz:1; its hold runs until 2026-08-15 12:25:00Z unless it is renewed
Phase:              supervised by another replica of this deployment, which is where its run is read
Backoff:            not reported here; the replica supervising the account is where its backoff is read
Last run:           not reported here; the replica supervising the account is where its runs are read

The folder table below that is unaffected, because a folder's progress is a durable row rather than a process's memory. Answered by on the first block is the replica that composed the answer, which is what makes two readings taken from a load balancer comparable. A deployment running one replica reads exactly as it did before, with its own identity in both places, and no replica holds this account, so nothing is fetching it is the reading that says no replica has taken the mailbox up at all.

The three attachment lines are this account's alone, and they say how far reading its mail's attachments and images has come — coverage, what reading produced, and an aggregate of why the rest yielded nothing. They are here as well as on mfctl embedding status because the scope differs: this answers for one account beside its folders, and that one answers for the deployment beside both spend periods, which are what a ceiling bounds. An account is not a budget, so no period appears here — reporting one account's share of a deployment ceiling would invent a figure nothing enforces. not reported on any of the three is an older deployment that does not answer with them.

A folder the account maps and no longer mirrors is listed and marked, rather than left out, so a folder whose mirroring was switched off never reads as a folder that vanished. Synchronization: off on the first line says the whole deployment fetches nothing, which is what makes every figure below it still.

The account state is what the supervising process is doing, so a restart resets it: the phase reads as not started and the last run as none until the account runs again, which happens within one interval. A handover between replicas does the same and for the same reason, since the state never left the process that grew it. The folder progress is a durable row and survives, which is deliberate — the half that tells a stalled folder from an idle one is the half that outlives the process, and the half a restart clears is the backoff a restart genuinely clears. Nothing durable records a backoff, so no answer can name one that no replica is applying.

Nothing in the answer is mail. Configured account identifiers, folder aliases, a phase, counts, UIDs, timestamps, a replica identity, and the attachment aggregate's reason names are the whole of it: no subject, no address, no remote folder path, no attachment filename, and no exception detail. A replica identity is the machine name and the process identifier of a MailFathom process, which names a container or a pod rather than a person.

Reading what MailFathom changed

The audit route serves one bounded, keyset-paginated page of one account's finished changes, newest first. The account is required rather than optional, and that is deliberate: the answer says where a person's mail has been and at whose instruction, so a caller names whose history they are reading rather than asking for a deployment-wide list.

Query parameter What it does
account Required. The identifier this deployment generated for the account whose trail is read.
mutation Narrows to one change: relocate, delete, set-seen, copy, set-flagged, add-keywords, remove-keywords, or set-keywords.
from, before Narrows to entries that ended within a range; from is inclusive and before is exclusive.
pageSize Between 1 and 200; 50 when omitted.
cursor The nextCursor the previous page returned.
$ curl -sS -H "X-API-Key: $MAILFATHOM_ADMIN_KEY" \
    "http://127.0.0.1:8090/api/admin/mailbox/mutations/audit?account=5b0c7d2e-8f41-4a7e-9c1d-2f6b3a9e4d10&mutation=delete&pageSize=2"

The response carries the entries and, while more remain, the cursor the next page is asked with. A walk ends when no cursor comes back, never by comparing a short page against the size you asked for. A cursor names a boundary within the filters it was issued for, so presenting one alongside different filters is refused with 400; changing only the page size is not, because pacing is not a filter. Every other refusal is 400 too, with a sentence naming what to change: an account this deployment does not hold, a mutation name that is not one of the eight, a page size outside the range, a range that ends where it begins, and a cursor this deployment did not issue.

Nothing in the answer is mail. Folder paths, UIDs, the local email identifier, the requester, the two timestamps, and the outcome are what an entry holds, which is what makes the route readable without exposing the message it is about.

An entry a later build wrote and this one cannot interpret — one naming a change this version does not permit — is left out of the page rather than failing it, and a warning names the account and how many were left out. The rows stay in the trail and a build that permits the change reads them; what the warning exists for is that a page quietly short of entries would be worse than one that says so, on a surface whose whole value is being complete.

Erasing entries for a data-subject request. Retention erases what has outlived each account's configured window, and that is the ordinary path. A request that reaches further — erase everything held about one person's mail now — is answered against the table directly, because the trail deliberately survives the deletion of the mail it describes and therefore has no cascade to ride:

DELETE FROM mailbox_mutation_audit_entries
WHERE "MailboxAccountId" = '<account id>'
  AND "StoredEmailId" = ANY($1);

The identifiers are the local email identifiers the entries name, which the same account's mailbox queries return for the messages in scope; erasing the whole of one account's trail is the same statement without the second predicate. Take it as a deliberate administrative act on a database you have a backup of: nothing here replays an erasure, and the entries it removes are the accountability evidence for the changes they recorded.

Reading what a question read

The answering route is the same shape for the other half of the question an operator has. The mutation trail answers "why is this message in this folder"; this answers "why did it answer that" — which messages one ask_mail run retrieved from an account, and which of them the response went on to cite.

Query parameter What it does
account Required. The identifier this deployment generated for the account whose record is read.
from, before Narrows to runs that ended within a range; from is inclusive and before is exclusive.
pageSize Between 1 and 100; 50 when omitted.
cursor The nextCursor the previous page returned.
$ curl -sS -H "X-API-Key: $MAILFATHOM_ADMIN_KEY" \
    "http://127.0.0.1:8090/api/admin/answering/audit?account=5b0c7d2e-8f41-4a7e-9c1d-2f6b3a9e4d10&pageSize=2"

The page is smaller than the mutation trail's because an entry here carries a list rather than a fixed set of columns: one row per message the run read, each with the position it was reached at and whether the answer cited it. There is no narrowing filter beside the account and the range, because the questions worth asking of this record are about a mailbox and a period rather than about a kind of run.

An entry names the run it belongs to, the chat endpoint alias the run was conducted through, the version of the instruction it was conducted under, when it began and ended, how it ended, and how it degraded. A question asked across two accounts leaves one entry per account, sharing a runId and each naming only its own account's mail.

Nothing in the answer is mail. There is no question, no answer, no retrieved extract, and no subject — the identifiers are what a reader fetches the messages themselves with, through the reads that already serve them, and storing anything more would make this record a second copy of the mailbox with its own retention.

The same refusals apply, for the same reasons: an account this deployment does not hold, a page size outside the range, a range that ends where it begins, and a cursor this deployment did not issue are each 400 with a sentence naming what to change. An entry a later build wrote and this one cannot interpret — one naming an ending or a degradation this version does not declare — is left out of the page rather than failing it, and a warning names the account and how many were left out.

Erasing entries for a data-subject request. Unlike the mutation trail, this record follows the mail it names: erasing a message erases it from the runs that read it, through the same cascade every other derived row rides. That is the difference between recording an act performed on mail and recording that mail was read. Retention erases whole entries at each account's configured window, and a request that reaches further is the same statement the mutation trail takes:

DELETE FROM mail_answering_audit_entries
WHERE "MailboxAccountId" = '<account id>';

Take it as a deliberate administrative act on a database you have a backup of.

Administering the embedding profile

Three commands, and none of them takes a model, a provider, or a vector width as an argument. Configuration declares what this deployment embeds with and ADR 0006 leaves these the imperative half: the act that takes a declaration up, the act that stops it, and the reading that says where it got to. Editing a configuration file costs nothing; activating is the first thing MailFathom does that costs money per unit of mail.

$ mfctl embedding status
Deployment:      production (https://mail.example.test:8443)
Answered by:     mailfathom-7c9f4d8b6-2xql:1
Declared:        openai text-embedding-3-small, 1536 dimensions, Cosine
Serving:         openai text-embedding-3-small, 1536 dimensions, Cosine — 4,120 of 4,120 messages embedded; nothing outstanding
Reindex:         none running.
Next pass here:  due at 2026-08-08 12:14:30Z
Provider here:   Serving, as of 2026-08-08 11:59:00Z
Spend:              1,200 of 50,000,000 characters; the period rolls over at 2026-08-09 00:00:00Z
Attachments:        980 of 1,240 messages with attachments read; 412 attachments left over 88,104,336 octets
Attachment yield:   1,504 document extracts and 96 described images; 3,918,220 characters of lexical index
Attachment skips:   61 in a format this deployment does not read; 12 encrypted, so nothing could be opened; 4 carrying no text to read, which is what a scan looks like
Extraction spend:   214,880,112 octets read, against no declared ceiling; the period rolls over at 2026-08-09 00:00:00Z
Description spend:  96 of 500 description calls; the period rolls over at 2026-08-09 00:00:00Z

mfctl embedding status is the command to run when semantic search is not returning what you expected. It answers that question six ways at once, because it has six answers that look nothing alike: no provider declared, a declaration nobody activated, a provider refusing the credential, a reindex still running, a budget period spent, and a walk whose next pass is simply not due yet.

The five attachment lines answer a question the six above cannot, which is why they are reported apart rather than folded in: a mailbox may be entirely embedded on its message text with every document in it still unread, and the two workloads are counted in units that do not convert. Attachments is coverage, Attachment yield is what reading produced — the last figure being lexical-index growth, which is storage rather than provider spend — and Attachment skips is an aggregate over reasons, never a list of attachments: it says how much of a mailbox cannot be read without naming one message, one filename, or one sender. The two spend lines name their own unit in every reading, because octets read and calls made are not the same quantity and a bare number would invite adding them. Attachment text extraction holds what each bounds. The line to read first is Declared, which says so outright when an activation is outstanding — an edited configuration file changes nothing until one happens, and this is where you find that out rather than from search results that stayed the same.

Two of those lines are the answering replica's own, and they say so in their labels. Next pass here is when that process will next take a backfill pass, and Provider here is what that process last saw of the provider; neither is durable, so on a deployment running several replicas each answers for itself and a second reading taken from a load balancer can name a different instant without anything being wrong. Answered by on the first block is the replica that composed the answer, which is what makes the two readings comparable. Everything else here — the declaration, both generations, the coverage, and every spend period — is read from the database and is the deployment's, so it reads alike whichever replica answers.

Next pass here is the line for the minutes just after an activation, when a deployment that is waiting and one that is failing read identically everywhere else: nothing serving, nothing embedded, and a provider nothing has been asked of. An activation asks for a pass immediately, so the instant it names is normally the one now or a moment away rather than the end of an interval an earlier pass chose; none scheduled means the deployment has only just started, or that EmbeddingBackfill:Enabled is false and it walks no stored mail at all. Embedding backfill holds the pacing this line reports.

mfctl embedding activate reads the estimate, states it, and asks. The deployment counts the passages the run would send and expresses them as characters and approximate tokens, weighs them against Embeddings:MaxInputCharactersPerPeriod, and the command puts both numbers on the screen before the question:

$ mfctl embedding activate
Declared:  openai text-embedding-3-small, 1536 dimensions, Cosine
Forecast:  This deployment is not embedding under that model, so activating starts a reindex.
Estimate:           41,208 passages to send (18,700,412 characters, roughly 4,675,103 tokens).
Spend:              0 of 50,000,000 characters; the period rolls over at 2026-08-09 00:00:00Z
Attachments:        0 of 1,240 messages with attachments read; 3,910 attachments left over 812,004,336 octets
Extraction spend:   0 octets read, against no declared ceiling; the period rolls over at 2026-08-09 00:00:00Z
Description spend:  0 of 500 description calls; the period rolls over at 2026-08-09 00:00:00Z
Embed the mailbox under that model? [y/N]

The estimate is on standard output and the question is on standard error, which is the split every command here keeps: what a redirected invocation captures is the reading, and the person who started it still reads the question, the guidance, and the failures. Colour marks a failure and a caution, and on a reading it marks a column heading and a label naming a value; guidance carries none, and neither does anything else. A run whose output is redirected or whose environment sets NO_COLOR is written without escape sequences at all.

The prompt is the default and --yes is the exception, for scripted use. An invocation whose input is redirected and which passes no flag is refused rather than answered out of whatever was piped in. Activating what is already serving spends nothing and is performed without a question; activating while a different reindex is running is refused with 409, naming the cancellation as what makes it possible.

An estimate above the ceiling is refused outright, with 409 naming both numbers. It is not started and paced: ADR 0006 takes a budget that only slows a run down to be a schedule rather than a budget. Raising Embeddings:MaxInputCharactersPerPeriod, or setting it to zero to declare no ceiling at all, is what gets past it.

The two attachment ceilings refuse it on the same terms, and on their own count. Activating a profile is the moment a deployment that has also switched attachment reading on begins deriving at scale, so what reading the stored mail would open and how many descriptions it could make are weighed here beside the passages — and either estimate past what one period admits refuses the activation, so an operator agreeing to one bill is not handed the other afterwards. The refusal names the key: Embeddings:AttachmentText:MaxInputOctetsPerPeriod for the octets and Embeddings:ImageDescription:MaxDescriptionsPerPeriod for the calls, each with zero declaring no ceiling at all. A deployment that reads no attachment reports nothing outstanding and is never refused by this.

The ceiling weighed here is the deployment's alone, and Embeddings:MaxInputCharactersPerPeriodPerUser is deliberately absent from this reading. An activation reindexes every user's mail under one profile — the profile is what a stored vector means, so it is deployment-wide — and there is no user for this estimate to be weighed against. What the per-user ceiling then does to the reindex is what it does to any other work: the walk steps past a user who has spent their share and keeps embedding everybody else's, until the period rolls over.

mfctl embedding cancel-reindex stops a run you have changed your mind about. The generation being built is abandoned and its partial vectors are removed; nothing about search results changes, because that generation was never read. A cancellation arriving after the run finished reports that nothing was building and changes nothing — this command never takes a serving generation out of service. Changing the embedding model is the whole procedure these three commands drive, including what a switch and a rollback cost.

Nothing any of the four routes answers with is mail: model names, counts, character totals, timestamps, and a profile identifier are the whole of it.

Reading the rules, running them, and finding out what they did

Five commands, and none of them writes a rule: they run the rules and read what the rules concluded, and none of them creates, edits, enables, disables, or deletes one. A rule is authored in configuration, where an edit is reviewable in a diff before it reaches a mailbox, and that remains where a rule belongs — but mfctl config reaches those settings like any other, so mfctl config set MailRules:Rules:1:Enabled false is a change an operator can make without a restart and without a diff. MailRules is the section they are declared in, mail rules is the whole authoring surface, and reading and changing the configuration is what a persisted change is.

mfctl rules list is the command to run after editing rules. A reload whose rules do not validate is refused and leaves the previous set running, which reaches the deployment's log and nothing else — so an edited file and an unchanged deployment read identically until this is asked:

$ mfctl rules list
production — rule set a1b2c3d4e5f6
Configuration: accepted. What is running is what the file says.

Rule                     Applies to     Runs on                                              A match
file-invoices            work           Arrival                                              relocate → archive; ends the pass
retire-old-newsletters   every account  nothing automatically; 'mfctl rules run' applies it  setSeen → read
archive-old-newsletters  every account  Schedule (daily:03:00:Europe/Warsaw)                 relocate → archive

The order is the answer as much as the rules are: which rule reaches a message first is a property of the set, and a rule above another that ends the pass is why the one below it never runs. mfctl rules show <name> reports one rule in full, including the facts its condition can read. Neither prints the condition an operator wrote — a compiled rule carries no text, which is what keeps an address somebody typed into a condition out of every record naming the rule.

Runs on is the triggers the rule declares, and the second rule above is what a rule naming none reads as — whether it writes "Triggers": [] or leaves the key out, which say the same thing. Such a rule is bound, validated, and applied by a whole-mailbox run like any other, and no arriving message reaches it — so the wording says what does run it rather than reporting an empty list, because a rule nothing fires by itself and a rule that never matches look identical in a history that records neither. A rule declaring Schedule names its occasions beside the trigger, in the canonical form the deployment read them as — which is how an operator tells a schedule that was accepted as written from one they meant to write.

mfctl rules run --account <id> applies the rules to mail that arrived before them. It returns as soon as the deployment has written the request down and never waits for the walk; the pass is a step of the account's synchronization run, so this terminal is not what keeps it alive and closing it cannot cancel one. Asking twice is asking once, and the command says which of the two happened:

$ mfctl rules run --account 5b0c7d2e-8f41-4a7e-9c1d-2f6b3a9e4d10
A rule run over work has been asked for.
Progress:  0 evaluated, 0 matched, 0 skipped
The run is carried by the account's synchronization runs. Watch it with 'mfctl rules run-status --account 5b0c7d2e-8f41-4a7e-9c1d-2f6b3a9e4d10'.

mfctl rules run-status --account <id> is where it is watched from, and an account nobody has ever asked for a run is an answer rather than an error. A run under way says what started it — under way, started by RequestedRun for one this command asked for, started by ScheduledRun for one a rule's own schedule asked for — because the two walk the same mail and reach different rules. Running the rules over mail you already have holds what a run guarantees, including what happens to one when the rules change under it.

mfctl rules history --account <id> answers what a rule did, and why a message is where it is. Narrowing to a rule with --rule answers "what is this rule doing", including the case where the answer is that it is evaluated constantly and never matches; narrowing to a message with --email answers "why is this message here". --page-size and --cursor walk it, newest first:

$ mfctl rules history --account 5b0c7d2e-8f41-4a7e-9c1d-2f6b3a9e4d10 --rule file-invoices
Evaluated             Rule           Outcome  Message                               Rule set                             Read                           Asked
2026-08-08 11:59:00Z  file-invoices  Matched  0199c3d0-0000-7000-8000-000000000002  a1b2c3d4e5f6 (RequestedRun, 4.0 ms)  senderDomain, attachmentCount  relocate → archive: Requested

Each row is one rule's conclusion about one message. A rule that was reached and answered no is recorded as NotMatched, a rule that could not answer at all is Failed with its reason beside it, and a rule the pass never reached leaves nothing at all — which is what tells "never matches" from "never asked". A change the rule asked for is Requested when a mutation record was opened for it, Refused with a classification where one could not be, and Withheld where another rule had already settled the message's fate.

The facts are names and never values. senderDomain says the condition read the sender's domain; what that domain was is not recorded, and neither is a subject, a matched span, or any other value the mailbox supplied. What the condition compared is retrievable from the rule set revision printed beside it, which identifies the configuration the expression was read from — so the reasoning is reconstructible without the record becoming a second copy of the mailbox. The same holds for what the run asked for: the record points at the mutation it opened rather than restating what happened on the server, which the mutation trail answers.

The history is held for MailRules:HistoryRetention and is erased with the mail it describes, whichever comes first. Nothing any of these four routes answers with is mail: rule names, folder aliases, special-use roles, mutation names, fact names, counts, instants, and identifiers are the whole of it.

Both views call the folder destination, and each answers it to the depth its own reader can use. A declared rule's action carries the text the rule wrote — an alias, or a role as role:Junk — because that view answers what does this deployment's configuration say. A history entry carries the alias the run resolved to, because that view answers what happened to this message. An action the run never requested — refused, or withheld because another rule had already settled the message — carries what the rule wrote instead, since a role that reached no folder has no alias to name and the rule's own words are what an operator has to correct.

Classifying the mail you already have, and reading what was concluded

Three commands, and none of them writes a setting: they apply the account's own classification settings to the mail this deployment already holds for it, and read what was decided. Whether that mail is classified at all, what a scanner is judged by, and what happens to junk are the account's to state, in the SpamClassification block of its record; the deployment's SpamClassification section registers the scanner and bounds what the process spends on it and reaches no mailbox's scope. The first is changed through the mail account routes and the second, without a restart, through reading and changing the configuration; neither is reached through these three. Spam classification is what the feature does.

mfctl spam run --account <id> is a dry run unless you add --apply. It returns as soon as the deployment has written the request down and never waits for the walk; the run is carried by the account's synchronization runs, so this terminal is not what keeps it alive and closing it cannot cancel one:

$ mfctl spam run --account 5b0c7d2e-8f41-4a7e-9c1d-2f6b3a9e4d10
A classification run over work has been asked for.
Folders:   INBOX
Acting:    no — this is a dry run; it records verdicts and leaves the mailbox alone. Add --apply to carry out what the switches ask for.
Progress:  0 scored, 0 already decided, 0 unreadable
The run is carried by the account's synchronization runs. Watch it with 'mfctl spam run-status --account 5b0c7d2e-8f41-4a7e-9c1d-2f6b3a9e4d10'.

--folder narrows the walk and is repeatable; it narrows within that user's own scope, and a folder outside it is refused, because a run over a folder nobody classifies would read the whole of it and record nothing. --rescore scores mail again even where its verdict was already reached under the settings now in force, which is the one form of the run that costs a scanner call per message however recently it was decided.

Asking twice is asking once, and the command says which of the two happened — including that the terms the second request carried were not applied to the walk under way.

mfctl spam run-status --account <id> is where the run is watched from, and where the answer to what would it do is read:

$ mfctl spam run-status --account 5b0c7d2e-8f41-4a7e-9c1d-2f6b3a9e4d10
Account:    work — Completed at 2026-08-12 11:30:00Z
Requested:  2026-08-12 11:00:00Z
Folders:    INBOX
Acting:     no — dry run
Rescoring:  no
Profile:    a1b2c3d4e5f6
Progress:   1240 scored, 0 already decided, 3 unreadable
Found:      37 junk, 4 undetermined, 37 would be acted on

Found is what an operator is deciding on: the junk the run reached, and how much of it the switches would act on. An account nobody has ever asked for a run is an answer rather than an error, and a run that ended an hour ago is still reported — it completed and you never asked are different answers. Superseded is a run the settings moved under, and Disabled one that was switched off under it.

mfctl spam classifications --account <id> answers why a message was filed. Narrowing to a message with --email answers "why is this in junk"; narrowing with --verdict answers "what would this run file". --page-size and --cursor walk it, newest first:

$ mfctl spam classifications --account 5b0c7d2e-8f41-4a7e-9c1d-2f6b3a9e4d10 --verdict Spam
Evaluated             Verdict                Message                               Folder  Under                                                     Signals                  Asked
2026-08-12 11:04:11Z  Spam (Scanner 15.2/5)  0199c3d0-0000-7000-8000-000000000002  INBOX   a1b2c3d4e5f6, scanner corpus spamassassin.4.0.2+20260801  X-Spam-Status, BAYES_99  relocate (0199c3d0-0000-7000-8000-000000000009)

The signals are names and never values. X-Spam-Status says the verdict rests on that header; what the header said is not recorded here, and neither is a subject, an address, or a sending domain. Under is the profile the verdict was reached under, which is what a run compares before scoring a message again. Asked names the change and the mutation record carrying it rather than restating what happened on the server, which the mutation trail answers.

Nothing any of these three routes answers with is mail: counts, verdicts, scores, signal names, folder aliases, mutation names, instants, and identifiers are the whole of it. Every refusal is 400 naming what to change, including an account this deployment does not hold, and the run route reads at most 8 KB of body.

Reading the background work that stopped, and deciding what becomes of it

Three routes, and the first of them is the only way a dead letter becomes visible without a database client. Work that has stopped is claimed by nobody and delays nothing, so it is invisible everywhere else: nothing retries it, no queue grows because of it, and the only signal it produces at all is mailfathom.jobs.dead_letters. Deciding what becomes of stopped work is what the three commands do with them.

The reading is deployment-wide unless a filter narrows it, because what has stopped is one question about the instance rather than one per configured mailbox. It serves one bounded, keyset-paginated page, newest first:

Query parameter What it does
type Narrows to one kind of work, by the job type's own name. A name this build does not run is refused.
account Narrows to work belonging to one configured account.
pageSize Between 1 and 200; 50 when omitted.
cursor The nextCursor the previous page returned. A cursor issued under different filters is refused.
$ mfctl jobs dead-letters
Stopped               Job                                   Kind                 Failed                                          Work                                                              Queued
2026-08-13 09:30:00Z  0199c3d0-0000-7000-8000-000000000002  classify-email-spam  Permanent PayloadUnreadable after 5 attempt(s)  account:work|email:0199c3d0-0000-7000-8000-000000000001 for work  2026-08-13 09:00:00Z

Run one again with 'mfctl jobs retry --job <id>', or write it off with 'mfctl jobs drop --job <id>'.

Nothing any of the three routes answers with is mail. A job's payload names a stored email or, for a classification an earlier build queued, a message occurrence, and it is never read: the reading projects the identity, the kind of work, the attempts spent, the failure classification and its recorded reason, and two instants. The idempotency key is the one field composed from a folder alias and a message identifier, and it is reported because a retry runs under it — an operator deciding whether to run something again is told which piece of work it is, never what the message said.

A row naming a job type this build does not run is left out rather than reported. A rolling deployment leaves rows written by a build declaring more types than this one, and offering a retry no worker could ever claim would be worse than an absence.

Both decisions name one job, read at most 4 KB of body, and answer 200 with what happened. Accepted is the decision having taken effect; JobUnknown and JobNotDeadLettered are outcomes rather than refusals, because two operators — or one operator and a list a few minutes old — reach them ordinarily and the caller asked a question the deployment could answer. 400 is kept for a body naming no job at all.

Retrying returns the same row to the queue with its attempts given back, so the work runs under the identity it was enqueued with rather than as a second piece of work; that is safe because a handler is registered on the promise that running it twice with one payload is the same as running it once. Dropping removes nothing: the row stays terminal, keeps the failure that ended it, and goes on holding the identity that stops the same trigger enqueuing the work again.

Reading what is in the outbox, and deciding about one message

Five routes, and they are two readings and two decisions. Nothing else makes a delivery problem visible from outside the database: a message that will not leave is claimed by nobody, delays nothing, and produces no reply anybody sees, so the first a user would otherwise hear of it is a recipient asking why they never got an answer.

GET /api/admin/outbox/summary is the cheapest of the five and the one safe to leave on a screen: one count per stage, naming no message. The listing beside it is deployment-wide unless a filter narrows it, and serves one bounded, keyset-paginated page, newest first:

Query parameter What it does
account Narrows to sends from one configured account.
stage Narrows to one stage, by the stage's own name. A name no send can stand at is refused.
pageSize Between 1 and 200; 50 when omitted.
cursor The nextCursor the previous page returned. A cursor issued under different filters is refused.
$ mfctl outbox status
Stage              Messages
Recorded           2
TransmissionBegun  1
Sent               418
Refused            3
Cancelled          0

3 message(s) are still waiting. See which with 'mfctl outbox list'.

$ mfctl outbox list --stage Recorded
Recorded              Message                               Account  Stage     Attempts  Failed                     Due
2026-08-19 09:00:00Z  0199c3d0-0000-7000-8000-000000000001  work     Recorded  2         failure 27001, reply 451   2026-08-19 09:30:00Z

Withdraw one that has not left with 'mfctl outbox cancel --message <id>', or offer one again with 'mfctl outbox requeue --message <id>'.

A stage is the whole of what a send's position means, and each of the five calls for something different:

Stage What it means What an operator does
Recorded The message and the intent are durable and no SMTP command has been issued for them. Nothing, unless it stays here — this is where a send waits between attempts. It is the one stage a withdrawal applies at.
TransmissionBegun The body began to go out and the server never answered, so whether anybody received it is unknown. Decide. Nothing attempts it again on its own, because a repeat may put a second copy in a mailbox rather than retrying a failure.
Sent The server accepted the message for every recipient it had accepted, and nothing more is owed. Nothing.
Refused The message will not be offered again, and the failure that ended it is on the record. Read what refused it. Offering it again is possible and needs the refusal restated.
Cancelled The send was withdrawn before delivery, and nothing was transmitted on its behalf. Nothing.

The listing names no recipient and no subject. A page of an outbox is otherwise a page of who this user writes to and when, a page at a time, and a terminal is exactly where such a page ends up in a screenshot. Who one message was for is read with GET /api/admin/outbox/{id}, which answers about a send somebody already has the identifier of and reports each address with what the server said about it — and which is published under mailfathom.admin.audit.read for that reason, so a monitoring credential granted mailfathom.admin.read watches the outbox without ever being served an address. Neither route reads the message: no subject, no body, and no raw MIME is loaded on this surface at all.

Both decisions name one send, read at most 4 KB of body, and answer 200 with what happened. Accepted is the decision having taken effect; RecordUnknown, StageDoesNotAllowIt, AttemptUnderWay, and RefusalNotRestated are outcomes rather than refusals, because an operator acting on a listing a few minutes old reaches them ordinarily and the deployment can answer either way. 400 is kept for a body naming no send at all.

Withdrawing is refused once transmission has begun, and the deployment says so rather than racing the worker: the condition is part of the single statement that writes the withdrawal, so an operator and a delivery attempt reaching one record produce one change. A success therefore means the message reached nobody. The record stays, holding the withdrawal and the identity that stops the same trigger queuing the same message again.

Re-queueing is an explicit act on one named send and never a set — a route that could re-queue a filtered selection would be a way to send an unknown number of duplicates with one request. It gives the attempts back, so the next delivery pass offers the message to the addresses still outstanding and to no others. A permanently refused send needs the refusal restated in the body (mfctl outbox requeue --message <id> --despite-refusal), because the record says a server will not take the message and offering it again is a decision to disbelieve that rather than a retry.

Erasing a folder you have stopped mirroring

mfctl folder erase --account <id> --folder <alias> is the only thing an operator has that takes a folder's local mail away. Nothing else an operator does does, deliberately: switching a folder's Synchronize off keeps what it stored, and removing its mapping leaves the rows where they are, so that editing a configuration file can never dispose of somebody's mail. That leaves an operator who means it with nothing to ask, and this is the ask. The mailbox's own user has one too, and it is theirs rather than yours: deleting a folder through the client can take the mail stored from it. On a mirrored account it does, unless the account's AuthoredFolderDeleteDisposition says to mark the folder deleted instead; on an account whose mailbox MailFathom holds that setting decides nothing, and a deletion moves the folder into the trash with its mail intact — only deleting one already in the trash erases it.

$ mfctl folder erase --account 5b0c7d2e-8f41-4a7e-9c1d-2f6b3a9e4d10 --folder archive
500 stored emails erased so far
1000 stored emails erased so far
1043 stored emails erased from ARCHIVE under work. The folder holds none, and its checkpoint went with them, so
mirroring it again starts from the beginning rather than resuming.

The row goes and PostgreSQL takes its raw MIME, its search document, its passages, their vectors, and any outstanding repair request with it — the same deletion path an erasing disposition already uses rather than a second one. On a deployment storing payloads in a bucket the object goes too, immediately after the pass commits, so an erasure is true of both stores rather than of the database alone; where the endpoint refuses, the bytes go within one reclamation interval instead, which an object nothing points at is reclaimed states in full. The folder's checkpoint goes too, in the pass that empties it, which is what makes a folder erased and then switched back on mirror from the start instead of resuming in front of mail that is no longer there. The alias survives: its binding stays, so the folder goes on resolving and goes on being somewhere a rule can file mail into.

A folder the account still mirrors is refused, naming the alias and saying what makes it erasable. Erasing one would open a hole the next run silently refills, so the two ways to mean it are to switch the folder's Synchronize off or to remove its mapping — and an alias no mapping names at all is accepted rather than refused, because a mapping somebody withdrew is exactly the case that needs erasing and the one case no configuration value can express.

One request is one bounded pass, and the command repeats it until the deployment reports nothing left, printing a running total as it goes. That is what makes an interrupted erasure resumable rather than a folder in a state nothing can finish: a pass either committed or did not, so interrupting the command leaves the rest where it was and running it again continues from there. Running it against a folder that already holds nothing succeeds having removed nothing, which is the ordinary end of every erasure.

Bringing stored mail up to a later release

Two routes beneath /api/admin/mailbox, and which one a property needs is decided by where its value comes from. A release adds properties to stored mail and nothing in a running deployment fills them in for the mail already mirrored, because a run resumes from the UID its folder's checkpoint records. Bringing stored mail up to a later release is the whole of what each one refreshes and what neither touches; this is what the endpoint serves.

mfctl mailbox rederive is the cheap one, and the one to reach for first. Everything the stored payload itself carries — the sender identity the receiving server authenticated is today's example — is already on the deployment's own disk, so it is a local read, a parse, and an update of the message's own columns. It opens no mailbox session, so it cannot set \Seen, and it rewrites no stored content:

$ mfctl mailbox rederive --account 5b0c7d2e-8f41-4a7e-9c1d-2f6b3a9e4d10
A re-derivation of every folder under work has been asked for.
Requested:  2026-08-18 12:00:00Z
Progress:   0 re-read, 0 unparseable, 0 no longer stored
The deployment carries the run in the background. Watch it with 'mfctl mailbox rederive-status --account 5b0c7d2e-8f41-4a7e-9c1d-2f6b3a9e4d10'.

The request records the run and returns; the deployment carries it. The walk is durable background work under the job queue, enqueued against the account, so the operator's terminal is not what keeps it alive and closing one cancels nothing. One attempt of that work is several bounded passes with its lease renewed between them, and an attempt that ends early — a shutdown, an execution timeout — leaves what its passes committed and hands the rest of the scope to the next segment, which resumes past the stored position rather than starting the scope over.

Asking again while a run is outstanding is answered with that run, because the idempotency key carries the scope and the run it is on. started says which of the two happened, and carriage says what is actually advancing the run: carried for a segment waiting in the queue or being worked, queue-at-capacity for a deployment whose queue was at its bound, which has recorded the run and is carrying nothing until the same request is made again, and stopped for a segment the deployment will not attempt again — read it with mfctl jobs dead-letters and return it with mfctl jobs retry. The command reports both of the latter as a failure and names which one it met, since an operator watching a run nothing is walking would wait forever, and the two are undone by different commands.

A second command reads it, on the same path with GET and the scope in the query string:

$ mfctl mailbox rederive-status --account 5b0c7d2e-8f41-4a7e-9c1d-2f6b3a9e4d10
Scope:      every folder under work — under way
Requested:  2026-08-18 12:00:00Z
Progress:   1,043 re-read, 0 unparseable, 0 no longer stored
Mail carrying MIME no reader could parse kept what was already recorded for it.
If it stops moving, look for the work that stopped with 'mfctl jobs dead-letters'.

The two rejection counts stay apart because they ask different questions: mail nobody can parse keeps whatever an earlier release read from it, and mail whose raw MIME is no longer stored is reachable only by a rewind. A scope nobody has ever asked about answers with no run rather than 404. A run that reaches the end of its scope forgets its position, so asking again after the next release re-reads the scope from the beginning — which is what the command exists for. A run that stops moving stopped as a job: mfctl jobs dead-letters is where a permanently failed segment is read, and mfctl jobs retry is what puts it back.

mfctl mailbox rewind is the expensive one, and the only answer for a property the mail server alone knows — a flag, a keyword, the internal date. It discards the durable synchronization progress of the scope's folder bindings, so the next runs read them from the first UID inside the account's window and everything the server knows is read again:

$ mfctl mailbox rewind --account 5b0c7d2e-8f41-4a7e-9c1d-2f6b3a9e4d10
Scope:  every folder under work
Cost:   22,500 stored emails would be fetched from the mail server, re-read, and stored again.
Rewind that scope? [y/N] y
Rewound:  ARCHIVE
          INBOX
Each reads from the first UID inside the account's synchronization window on its next run. Nothing was erased, and a
run already under way is refused its next advance rather than corrupting this.

The cost is read before it is performed, which is one path answering GET with what the scope holds and POST with what was discarded — the same arrangement the embedding activation uses, and for the same reason: the figure an operator agrees to and the figure the deployment acts on have to be one figure. --yes states the agreement in the command, which is what a scripted rewind needs; an invocation with input redirected and no flag is refused rather than reading an answer out of whatever was piped in. A scope the assessment counted nothing in is asked about like any other: the count is the mail the deployment stores rather than what a run would fetch, and a folder whose local copies are all tombstoned counts nothing while its bindings still hold the progress the rewind takes away.

Nothing is erased and nothing is duplicated. A rewind removes one row of progress per binding; the mail, its raw MIME, its passages, and their vectors stay where they are, and re-reading an occurrence stores over the local email already at that identity. A synchronization run already under way loses the race safely — it decided from progress that no longer exists, so its own advance is refused rather than written over the rewind — and the answer names the folders whose bindings held progress, which is what says the removal won.

All three take --account and an optional --folder; without it they cover every folder the account holds mail in, including one whose mapping was withdrawn. Two scopes are two runs, so re-deriving one folder says nothing about the account's own walk. Each write reads at most 4 KB of body — both reads are a GET and name their scope in the query string — and every refusal is 400 naming what to change: an account this deployment does not hold, and text that is not a folder alias. A folder named blank is an omission rather than a refusal, because a caller writing a URL cannot express the difference.

Neither route touches embeddings, and neither re-runs classification for a verdict already recorded. Chunks and vectors stay the embedding profile's business, so a refresh cannot quietly spend the provider budget an operator has not asked to spend.

Carrying stored content into the object backend

Four of the six routes beneath /api/admin/content, and what they are for is the half of the object backend a setting cannot decide. Selecting ContentStorage:ObjectStorage writes the next payload to the bucket and leaves everything already stored in PostgreSQL, so a deployment that has been synchronizing a mailbox for a year has all of it in the database still. Moving stored content into the bucket is what one pass does and what it costs; this is what the endpoint serves.

mfctl content move records the move and returns. The passes are the deployment's own background work, one per ContentStorage:Move:Interval, so an operator's terminal is not what keeps the move alive and closing one stops nothing:

$ mfctl content move
To move:  22,500 payloads carrying 1,048,576 bytes
Move that content into the object backend? [y/N] y
Move:      under way
Progress:  0 moved carrying 0 bytes, 0 left in the database
Watch it with 'mfctl content move-status', and stop it with 'mfctl content move-pause'.

The backlog is read before the move is asked for, which is one path answering GET with what the database holds and POST with the move it now has — the same arrangement the rewind and the embedding activation use, and for the same reason. --yes states the agreement in the command; an invocation with input redirected and no flag is refused rather than reading an answer out of whatever was piped in. A deployment naming no object-storage endpoint is refused with 400 naming ContentStorage:ObjectStorage, rather than given a move that would carry nothing while looking exactly like one that is working.

Asking twice is asking once. A move already running or paused is answered with itself rather than started over, so a second request never discards the position an operator stopped at. A move that finished is what a further one is asked for past, which is how payloads an earlier move left behind are reached once the reason has been repaired.

A second command reads it, on the same path with GET:

$ mfctl content move-status
In the database:  21,457 payloads carrying 987,136 bytes
Move:             under way
Requested:        2026-08-24 12:00:00Z
Progress:         1,043 moved carrying 61,440 bytes, 0 left in the database

It answers on a deployment that has never been asked for a move and on one that stores its content in the database, because the backlog is exactly the figure an operator weighs before selecting the other backend at all. Then it says what to do next, which differs for each of those answers.

Stopping and resuming are paths of their own rather than a field in a body, because they are opposite decisions and a mistyped value must never be the difference between stopping a move of somebody's mailbox and starting one over. Neither carries a body. Pausing cancels nothing — the pass that is running finishes the one payload it holds and the next one finds the move stopped — and resuming continues from the committed position. Both answer 404 on a deployment that has never been asked for a move, which the command reports as there being none to act on.

Nothing here reads mail into the answer. Every one of the four answers with counts, an instant, and a state name; the position the next pass resumes from is deliberately not served, because it is the identity of a row rather than a figure an operator acts on and it would say which message the move is at.

Freeing the copies the move left behind

The remaining two routes, and the write among them is the only thing beneath this prefix that removes mail. The move copies and never removes, so a deployment part way through one holds its content twice: the object it now reads from, and the payload the database went on holding so that a read still works while the bucket is being trusted for the first time. Reads use it — where an object is absent or is not what its row records, the retained copy answers and the fallback is counted — and ending that duplication is a request of its own.

One path, two verbs, two grants. GET reports what is duplicated under mailfathom.admin.read, because how much of a database is a copy is a question about what a deployment holds. POST frees a batch under mailfathom.admin.erase, because removing the last copy of a message outside the bucket is disposal rather than work. That split is deliberate: a credential that may start the move must not be able to end it.

$ mfctl content release
Retained:  22,500 payloads carrying 1,048,576 bytes
Free those copies, leaving the object backend the only place that mail is held? [y/N] y
Released:  22,500 payloads carrying 1,048,576 bytes
The object backend now holds the only copy of that content. PostgreSQL reclaims the space on its own schedule, so what
falls immediately is what a new backup has to carry rather than what the volume reports.

One request is one bounded batch, of ContentStorage:Release:PayloadsPerBatch payloads, and the command sends as many as the deployment needs. Answering after each batch is what makes an interrupted release resumable rather than a state nothing can finish: what a batch freed stays freed, and running the command again continues.

It is refused outright while the move is unfinished. A payload the database still owns is one no object was ever verified for, so freeing the copies of everything else would end the safety of a job somebody is in the middle of. The refusal is 409 naming that backlog rather than 400, because nothing is wrong with what was asked and asking again once the move reports no backlog is exactly the right thing to do.

A copy still inside ContentStorage:Release:SafetyInterval is left where it is. The interval is measured from when the move verified the object, so a batch can answer having freed nothing while copies remain; the command says which setting is holding them and stops rather than asking again for the same answer.

What this removes cannot be undone from anywhere but a backup, and there is no route that carries content back out of the bucket. Moving stored content into the bucket holds the order of the steps and what each one cannot be undone from.

Carrying a mailbox out of this deployment

mfctl export is how one account's stored mail leaves as an archive. Carrying a mailbox out is the operation in full — what the archive holds, how long one is kept, and what an operator owes a mailbox nothing else holds; this is the command group over it. All seven routes are published under mailfathom.admin.export, a name no reading grant confers.

$ mfctl export measure --account work
To export:  48,210 messages carrying 12,884,901,888 bytes of stored mail

Folder        Messages           Bytes
INBOX           31,004   8,589,934,592
Archive         12,880   3,221,225,472
Sent             4,326   1,073,741,824

Nothing was written. Start the export with 'mfctl export start'.

$ mfctl export start --account work
To export:  48,210 messages carrying 12,884,901,888 bytes of stored mail
Export that mailbox? [y/N] y
Export:     0199a0c0d4b17c2e9f3a5b6c7d8e9f01
State:      queued
Written:    0 messages carrying 0 bytes
Archive:    no archive to keep

Watch it with 'mfctl export status', and fetch it with 'mfctl export download' once it is finished.

$ mfctl export status --account work --export 0199a0c0d4b17c2e9f3a5b6c7d8e9f01
Export:     0199a0c0d4b17c2e9f3a5b6c7d8e9f01
State:      being written
Written:    18,400 messages carrying 4,915,200,000 bytes
Archive:    no archive to keep

$ mfctl export download --account work --export 0199a0c0d4b17c2e9f3a5b6c7d8e9f01 --output work-mailbox.zip
Written:    /home/operator/work-mailbox.zip
Size:       11,274,289,152 bytes

The deployment still holds the archive. Free that storage with 'mfctl export delete'.

Measuring reads no payload, so the answer comes back in seconds whatever the mailbox holds. mfctl export start measures again and asks before it commits, which --yes skips.

Starting one answers immediately. The archive is written by a background job, so nothing is held open for the length of a mailbox, and mfctl export status is how it is followed. Asking again for the same scope answers with the export already running; a different scope while one is running is refused with 409.

The download streams to disk. The archive is served straight from the object store, and the command writes it as it arrives under whatever --output names, defaulting to mailfathom-export-<id>.zip. A partial file is removed rather than left behind when the transfer fails.

Two commands end an export. mfctl export cancel stops one still being written and deletes what it had produced; mfctl export delete removes a finished archive before its retention ends, and repeating it on one already gone succeeds.

A deployment keeping its content in the database is refused, with ContentStorage:ObjectStorage named in the refusal. An archive is a second full copy of the mailbox, and there is nowhere to put one.

Administering the contact book

mfctl contact is where the contact book is maintained: people, the addresses they use, and what you recorded about them. The book's own rules — what identifies a person, when two addresses are the same address, who may change what — are that page's; this is the command group over them.

Every command here names the book it reaches. There are two kinds of book — a user's own, holding the people they wrote down, and a mail account's, holding the addresses its mail picked up — and this surface acts for nobody in particular: it is the deployment's administrator rather than somebody whose mail is being served, so nothing about the credential says whose book is meant. Every command but one therefore takes --user and acts on what that user reads, their own book beside the collected book of each mail account assigned to them; contact delete-collected takes --account instead, because emptying what one mailbox picked up is not emptying what another did. --user is optional where the deployment holds one person — the command asks which users exist and acts on the single one — and an invocation on a deployment holding several without it is refused with the identifiers to choose between rather than answered for whichever user came first. Asking which users exist is a read of the roster, which is published under mailfathom.admin.read rather than under the grants the contact routes carry — so a credential provisioned for the contact surface alone is refused there rather than at the command's own act. Pass --user to skip that read, or grant mailfathom.admin.read beside it.

$ mfctl contact create --name "Anna Kowalska" --address anna@example.test --note "Met at the conference."
Recorded contact 018f2b1c-9b3a-7c41-8f7d-2c6a5e9d10ab.
Contact:    018f2b1c-9b3a-7c41-8f7d-2c6a5e9d10ab
Name:       Anna Kowalska
Origin:     Asserted
Addresses:  anna@example.test  (preferred)
Note:       Met at the conference.
Recorded:   2026-08-16 09:00:00Z
Amended:    2026-08-16 09:00:00Z
Command What it does
contact create Records a person into --user's own book. --address is repeated for each address they use, and --preferred says which to use by default — required as soon as there is more than one, because that is your choice rather than an ordering accident
contact show Shows one person out of the books --user reads, by --id or by --address. Naming both, or neither, is refused
contact list Reads one page of the books --user reads, optionally narrowed with --origin. --page-size bounds it and --cursor continues it
contact update Corrects --name, --note, --preferred, or the whole --address set, in --user's own book. What you do not name is kept; --clear-note holds no note afterwards
contact add-address Adds one address, keeping the rest. --preferred names which address to use by default afterwards
contact remove-address Takes one address off. --preferred is required when the one being removed is the default
contact promote Writes an asserted copy of a collected contact into --user's own book, leaving the mail account's record for the account's other users. It reports that the promotion happened rather than the record, because it sent none and reading the book is a permission of its own; contact show is how you look at the person afterwards
contact delete Erases the person from whichever of the books --user reads holds them. This cannot be undone; see below
contact delete-collected Erases the whole collected book of the mail account --account names, keeping every user's own. This cannot be undone; see below
contact export Writes everything the books --user reads hold about the person to standard output, as JSON

Amendments state the whole record. The book replaces what it is given rather than merging a difference, so update, add-address, and remove-address each read the contact first and send back what it is to become. Two operators editing one contact at once are therefore last-writer-wins; an edit racing an erasure is not, and is answered as a contact the book does not hold rather than putting the person back.

A collected contact is not amended in place. It belongs to the mail account's book rather than to a user's own, and a mailbox's other users read the same record — so contact promote is the act of taking one on, and it writes an asserted copy into --user's own book under a new identity, leaving the account's record where it is. Every command here then works on the copy, and the user's own record is what answers a read for them from that point on. Amending a collected record without promoting it is refused, and the refusal says so. An agent over the MCP endpoint reaches the same act as promote_contact, under the writing grant it already holds.

mfctl contact delete-collected is the way out of collection, for one mail account. Everything collection built for the account --account names goes, what another account collected stays, and nothing anybody wrote down is in that book to go with it. It asks first, --yes is how a scripted erasure states the agreement, and an invocation with nobody at the terminal and no flag is refused — the same rule the erasure of one person follows. What it asks names nobody, and what it answers is two counts. It cannot be undone, and switching collection off is a separate act in configuration: with it still on, the book fills again from the mail that arrives next.

mfctl contact delete is the contact book's erasure path. It removes the person and their addresses from the database rather than marking them, and nothing in MailFathom can put the record back. It reaches whichever of the books --user reads holds them, so erasing a collected record takes it out of the mail account's book for every user assigned that account rather than only for the one the command named. The command shows the record and then asks, and --yes is how a scripted erasure states the agreement instead; an invocation with nobody at the terminal and no flag is refused rather than having an agreement read out of whatever was piped in. It answers with what went — the identity and how many addresses — and never with the person. Erasing somebody the book does not hold succeeds having removed nothing, because that is the state you asked for.

mfctl contact export is the access path, and it writes one JSON document on standard output so it redirects into a file you can hand to the person who asked. It carries the complete record and the instant the export was taken; everything else the command prints goes to standard error.

The listing is bounded and there is no command that prints the whole book. A page holds 50 contacts unless you ask for fewer and never more than 200, ordered by the name's comparison form and then by identity. That order is total, so walking a page at a time serves every contact exactly once. A page that has more behind it prints the cursor the next one is asked with — and it is the cursor rather than the count that says so, because a page read over several books serves an address held in two of them once, and applies that as the page is read rather than to a page already served, so a page holds the size asked for until the walk runs out.

Every refusal names the rule rather than the value: a malformed address is reported as an address that is not usable and never echoed, and no name, address, or note reaches a log line, a problem document, a trace, or a failing command's output. What a failure names is the contact's identifier, which is the one part of the record that is not personal data.

Reading and changing the deployment's own configuration

mfctl config is how a persisted setting is read and changed without editing a database row and restarting over it. Configuration sources is the whole of what a write does and what it refuses; what belongs here is what the commands are for and how the two grants divide them.

$ mfctl config show MailboxSearch
MailboxSearch:
  SnippetsPerEmail = 3 [file (10-deployment.json)]
  WordsPerSnippet = 12 [persisted-layer]
2 settings, over persisted configuration version 7.

$ mfctl config set MailboxSearch:SnippetsPerEmail 5
Committed persisted configuration version 8.
  MailboxSearch:SnippetsPerEmail
    before: 3 (from file (10-deployment.json))
    now:    5 (from persisted-layer)

Every reading names the layer that decided the value, because a deployment composes its settings from files, the persisted layer, and the three sources an operator reaches for when something is wrong — so "what does this setting say" and "where would I change it" are one question, and answering only the first is what leads to a persisted write that commits and changes nothing. A write to a setting an outranking source supplies is refused for exactly that reason, naming the source; --even-if-shadowed is how staging a value beneath an override about to be removed is stated.

Reading is mailfathom.admin.read and every write is mailfathom.admin.configuration.write. That second name exists because a persisted setting decides what the deployment is rather than what it does next: the same write that corrects a search bound can widen a credential's grant or repoint a model provider. A monitoring credential is therefore told where every value is decided while being unable to decide one, and the operating grant does not carry the ability to redefine the deployment it operates.

mfctl config edit is the command for a change that is several settings at once, committed as one transaction over the version the buffer was opened at, and it needs $VISUAL or $EDITOR — a graphical editor needs the flag that makes it wait, such as VISUAL="code --wait", because the command reads the file back when the editor exits. An emptied buffer abandons the session and a buffer saved unchanged writes nothing. --format yaml opens the document as YAML and converts what was saved back to JSON before it is sent, as editing a document as YAML describes; mfctl user edit, mfctl user show, mfctl account edit, and mfctl account show take the same option.

mfctl config adopt is previewed and then confirmed, because after it the files stop deciding the settings it copied. --yes states the agreement where nobody is at the terminal, and mfctl config unset is what gives a setting back to its file.

Secret-bearing values never leave this endpoint. get, show, and the editing buffer all report the redaction marker, and a marker saved back leaves the setting exactly as it was — so an editing session over a document carrying a credential reference is safe, and no reading of this surface discloses where material is kept. What such a session may not do is change the block the credential sits in while leaving the marker standing, because the marker would then stand for a reference paired with something else; that save is refused naming the block, and the marker rule states what it covers and what to use instead.

The redaction covers the settings a write refuses as well as the ones a name announces, which is what makes that last sentence true rather than nearly true. A reading enumerates every key the deployment composed rather than only the ones MailFathom named, so ConnectionStrings:mailfathom — the connection string an orchestrator injects, whose password a deployment may legitimately have written inline — arrives under a key no naming rule recognizes. It is one of the settings the persisted layer is itself reached through and therefore one no write may persist, so a reading answers the marker for it and for every other path on that list. The consequence to expect is that mfctl config get ConnectionStrings:mailfathom reports (redacted), as do the connection and secret-interpretation settings beside it; where those values are set is the deployment's own manifest rather than this surface.

A reading answers the deployment's settings rather than the host process's environment. That same enumeration would otherwise reach every environment variable of the process, because the framework composes an unprefixed environment provider and it turns each one into a configuration path — so an unrelated OPENAI_API_KEY or a database password some sidecar exported under a name of its own would be handed to a credential holding mailfathom.admin.read alone. The naming rule above cannot help there: it decides by MailFathom's own vocabulary, and none of those names is MailFathom's. So a value an environment provider supplies at a path whose first segment names no MailFathom configuration section reports the marker, with the path and the source still named — the same shape a secret takes, because what an operator asks this surface is where a setting is decided. An environment variable that does name a MailFathom setting, which is every override written for this deployment on purpose, is reported in full.

Users and their records

A user is a person this deployment reads mail for, and a record is what it reads for them: the settings that are theirs rather than the deployment's. The mailboxes they are served are mail accounts of their own, assigned to them. A fresh deployment starts holding nobody but the default administrator, whom it serves on neither mail endpoint, and reads no mail until these routes record a user and an account is created for them, whether it will end up serving one person or a household: no configuration section names a user, and none declares a mailbox. A user is recorded here rather than declared anywhere, and one recorded is served without a restart.

Every route here is administrative, and the listing exists here and nowhere else. The client surface publishes the signed-in user's own record and nothing beside it, so nobody this deployment serves can be served a catalogue of who else it serves. What that costs an administrator is naming the user in every route; what it buys is that an identifier copied out of the wrong listing answers that no such user exists rather than editing somebody else's mailboxes.

Command What it does
mfctl user list Reads who this deployment holds, where each one's mail accounts come from, whether the running process serves them, and which of the MCP and client endpoints each one is served on
mfctl user add --display-name <name> Records a user this deployment did not hold, and reports the identifier they were minted under
mfctl user show [--format json\|yaml] [--effective] Reads one user's record as this deployment holds it, secrets redacted, as JSON or as YAML — or with --effective, each setting as the user is served it, with what supplied it and who holds it
mfctl user edit [--format json\|yaml] Opens that record in your $VISUAL or $EDITOR, as JSON or as YAML, and commits what you saved as one change
mfctl user rename --display-name <name> Replaces the label that user is told apart by
mfctl user endpoints [--mcp true\|false] [--client true\|false] Keeps that user off the MCP endpoint, the client endpoint, or both, or lets them back on
mfctl user set-organization (--organization <id> \| --none) Moves that user into an organization, or out of every one, which changes the login their passwords are typed as
mfctl user remove Erases the user and every message this deployment holds for them, which cannot be undone, and which is refused while their own mailboxes are still being written to

Every command but list and add takes --user, and none of them needs it on a deployment holding one user, exactly as the credential commands below: the command reads the roster, acts on the single user there is, and refuses rather than guessing where there are several — naming the identifiers to choose from, so the refusal is where an operator reads the one to pass.

An erasure stops that user's own mail work before it deletes anything, and refuses rather than erasing half. Most of what a user's erasure removes is reached from the rows it deletes, but a synchronization run and a job handler write rows keyed to a mail account rather than to the person — so a deletion racing one of them would answer that this deployment holds nothing while it was still being written to. What the request does first is therefore withhold the user from everything this replica serves, withhold every mailbox they were the last one assigned from this replica's synchronization, and hold the supervision of each of those mailboxes, which is the same lease a replica takes before it synchronizes that mailbox: holding it means no replica is running that account, and none starts one until the erasure has committed. A mailbox somebody else is also assigned is left running and is not held: the mailbox, its mail, and the work going on in it are untouched, because that mail is the other person's. What does go from it is what the erased user themselves authored there — their drafts and their standing recurring sends — since those are the departing person's rather than the mailbox's, and an erasure that left them would leave that person still present in a colleague's mailbox.

One deadline of 30 seconds covers both waits — the supervision of every mailbox and then the jobs held for them — rather than one each, so a request that spent most of it waiting for a mailbox has that much less left for the queue. Four different refusals come back as a 409, each naming the mailbox it is about, and nothing at all is erased when one answers: the user goes on being served exactly as before, and the same request is worth repeating.

  • The mailbox is still being synchronized. The deadline ran out with a run holding it, here or on another replica. Ask again once the run has ended.
  • A job is still running for the mailbox. The deadline ran out with a handler holding a job keyed to it. Ask again once it has finished.
  • The mailbox was still being worked on when the erasure reached it. Both waits succeeded, and the transaction then found the mailbox in a state neither had covered — an assignment that ended after the request read who holds what, leaving a mailbox solely this user's that nothing was holding, or a job claimed in the moment between the wait and the deletion. Ask again.
  • The mailbox stopped being held part-way through the erasure. A supervision hold could not be renewed while the deletion ran, so it was rolled back rather than committed while another replica could take the mailbox back. Ask again.

The first of them reads:

$ mfctl user remove --user 3f1d...
Erasing 3f1d... (alex) takes their record, their mail accounts, and every message, folder, attachment, and index
this deployment holds for them. Nothing here undoes it.
Erase 3f1d... (alex) and everything this deployment holds for them? [y/N] y
Mail account 1b8e2a40-5c31-4f7a-9d02-6ac41e5b7d10 is still being synchronized, so erasing it now would leave rows
behind that no deletion here could reach. Nothing was erased; ask again once the run has ended.

The confirmation is asked before any request is sent, so an answer of anything but y reaches the deployment not at all. --yes states the agreement in the command for a scripted erasure, exactly as it does for the rewind above.

On a deployment of several replicas the mailbox may be held by a replica other than the one the request reached, and that replica goes on supervising it — it reads the same account records from the database, which still hold the mailbox. Such an erasure is refused for as long as that lasts, and the way through it is to send the request again after that replica has moved on, or to reach the replica holding the account. A refusal is the deliberate answer here: an erasure answered as done while a run was still writing is the failure this exists to prevent.

A user is minted with an identifier that says nothing about who they are. It is a version 7 UUID, like every identifier MailFathom mints under ADR 0036: its leading bits are the moment it was recorded and the rest is random, and nothing in it is derived from a name or an address. An identifier appearing in a URL, a log line, or a support conversation therefore discloses when this deployment began serving somebody but never who they are, and it grants nothing to whoever holds it. The display name is what an administrator reads them by; it has to be unique across the deployment, so that two people are never told apart by an identifier alone.

The label may change and the identifier may not. mfctl user rename replaces one, and nothing is keyed by it — no mail account, stored message, or job hangs on a label — so the rename moves nothing and asks nothing before it commits:

$ mfctl user rename --display-name Alexandra
User 3f1d... is now labelled Alexandra.

The new label lasts, for every user this deployment serves. No configuration source names a user, so no start reads anybody's label out of a file and there is nobody for whom this reports a change the deployment undoes. The identifier is the opposite case, and configuration sources holds what changing one would cost.

Which endpoints a user is served on is two switches in the user's record, not a property of any credential. Both are on when a user is recorded, and a record that states neither reads as both on. mfctl user endpoints --mcp false keeps a person who only reads mail off the MCP endpoint, so no agent can act for them, and --client false keeps an automation account out of the mail client; a switch the command does not name stays where it is. The route beneath it is PUT /api/admin/users/{userId}/endpoint-access with {"mcpEndpoint": false}, {"clientEndpoint": false}, or both, it takes mailfathom.admin.configuration.write, and it answers both switches as the user is now served — the record's own, except where a settings policy forces one or supplies one the record leaves out. The switches are the record's EndpointAccess:McpEndpoint and EndpointAccess:ClientEndpoint, so mfctl user edit changes them too, and mfctl user show reads them back once either has been written:

{ "EndpointAccess": { "McpEndpoint": "false" } }

Whichever of the two writes them, the commit that stores the record writes the switches the user is served on onto the user's row in the same statement, and that row is what a request reads — authentication never reads a document. A user saving their own record over the client endpoint may carry the switches through as they stand and is refused a change to either.

A user kept off an endpoint is refused there whichever credential they present, exactly as an unknown credential is, and a session or a token they already hold stops working there on their next request, on every replica. Nothing is revoked or deleted, so turning a switch back on serves them again with what they still hold — disabling or deleting a credential is the act that ends one for good. The switch is judged where an endpoint authenticates. An endpoint configured to require no credential names no user from what a request presents, so it has no switch to consult and serves its one user as before; keeping somebody off such an endpoint means configuring a credential for it, or disabling it.

$ mfctl user endpoints --mcp false
User 3f1d... is served as follows from their next request, on every replica:
    MCP endpoint: off; client endpoint: on

A second user is refused while a user-facing endpoint authenticates nobody. A deployment serving one person may leave the MCP endpoint open, because there is only one answer to whose mail a caller is asking about. Recording a second person makes that question unanswerable, so the refusal names the endpoints to correct — require a credential on each of them, or switch them off — rather than letting the deployment reach a state in which one caller's request would be answered out of another person's mailbox. Requiring one is the whole of the correction: every credential these two surfaces admit is a record naming the user it belongs to, whichever method presents it. The administrative endpoint is deliberately not part of that check: it is the surface an operator is holding while they correct the others, and its credentials never name a user in the first place.

No route in the table above leaves a read with nobody to act for, because none of them asks the deployment who its user is: every user-scoped route names the user it acts for, in its own path or in a user query parameter, and the one route that reaches a mail account's own book names the account instead. The contact book was the last of them to be read for whoever the deployment served, and it is now read for the user the request names — their own book beside the collected book of each mail account assigned to them. Every mailbox read is in the same position: which accounts a caller owns is resolved from the user each served account carries rather than from a sole one.

One read still asks the deployment who its user is, and it is not on this surface: the attachment download the client endpoint serves. Its capability is a signed ticket rather than a credential, so nothing in the URL names a user and the deployment supplies one; on a deployment serving several it therefore answers 409 instead of the file, with a sentence naming the credential that would have been answered rather than reporting the deployment as broken. Recording the user in the ticket is what ends that, and it changes the capability's own format.

Nothing imports a mailbox a file used to declare. A deployment upgrading from a release that stated its own mail accounts does not start until MailSynchronization:Accounts is removed, and the refusal names these commands: record the person with mfctl user add, create each of their mailboxes with mfctl account add, and remove the section. The credentials each account needs are stated afresh as part of it, because nothing carries a secret reference across for you.

mfctl config adopt is a different command about a different thing — the deployment's own settings moving into the persisted layer, which has nothing to do with whose mailboxes these are — and it is unaffected.

mfctl user edit changes the whole record as one change. The record is fetched with its version, opened in $VISUAL or $EDITOR, and committed against that version. It carries no mail account: a saved record naming MailAccounts is refused, naming mfctl account edit as where an account is changed. An emptied buffer abandons the session and a buffer saved unchanged writes nothing, both reported as what they are rather than as a failure; a graphical editor needs the flag that makes it wait, such as VISUAL="code --wait", because the command reads the file back when the editor exits.

A record is committed whole or not at all, over the version it was read at. A candidate is composed with the mail accounts assigned to that user, bound strictly against the same rules a configuration file is, put through the same mail-synchronization validators a start applies, and judged for what each of those accounts asks about scanning the mail in it — and a candidate failing any of those is refused with what to correct rather than committed and discovered at the next restart. A scanning refusal names the deployment setting behind it and never quotes the record. A record another writer moved on in the meantime is refused as superseded, so nothing silently overwrites a change made from the client or from another terminal.

A record is read with each setting as the user is served it beside it. GET /api/admin/users/{userId}/record answers the record's own document — what somebody stated on it, which is what a save is composed over — and a properties list resolving every setting of the record through the settings policies governing the user:

Field What it holds
path The setting, as the colon-separated path a policy names it by, such as EndpointAccess:McpEndpoint
value The value the user is served with, or null where nothing states one and the build takes none
source Which step supplied it: DeploymentForced, OrganizationForced, Record, OrganizationDefault, DeploymentDefault, or BuiltIn
heldBy Deployment or Organization where that scope's policy forces the setting or withholds it from the person, otherwise null
changeable Whether a change from whoever read the record would be accepted: false where a policy forces the setting, and for every setting where the caller's grant does not carry mailfathom.admin.configuration.write over the user

Where a policy governing the user is one this build does not read, properties is empty and unresolved carries the sentence naming which. mfctl user show --effective prints the list in place of the document, one setting a line:

$ mfctl user show --effective
alex (3f1d...)
  version: 7
  ClientTelemetryLevel: (nothing stated)  [BuiltIn]
  DisplayName: alex  [Record]
  EndpointAccess:ClientEndpoint: true  [BuiltIn]
  EndpointAccess:McpEndpoint: false  [DeploymentForced, held by the deployment, not changeable while the policy forces it]
  Language: Polish  [OrganizationDefault]
  Portrait: (nothing stated)  [BuiltIn]
  TimeZone: Europe/Warsaw  [Record, held by the organization]

A forced value binds an administrator, and an editing restriction does not. A save that states another value for a setting a policy forces is refused under 12007, naming the setting and whether the organization or the deployment holds it, and commits nothing; mfctl user endpoints asking for the other position of a forced switch is refused the same way. A save that carries a forced setting through — unchanged from the record's own value, or as the value in force — passes and leaves the record's own value where it was. What a policy's Editing block withholds, it withholds from the person the record is about: an administrator writes those settings as before.

EndpointAccess:McpEndpoint is held by the deployment, whose settings policy forces its value, so nothing written on the record changes it. Leave it as the record states it, or change the policy.

Every secret reference is resolved before a commit, and a change is not refused over what an account already carried. A user record's save never touches an account, so a reference that stopped resolving in one of that user's accounts is reported beside the commit rather than refusing it: the answer names the setting, says the account already carried it, and names mfctl account edit as what clears it. An account write that introduces a reference reaching nothing, a secret name repeated within the composed record, or a trust anchor that cannot be loaded is refused, including one whose broken reference is replaced by another broken one; a problem the account already carried and the write leaves exactly as it was is reported the same way. It is still worth clearing before the next restart, because a start refuses a record carrying it.

Nothing here reports a secret. A record is handed over with every password, token, and client secret replaced by the redaction marker, and a save is read as the difference from what the row holds — so a marker saved back leaves the credential beneath it exactly as it was, and a marker this deployment cannot place is refused rather than committed over somebody's password. Material supplied through these routes is sealed under the deployment's data-encryption key like every other MailFathom secret, and what the record keeps is the reference to it.

A committed user record reaches the running process. Recording, changing, or erasing a user is taken by the replica that committed it once the database commit is durable, and announced to every other. The coordinator reads the accounts it supervises from the records on that announcement, stops scheduling the superseded account set, and starts the new one without a restart. A synchronization run already in flight keeps the snapshot it began with and drains before its supervisor ends, so one run never reads two document versions.

Organizations

An organization groups users and mail accounts under a short name, and the short name is what its members type in front of their username when they sign in with a password: a member of TESTFIRMA signs in as TESTFIRMA/jan, and somebody in no organization as jan. That is what lets two companies served by one deployment each have a jan. A user and a mail account each belong to no organization or to exactly one, and each is in none until one of these routes moves it — so every credential provisioned before a deployment recorded an organization signs in exactly as it did, and every account in none stays with the person it is assigned to. How a presented login is read is the password method's to state.

Command What it does
mfctl organization list Reads the organizations this deployment holds, with each one's short name, display name, member count, mail account count, and when it was recorded, and names beneath them any row whose stored short name this deployment will not read
mfctl organization add --short-name <name> --display-name <name> Records an organization, and reports the identifier it was minted under
mfctl organization rename --organization <id> --display-name <name> Replaces the name an operator reads it by
mfctl organization set-short-name --organization <id> --short-name <name> Replaces the short name its members sign in under
mfctl organization remove --organization <id> Removes an organization with neither members nor mail accounts
mfctl user set-organization (--organization <id> \| --none) Moves one user into an organization, or out of every organization; it takes --user as every other user command does
mfctl account set-organization --account <id> (--organization <id> \| --none) Moves one mail account into an organization, or out of every organization

An organization is minted with an identifier that says nothing about who it is. It is a version 7 UUID for the reason a user's is, minted from the moment the organization is recorded, so an administrative listing shows when each company was added and in what order but nothing else about it. The display name is what an operator reads it by, trimmed and 1 to 128 characters. The short name is 1 to 32 characters of A–Z, 0–9, and -, folded to upper case when it is written, and unique across the deployment, because it is half of a login; a / can never appear in one, since that is what separates it from the username.

Grouping people and mailboxes is a configuration write, and changing how people sign in is a credential write. Recording, renaming, and removing an organization and moving a mail account take mailfathom.admin.configuration.write, the grant that records users and assigns accounts, because they change how the deployment's people and mailboxes are grouped rather than how any of them signs in. Changing a short name and moving a user take mailfathom.admin.credentials.write, because each changes the login a password is typed as — a short name every member's at once.

An assignment stays inside one organization. A mail account in an organization is assigned only to that organization's members, and an account in none only to users in none; "none" counts as a value both sides must hold. So an account of one company cannot be handed to another company's person by a mistyped identifier, and neither can an account in none reach a member of one. Assigning across two is refused naming both:

The mail account belongs to organization '0197c0de-0000-7000-8000-0000000000a1' and the user to no organization. An account is assigned only to a user of its own organization, and one in none only to a user in none, so nothing was written. Move the account or the user first.

An account created for a user is created in that user's organization, so creating one never straddles two. What an organization narrows is who an account may be assigned to and nothing else: an assigned user reads and acts on the account exactly as anybody assigned it does. What an organization states for its members and accounts is its settings policy: what it states for users governs every member's record, and what it states for mail accounts is stored and governs no account.

Moving a user changes which settings policy governs them, and a move that would leave their record unservable is refused. The record is judged under the policies it would stand under — the deployment's, and the target organization's or none — inside the transaction that moves the user. A record the policy being left kept servable and the one being joined would not is refused with 409, naming what the record would be left without, and nothing is written onto the record to make the move pass:

The move would change which settings policy governs this user, and under the one they would move to their record is not one this deployment could serve, so they were not moved: Language is not stated, and every user record names the language MailFathom writes for that person in — the card beside a contact of theirs, a message that answers no correspondence. State 'English' or 'Polish'. Correct the record first, or have the policy they would move under supply what it is missing.

A record that was already unservable before the move refuses nothing, because the move did not break it. A move that commits rewrites the endpoint switches on the user's row to what the policies now governing them resolve, in the same transaction.

A mail account in no organization is one person's. Sharing a mailbox is something an organization does: an account in an organization is assigned to any number of that organization's members, and an account in none to at most one user, so two people who merely share a deployment are never handed the same mail. An account created for a user starts with that one assignment, and a second one is refused:

The mail account belongs to no organization and is already assigned to a user. An account in no organization is assigned to one person, so nothing was written. To share it, move the account and the users it is shared between into an organization first.

The account's users are counted in the transaction that writes the assignment, under the lock an assignment takes on the account, so two assignments of one account landing at once cannot both go through: the later one is answered with that refusal. Moving an account out of every organization is refused with 409 for the same reason while it is assigned to more than one user, naming how many, and unassigns nobody:

The mail account is assigned to 3 users, and an account in no organization is assigned to one person, because a mailbox is shared only inside an organization. Nothing was changed and nobody was unassigned. Unassign all but one of them first, or leave the account in an organization.

An account in none that held several assignments before this rule keeps them. Nothing is unassigned on an operator's behalf, and every later assignment of it is held to the rule. One address is held by one account in the whole deployment whatever organization holds it, which this changes nothing about.

A move never leaves an assignment straddling two organizations, and never unassigns anything. Moving a mail account is refused with 409 while it is assigned to any user the target would not admit, naming how many; moving a user is refused the same way while they are assigned any account the target would not admit. To move a company's people with its mailboxes, unassign them, move both sides, and assign them again. The check and the write share one transaction, under the locks an assignment takes, so an assignment and a move landing at once cannot both go through.

Changing a short name moves every member's login with it and rewrites no credential. A credential refers to its organization by identifier rather than by short name, so the new login works and the old one stops at the instant the change commits, and nothing is provisioned again.

Moving a user re-scopes their passwords in the same transaction. Only a password is scoped to an organization; an API key, a key pair, and a mapped subject are resolved by values unique across the deployment and are unaffected by where their user belongs. A move is refused with 409 naming the username when the target — the organization, or the users in none — already holds one of that user's usernames for somebody else, and nothing about the user changes.

An organization with members or mail accounts is not removed. The refusal says how many of each it still has, so an operator moves each of them out first rather than leaving users whose logins name a short name nobody holds, or accounts assignable only within an organization that is gone.

Settings policies

A settings policy is what one scope states once for the records beneath it: the defaults a user's record and a mail account start from, the values they are held to, and which of the rest the person may change. The deployment holds one, and each organization holds one of its own. What a policy states for users governs every user's record in its scope from the commit that stores it: how a settings policy resolves a user's record holds the order the two policies and the record are read in, and saving one never rewrites a record's own document. What a policy states for mail accounts governs every mail account in its scope the same way — the deployment's every account, an organization's the accounts that belong to it — and how a settings policy resolves a mail account holds what that means for a list, for the identity properties, and for a setting a declaration leaves out.

Command What it does
mfctl policy show [--organization <id>] [--format json\|yaml] Reads the deployment's settings policy, or with --organization that organization's, and the version it stands at, as JSON or as YAML
mfctl policy edit [--organization <id>] [--format json\|yaml] Opens that policy in your $VISUAL or $EDITOR, as JSON or as YAML, and commits what you saved as one change

--organization takes the identifier mfctl organization list reports, and left out the command addresses the deployment's own policy. Nothing in a policy is redacted, because a policy states nothing about a secret, so what show prints is what is stored.

A policy is one document with two sections, and each section takes three statements. Users speaks for a user's record and MailAccounts for a mail account; every part is optional, and a policy that states nothing is {}.

{
  "Users": {
    "Defaults": { "Language": "Polish", "TimeZone": "Europe/Warsaw" },
    "Forced": { "EndpointAccess": { "McpEndpoint": false } },
    "Editing": { "Mode": "NoneExcept", "Properties": ["TimeZone", "DisplayName"] }
  },
  "MailAccounts": {
    "Forced": { "TransportSecurity": { "ConnectionSecurity": "TlsOnConnect" } },
    "Editing": { "Mode": "AllExcept", "Properties": ["Delivery", "Secrets:Password"] }
  }
}
Statement What it holds
Defaults An object in the shape of the record, stating only the properties the scope gives a starting value
Forced An object in the same shape, stating only the properties the scope holds every record to
Editing Mode, which is AllExcept or NoneExcept, and Properties, the list of property paths the mode excepts: the ones locked under AllExcept, and the only ones left open under NoneExcept. A list without a mode is refused

A property is named by the record's own key names, exactly as mfctl user edit and mfctl account edit show them, compared without regard to case. Inside Defaults and Forced the name is the nesting of the object; in Editing:Properties it is written out with colons, as EndpointAccess:McpEndpoint or Delivery:Host. A key joined that way inside Defaults or Forced is refused, so one property has one spelling in a stored policy. A path naming a block covers everything beneath it. A list is one value: Folders is stated whole, and no path reaches an entry of one.

A scope that has stored no policy reads as one stating nothing, at version 0. Its first save is composed over version 0, and every later one over the version it read. Emptying a policy is saving {}, which commits as a new version like any other change. A saved policy is at most 1048576 octets as the database stores it.

A policy is validated whole before anything is written, and committed whole or not at all. A save answers 200 with committed, the version now in force, and — where it was refused — a code and one sentence in messages per fault, every one of them in the same answer, so a policy is corrected in one pass rather than a save at a time. Saving what is already in force writes nothing and says so. A refused policy leaves the stored one untouched:

$ mfctl policy edit --organization 0197c0de-0000-7000-8000-0000000000a1
Users:Defaults names Dialect, which is not a property of a user's record. Remove it, or correct the spelling of the property it was meant to be.
Users:Forced states DisplayName, which says who or which rather than how, so it takes no default and no forced value: one statement for many records could only be wrong. Remove it; Users:Editing may still say whether the person changes it.

What a save is refused for, each under 12007 unless the row says otherwise:

Refused Why
A path that names no property of the record A mistyped path would otherwise be a rule that silently governs nothing. A name that is not a section, a statement, or part of an editing restriction is refused the same way, and so is a name stated twice in different casing
A value its property would refuse in a record Each stated value is bound on its own by the binder a record is bound by, as the property it is stated for, and held to what that property declares: a value of the wrong type, an unknown setting inside a list entry, a name or number that is no member of the setting's enumeration, a value outside a range the setting declares, and a language, time zone, or telemetry level MailFathom does not know are each refused naming the path. A list is stated whole, so each entry of one is held to that entry's own rules as well — a folder mapping with no alias, or one naming neither a remote path nor a special-use role, and a trusted sender or a contact-collection exclusion that does not name exactly one usable thing, which is refused by its position in the list and never by the address or the domain it holds. A property named with no value, a single value where a list or a block belongs, and an object where a single value belongs are refused too
A default or a forced value for an identity property It says who or which rather than how, so one statement for many records could only be wrong. In Users these are DisplayName and Portrait; in MailAccounts, EmailAddress, DisplayName, UserName, Delivery:UserName, Delivery:FromAddress, and Delivery:FromDisplayName. Each may still be listed under Editing
A default or a forced value for a secret block A secret reference is admissible for one user, and a policy speaks for every record in its scope. These are Secrets:Password, OAuth:ClientSecret, OAuth:RefreshToken, TransportSecurity:TrustedCertificateAuthority, and Delivery:Secrets:Password in MailAccounts. Each may still be listed under Editing, and the settings beside one in its block are ordinary
An administrator-only property listed as the person's to change EndpointAccess and ClientTelemetryLevel in Users are written by an administrator alone. They take a default and a forced value and may be listed as locked, and a NoneExcept list naming one — or a block holding one — is refused, because no editing mode makes it the person's
A client preference other than the telemetry switch A client preference is the person's own. ClientPreferences:TelemetryEnabled takes a forced value under Users:Forced and nothing else: a default for it, any statement about another preference, and an editing path reaching ClientPreferences are each refused by name
MailAccounts in the Users section, and AccountId in MailAccounts A policy governs the properties of a record, and never which mail accounts a user has or the identifier this deployment generates for one
A policy composed over a version no longer in force, under 12008 Another writer committed first. The refusal names both versions, mfctl policy edit reports which settings differ between them, and nothing of the session is merged on top of what is in force
A default or a forced value in MailAccounts that would move, under a grant held at the organization, an account naming a secret not provisioned for its own users Such a value can decide where that credential is presented, as the paragraph on a grant held at the organization says below
A document that is not one JSON object, or is past the size above A request carrying no document at all is answered 400 rather than taken as a decision to empty the policy

What a record's validator asks of the record as a whole is not asked of a policy. A statement is a sparse record rather than a record, so a rule that reads several of a record's properties together — delivery enabled with no submission host, say — has nothing to be asked of: forcing Delivery:Enabled leaves the host each account states to that account. The same holds for a bound that validator checks on one property in the course of reading the record, rather than the property declaring it: a submission port, an audit trail's retention window, and the thresholds of contact collection are held to their bounds when a record is written, and not when a policy states them. Both are asked instead of each record the policy governs, as that record would stand under it, which is the judgement the next paragraph describes.

A policy may not leave a record it governs unservable. A save that changes a default or a forced value for users is judged against every user record the policy governs, and one that changes a default or a forced value for mail accounts against every mail account it governs — every one for the deployment's, the members and the accounts of an organization for that organization's — inside the transaction that stores it: each is resolved under the policy as saved and held to what a record of its kind is held to when it is written. A record the policy in force kept servable and the saved one would not refuses the save under 12007, naming how many records stand in the way and the first ten of them, each with what it would be left without. A user is named by label and identifier and a mail account by its display name and identifier, never by its address. A record that was already unservable refuses nothing, because the save did not break it, and a mail account the save leaves served exactly what it was is not judged at all — so stating a default refuses nothing over the accounts that state that setting themselves:

$ mfctl policy edit --organization 0197c0de-0000-7000-8000-0000000000a1
The saved policy is refused over 2 of the 31 records it governs — a user record or a mail account it would leave one this deployment could not serve, or a mail account whose effective settings the grant it was written under may not move — so nothing was written. Correct those records first, or keep what they rely on in the policy. Each is named below.
User 'alex' (0197a3c0-0000-7000-8000-000000000001): Language is not stated, and every user record names the language MailFathom writes for that person in — the card beside a contact of theirs, a message that answers no correspondence. State 'English' or 'Polish'.
Mail account 'Work' (0199a0c0-0000-7000-8000-00000000000a): Account 'Work': Language is not stated, and every mail account names the language MailFathom writes about its mail in — the reading on a message row, the statement about a conversation. State 'English' or 'Polish'.

A save judges only the kind of record it moves a value for: one that changes nothing but Users reads no mail account, one that changes nothing but MailAccounts reads no user, and one that changes only an editing restriction judges no record at all, because a restriction can make no record unservable.

One save judges at most Deployment:MaximumRecordsJudgedPerPolicyWrite records, 10000 unless set, counting the users and the mail accounts together. The judgement runs inside the write, and a save of any record it judges waits for it, so the bound is what keeps one policy write from holding every record write of a large deployment behind it. A save governing more is refused under 12007 before any record is read, naming the setting that raises the bound.

The same commit rewrites what the deployment reads across the mail accounts it moves. The columns and folder rows beside an account's declaration — its mode, whether it classifies and scans, each folder's mapping — hold what the account is served, so a policy that forces Folders, supplies a default mode, or lifts either rewrites them for the accounts it governs as it commits; the declaration itself is never rewritten. The account's next run is composed under the policy, and a run already in flight finishes on the settings it took.

The same commit rewrites the endpoint switches of every user whose switches it moves. A request authenticates against the switches on a user's row and never against a policy, so a policy that forces EndpointAccess:McpEndpoint off, supplies a default a record leaves out, or lifts either writes the resolved switches onto the rows of the users it governs as it commits. A session or a token therefore stops or resumes on its holder's next request on every replica, and the rest of what those users are served — their language, zone, and telemetry level — follows within thirty seconds.

One forced value is not a property of the record: whether a person's client reports telemetry. Users:Forced takes ClientPreferences:TelemetryEnabled, true or false, beside the record's own properties:

{ "Users": { "Forced": { "ClientPreferences": { "TelemetryEnabled": false } } } }

It holds the switch on the client's settings screen for everybody the policy governs, the deployment's force winning over an organization's as it does everywhere. While it is forced the person's own answer is kept and decides nothing, the preferences read answers the forced value and names whether the deployment or the organization holds it, a write stating the other answer is refused, and the telemetry routes take or refuse that person's batches by it. Removing the statement puts each person's own answer back in force. It judges no record and rewrites no row, and it reaches a replica as the rest of what a policy states for users does, within thirty seconds. Forcing it on reports what somebody declined to have reported, so it is the one statement here that takes a decision about a person away from them: what the client publishes about itself says what is then sent and what the person is told, and whoever saves the policy is who owes the basis for it. It raises nothing else — not ClientTelemetryLevel, and not a collector the deployment never named.

Reading is mailfathom.admin.read and saving is mailfathom.admin.configuration.write. The deployment's policy takes the permission held at the deployment, and a caller holding it only below that is refused rather than answered as nothing found. An organization's accepts it at the deployment or at that organization, which is what lets an organization's own administrator write its policy and no other; a grant at one user covers no organization. An organization outside the caller's scope is answered 404, exactly as one this deployment does not hold.

A grant held at the organization may not move an account naming a secret that is not its own users'. Forcing a host, a port, a token endpoint, or a transport security posture decides where a mailbox's credential is presented, and an organization's administrator is trusted with that organization's mailboxes and not with a credential the deployment holds for somebody else. So a save under such a grant is held, account by account, to the bound an account's own write is held to under the same grant: where the saved policy would change what an account is served — whichever setting moved, and whether a default or a forced value was added, changed, or removed — every secret that account names has to be material this deployment provisioned for a user the account is assigned to, its own name beginning with user-, that user's identifier, and -. An account naming anything else refuses the save under 12007 and is named in the answer like any other record in the way. Which settings decide where a credential goes is deliberately not a list. An account the save leaves served exactly what it was is not asked, so such an administrator states a default the accounts in question state themselves, and saves the whole of Users and MailAccounts:Editing; a grant at the deployment writes every part of every policy and is not asked this at all. What an account was served under a policy in force that the answering replica cannot judge whole — one a newer build stored while two builds were serving during an upgrade — is unknown to it, so replacing such a policy under a grant held at the organization counts as moving every account the policy governs, and is refused over each that names a secret that is not its users'. The same holds the other way round: where the policy the save would leave governing an account cannot be judged whole — an organization's policy saved while the deployment's is one this replica does not read — what the save would move is unknown, a replica that does read it would serve whatever that is, and the save is refused over each such account.

A stored policy past the size above is refused rather than read. No save produces one, so it is a row written beside MailFathom. Every route that reads it — both GETs, and both POSTs, which read the policy in force before judging a save — answers 500 and says nothing more, so mfctl policy show and mfctl policy edit report only that status. What refused it is in the deployment's log: a SettingsPolicyUnreadableException, whose error code is 12015, naming the scope and both figures. The row is corrected where it was written.

Two administrators saving at once: the second is refused. The version is checked in the statement that writes the policy, so whichever replica each save reached, the one that commits second matches nothing and is answered with the version the first produced. A committed policy is announced to every replica the way a committed change to a user's record is, over the signal backplane where one is declared.

An organization that is removed takes its policy with it. The row is the organization's, so nothing is left stating defaults for a scope nobody holds.

Roles, groups, and assignments

What a user may do is a role given to them, directly or through a group, at a scope — the model is how a caller's grant is computed, and who may change it is administering roles, groups, and assignments. These commands are where it is changed.

Command What it does
mfctl role list Reads the roles this deployment defines, with each one's list as it was written, what each pattern on it reaches now, and any entry on it that grants nothing in this build
mfctl role add --name <name> (--permission <name or pattern>… \| --no-permissions) Defines a role, and reports the identifier it was minted under
mfctl role rename --role <id> --name <name> Replaces the name a role is read by
mfctl role set-permissions --role <id> (--permission <name or pattern>… \| --no-permissions) Replaces the whole list a role grants, for everybody it is assigned to
mfctl role remove --role <id> Removes a role nothing is assigned
mfctl group list Reads the groups within your scope, with each one's organization and member count
mfctl group add --name <name> (--organization <id> \| --no-organization) Records a group, and reports the identifier it was minted under
mfctl group rename --group <id> --name <name> Replaces the name a group is read by
mfctl group members --group <id> Reads who belongs to a group
mfctl group add-member --group <id> --user <id> Makes a user a member, giving them every role the group holds
mfctl group remove-member --group <id> --user <id> Ends a user's membership, taking away every role it gave them
mfctl group remove --group <id> Removes a group nothing is assigned to, and its memberships with it
mfctl assignment list Reads the role assignments within your scope
mfctl assignment add --role <id> (--user <id> \| --group <id>) (--deployment \| --organization <id> \| --scope-user <id>) Gives a role to a user or a group at a scope, and reports the identifier it was minted under
mfctl assignment revoke --assignment <id> Revokes one assignment
mfctl user permissions --user <id> Explains why a user holds each permission they hold, and what each of their credentials keeps of it

--permission is repeated once per entry, and --no-permissions states an empty list on purpose, so a forgotten option never reads as a role granting nothing.

A role, a group, and an assignment are each minted with a version 7 UUID, which is what every command names them by. A role's and a group's name is what an operator reads it by, trimmed and 1 to 128 characters; no two roles share one, and no two groups do.

A role's list names published permissions, and patterns reaching at least one of them. In a pattern * is a whole dot-separated segment standing for one or more segments, so mailfathom.*.read is every name ending in .read, in both halves — a pattern in a role's list holds the syntax, and what an upgrade does to a role carrying one. Quote a pattern, so the shell does not expand the * before the command reads it:

$ mfctl role add --name Reader \
    --permission mailfathom.assistant.use \
    --permission 'mailfathom.*.read'

A name this build does not publish and a pattern reaching nothing it publishes are each refused with 400, the refusal saying which of the two each entry was:

This build publishes no permission named 'mailfathom.admin.reads'. This build publishes nothing in the reach of the
pattern 'mailfathom.archive.*'. A role lists published names, and patterns reaching at least one of them, in which
'*' is a whole dot-separated segment standing for one or more segments.

A role is read back as it was written, with what each pattern reaches beside it. GET /api/admin/roles carries three members for the list of each role:

Member What it carries
permissions The list as written: each published name, then each pattern. Sending it back writes the same role
patterns One { "pattern": "<as written>", "reaches": ["<published names it reaches now>"] } per pattern on that list; empty for a role of names alone
unpublished Stored entries that grant nothing in this build: a name it does not publish, and a pattern reaching nothing it publishes. A role an earlier release wrote, or a row edited in the database, may carry one

mfctl role list prints permissions in its Permissions column and the other two beneath the listing — first what each pattern reaches, one line per role and pattern, then the roles carrying an entry that grants nothing:

A pattern holds what this deployment publishes in its reach, a permission a later release adds there included. What each reaches now:
  0199c3d4-… (Reader): mailfathom.*.read reaches mailfathom.mail.read, mailfathom.contacts.read, mailfathom.admin.read, mailfathom.admin.audit.read

What a pattern reaches is the answer of the build the deployment runs, so the same role reads differently after an upgrade that publishes a permission in its reach. An entry reported as granting nothing is removed by replacing the list with mfctl role set-permissions.

An assignment names one role, one principal, and one scope. The principal is a user or a group, and the scope is the deployment, one organization, or one user. The same role given to the same principal at the same scope twice is refused with 409 rather than recorded twice. A group in an organization holds only that organization's members, so adding anybody else is refused with 409.

Every refusal says what to do next. Deleting a role or a group something is still assigned names how many assignments stand in the way; a write giving a name the caller does not hold, or holds too narrowly, is answered 403 naming that name; a write giving a role that lists a pattern, reached below the root, is answered 403 saying that only the root gives one; and a write that would leave the deployment with nobody holding mailfathom.admin.roles.write over it is answered 409 saying to give it to somebody else first. A role listing a pattern that reaches that name — *, mailfathom.admin.*, mailfathom.admin.*.write — assigned at the deployment scope holds the root exactly as one listing the name does, and is counted so.

A role that lists a pattern is given by the root alone. mfctl assignment add naming such a role, and mfctl group add-member naming a group any assignment gives one to, need mailfathom.admin.roles.write over the whole deployment whatever scope the write names, beside every name the role grants today. So an organization's administrator hands out roles of names alone — a pattern in a role's list holds the rule, and what a refusal says the answer.

mfctl user permissions --user <id> answers why a user can do something. It lists every name the user holds with the role that gave it, how the role lists it under Listed as — the name, or pattern and the pattern as it was written — the group it came through or directly, and the scope, marking a name the scope makes reach nothing; then each of the user's credentials with what it keeps of what was listed. A role listing a name both by name and through a pattern explains it twice, once per entry, because removing either leaves the other granting it. The route carries the same in each row of sources as pattern, which is null where the role lists the permission by name. The listing is what your own scope covers: a name the user holds through a group or at a scope you do not administer is left out, so an organization's administrator reads that organization's part of a member's grant. Past 1000 rows the command says the listing is a part of the answer.

Records this deployment will not read

Every user record, mail account declaration, and organization row is judged before it is committed, so one this deployment will not read was written by an older build, tightened by a newer one, edited in the database, or restored from a backup. Each of them costs its own scope and nothing else — which is why nothing you would otherwise look at reports that it happened: the deployment starts, the other users keep receiving mail, and the other organizations keep listing.

GET /api/admin/records/held-back is where you meet them, under mailfathom.admin.read. It answers three lists:

List What is in it What it costs
users A user whose own record does not read as the settings a user's document holds That user is served nothing: no mailbox of theirs is synchronized, and no surface answers for them
mailAccounts One mail account declaration of a user whose record is otherwise readable That mailbox alone is not synchronized; the user's other mailboxes and their record are served as usual
organizations An organization row whose stored short name is not one this build reads Its members cannot type the prefix their login begins with; nobody else is affected

Each entry carries the record's id, the label an operator recorded it under, the rejectedVersion where the kind of record carries a version — an organization row carries none, so it reports null — and corrections, one sentence per setting to change. The identifier is what you pass to the command that repairs it: mfctl user edit for a user, mfctl account edit for a mail account, and mfctl organization set-short-name for an organization.

Nothing here repeats a value. The corrections are MailFathom's own sentences about which settings are wrong, never the values beside them, and a short name this deployment will not read is never echoed at all — it is the one value that failed every rule about what a short name may contain. So the answer carries no secret, no mail content, and no address.

The first two lists are the answering replica's own reading and the third is read from the rows. Every replica binds the same records and refuses the same documents, so reading one replica tells you what all of them did; a record repaired on any replica stops being reported here within one convergence interval of the repair.

Mail accounts and who they are assigned to

A mail account is a record of its own rather than part of any user's. It holds the mailbox's address, the display name it is told apart by, and every setting it is read with, and it is assigned to the user it serves. What a user is served is their own record composed with every account assigned to them, so each user's rules about their mailboxes are judged over exactly that set.

Command What it does
mfctl account list Reads every account this deployment holds, following the listing's cursor to its last page, with each one's identifier, address, display name, version, who it is assigned to, and the organization it belongs to
mfctl account show --account <id> [--format json\|yaml] [--effective] Reads one account's declaration, secrets redacted, as JSON or as YAML, beneath the organization it belongs to — or with --effective, each setting as the account is served it, with what supplied it and who holds it
mfctl account add [--user <id>] --from-file <path> Creates an account from the declaration in the file — JSON, or YAML where the file is named .yaml or .yml — assigns it to that user, and reports the identifier it was generated under
mfctl account edit --account <id> [--format json\|yaml] Opens that declaration in your $VISUAL or $EDITOR, as JSON or as YAML, and commits what you saved as one change
mfctl account assign --account <id> --user <id> Assigns an account to that user: beside the other members assigned it where it belongs to an organization, and to nobody else where it belongs to none
mfctl account set-organization --account <id> (--organization <id> \| --none) Moves the account into an organization, or out of every one, which decides who it may be assigned to
mfctl account unassign --account <id> --user <id> Ends one user's assignment, erasing what they authored there, and erasing the account and its mail when it was the last one
mfctl account delete --account <id> Erases the account and every message this deployment holds for it
mfctl account custody show --account <id> Reports which copy of that account's mailbox is the truth, how much of its source server is still to be emptied or filled again, and every append awaiting an operator's verdict
mfctl account custody switch --account <id> --to <custody> Asks for HoldMailbox or MirrorSource, after a confirmation naming what happens to the mail, and prints every reason a refusal gave
mfctl account custody settle --account <id> --record <id> --found\|--missing Records whether an unanswered append's copy is in the folder, which is what releases an account held in Restoring

--user on add is optional on a deployment holding one person, exactly as on the user commands. unassign and delete show what they are about to erase and ask, and take --yes where nothing is at the terminal to answer.

A declaration is the account's address and name beside its settings. It is a JSON object stating EmailAddress, DisplayName, and the keys one account lists, with credentials as references. It states no AccountId: the deployment generates the identifier, a version 7 UUID, and a declaration that states one is refused. The identifier is what every tool argument, stored row, and log line names the account by from then on.

{
  "EmailAddress": "alex@example.test",
  "DisplayName": "Work mail",
  "Host": "imap.example.test",
  "Language": "English",
  "UserName": "alex@example.test",
  "Secrets": { "Password": { "Name": "alex-work-password", "SecretReference": "file:/etc/mailfathom/secrets/alex-work-password" } }
}

One address is held by one account in the whole deployment. The address is compared without regard to case or surrounding white space, and the guarantee is a unique index rather than a read before the write, so two writers claiming one address at once cannot both succeed. Creating an account for an address another account holds is refused, naming the address:

Another mail account already holds 'alex@example.test', and one address is held by one account in this deployment, so nothing was written.

A mailbox is served to every user it is assigned to. For an account of an organization, mfctl account assign adds an assignment beside the ones already there, so one mailbox read by several of its members is one account with one copy of its mail rather than a mailbox each. The assignment is the row, and assigning an account to somebody who already holds it writes nothing rather than failing. An account is assigned only to users of its own organization, and an account in none to one user in none: a second assignment of it is refused, because sharing a mailbox is something an organization does. ADR 0014 is the decision, and what it costs a user is stated under the per-user ceilings there: a shared account counts in full against every assigned user's ceiling, and work on it proceeds only while every one of them is under theirs.

These commands are the only way a mailbox is declared, assigned, or withdrawn. The client publishes no route that creates an account or ends an assignment to one: a person signed in there reads the mailboxes assigned to them and changes the folders of each, and nothing else about which mailboxes they have.

A display name is unique within each user's assigned set. Two of one person's accounts may not share one, or take the other's identifier, so a name always names one mailbox for that person; two people's accounts may. An assignment that would give a user a second account under a name they already have is refused, as is one past the 64 accounts one user is assigned at most, or past the 256 users one account is assigned to at most — the most a question about the account's mail reaches, so nobody it is assigned to is ever left out of one.

An account write is judged against every user it is assigned to. A save composes each of those users' records with the account as it would stand and binds each of them, so a change that would break any one user's record is refused whole. Every committed write moves the version of each of those users' records, which is what a client composing against its own record's version sees move.

An account write is judged under the settings policies governing the account, and an administrator is bound by a forced value alone. What is bound into each user's record is the account as the policies resolve it, so a declaration may leave out a setting a policy supplies, and the account's record keeps only what the declaration stated. A declaration stating another value for a setting a policy forces is refused under 12007, naming the setting and whether the organization or the deployment holds it; an editing restriction binds the people the account is assigned to and not whoever administers it. A forced setting saved back as the read showed it — the declaration's own value, or the value in force — passes and leaves the declaration's own value as it was, and a save that names nothing else commits nothing. The policies are read again inside the commit, so a policy that came to force a setting while the declaration was being edited refuses the save rather than being passed by it.

Host is held by the organization, whose settings policy forces its value, so nothing written on the record changes it. Leave it as the record states it, or change the policy.

An account is read with each setting as it is served beside its declaration. GET /api/admin/mail-accounts/{accountId} answers the account's own declaration — what a save is composed over — and a properties list in the shape a user's record read answers: path, value, source, heldBy, and changeable, which is false where a policy forces the setting and for every setting where the caller's grant does not carry mailfathom.admin.configuration.write over the account. EmailAddress and DisplayName are answered from the account's row, and a secret block is listed with no value: its reference is redacted in the declaration and does not come back through this list. Where a policy governing the account is one this build does not read, properties is empty and unresolved carries the sentence naming which. mfctl account show --effective prints the list in place of the declaration, one setting a line, with (nothing stated) for a setting nothing supplies and (not shown) for one that is supplied and answered without its value, which is what a secret block the account states prints as:

$ mfctl account show --account 5b0c... --effective
5b0c...  Work <alex@example.test>
    version 4; assigned to: 7c02...
    organization: 0197c0de-0000-7000-8000-0000000000a1
  DisplayName: Work  [Record]
  Host: imap.corp.example.test  [OrganizationForced, held by the organization, not changeable while the policy forces it]
  Mode: Polling  [BuiltIn]
  Port: 993  [DeploymentDefault]
  Secrets:Password: (not shown)  [Record]

Moving an account changes which policy governs it, and the move is judged like a policy write. mfctl account set-organization resolves the account under the policy of the organization it would move into — or under the deployment's alone, for a move out of every one — inside the transaction that moves it. An account that policy would leave one no start would serve is not moved and is answered 409 with what it would be left without; so is an account naming a secret not provisioned for one of its users, where the move is made under a grant held below the deployment and would change what the account is served. As with a policy write, what refuses a move is what the move breaks: an account no start would serve where it stands is moved wherever the target leaves it no worse, and one the target leaves served exactly what it was is not asked at all. Nothing is rewritten on the account to make a move pass, and a move that commits rewrites the columns the deployment reads across accounts in the same transaction.

Ending an assignment erases mail, and ending the last one erases the account. mfctl account unassign erases the mail this deployment stored for that user under the account. An account nobody is assigned to serves nobody, so ending the last assignment also erases the account and every message, folder, attachment, and derived index this deployment holds for it, exactly as mfctl account delete does.

A read hands over what it can, and names what it cannot. mfctl account list reads every account the deployment holds, a page at a time, each as its identifier, address, display name, version, and assignments rather than its declaration. mfctl account show reads one declaration, and an account whose stored declaration is not one of settings is answered 400 there rather than read:

A mail account this deployment holds is not a declaration of settings, so it cannot be read or edited. Correct the row where it was written.
$ mfctl account unassign --account 5b0c... --user 7c02...
Ended the last assignment of mail account 5b0c..., and erased the account and every message this deployment held for it.

An account holding no address is not served. A start reports such accounts at Warning, naming the user they are assigned to, and mfctl account list marks each one; mfctl account edit is where the address is stated.

User credentials

Every credential a user's client presents belongs to a person rather than to a deployment, and these are the routes that administer one. An endpoint states which methods it accepts and nothing about who holds one — see the MCP endpoint — so provisioning is what decides who reaches whose mail, and who reaches this endpoint. There is no self-service and no default: whoever administers the deployment provisions the credential and tells the user what it is, which is what keeps a user from minting a way into anybody's mail, their own included.

Four methods, one record shape. Each credential names its method, is resolved by one indexed value, keeps the part of its user's grant it was provisioned to keep, lists the endpoints it may be presented on and the networks it is accepted from, and can be disabled, rotated, or removed the same way:

Method What the client presents What it is resolved by What a rotation replaces
password A login and password, as HTTP Basic The username, within the user's organization The password
api-key A key this deployment minted, as a bearer credential A digest of the key, which is never published The key, minted again
public-key A signed client assertion The key's fingerprint, which the client names in kid The registered public key
oauth-subject An access token its authorization server issued The issuer and subject together Nothing — the mapping is deleted and written again

Reading and writing are separately granted. A listing says which credentials exist and whose they are, which is mailfathom.admin.read; provisioning, rotating, disabling, and removing decide who can read somebody's mail, which is mailfathom.admin.credentials.write — so a credential provisioned to read this deployment's state has not thereby been given one that can mint a way into a mailbox. Each route is checked at a scope covering the user it names, so an organization's administrator administers the credentials of its members and nobody else's. Provisioning, rotating, and enabling one also needs every name its user holds, because placing a credential is a way in as that user: every administrative name, held by the caller at a scope covering each scope the user holds it at, and every user-facing name, held at all, since a user-facing name's scope is never read. So a caller kept to mailfathom.admin.credentials.write cannot mint itself, or a root, a key that administers with everything that user holds; an organization's administrator cannot set a password for a member who holds a name over the whole deployment; and an administrator whose own roles grant no mailfathom.mail.send cannot place a way in as somebody who sends. Each is refused naming the first name it lacks. Where a role the user holds lists a pattern, the same three need the root as well — mailfathom.admin.roles.write over the whole deployment — because that user's grant comes to hold whatever a later release publishes in the pattern's reach, which no check of what the caller holds today bounds. So an organization's administrator cannot set a password for a member who holds such a role, the seeded Administrator among them; a pattern in a role's list holds the rule, and the refusal carries widensOnUpgrade. Disabling and removing one widen nobody and need the write permission over the user alone.

$ mfctl credential create --method password --username user
Password for 'user':
Provisioned password credential 0198f0c4-... for user 3f1d....
The user signs in as 'user' with the password you typed, which nothing here or in the deployment can report back.

$ mfctl credential create --method api-key --permission mailfathom.mail.read
Provisioned api-key credential 41d7e2b0-... for user 3f1d....
The client presents this key: mfk_...
It is stored only as a digest, so nothing here or in the deployment can report it again. Copy it now.

A secret is asked for or minted, never passed. There is no --password option and there will not be one: a value written on a command line reaches the shell's history, the process table, and the log of whatever supervisor started the command. A password is read without echo where somebody is at the terminal and as one line where the input is a pipe, so a script supplies one without it ever being an argument; a key is minted by the deployment and printed once. Nothing prints a secret back afterwards — not a listing, and not a refusal, which names the rule the password broke rather than the value.

Command What it does
mfctl credential list Reads which credentials a user holds, by which method, what each narrows its user's grant to and what that leaves it holding, whether each still authenticates, and how old its material is
mfctl credential create --method <method> … Provisions one, asking for the password or minting the key
mfctl credential rotate --method <method> --id <credential> Replaces what the client presents, which stops the previous material working at that instant
mfctl credential disable --id <credential> Stops it authenticating, keeping everything else about it
mfctl credential enable --id <credential> Lets it authenticate again
mfctl credential delete --id <credential> Removes the record and frees the value it was resolved by, which cannot be undone

--method is required on create and on rotate, and nothing is inferred from the other options: a credential is a way into somebody's mail, and which kind is being provisioned is not a thing to guess from a flag somebody happened to pass. Each method takes what only it needs — --username for a password, --public-key-file for a key pair, --issuer and --subject for a mapped subject — and the missing one is named rather than sent as nothing for the deployment to refuse.

What a user may do is granted to the user, and a credential only narrows it. --permission is repeatable and records the names the credential keeps of its user's grant: a name the user's roles do not grant is accepted and holds nothing until they do, and no name adds to what the user holds. Naming none records no narrowing, so the credential holds exactly what its user's roles grant, now and after every change to them — and a permission a later release publishes reaches it only through a role that lists it, by name or through a pattern reaching it. --no-permissions provisions one that authenticates and reaches no tool whatever its user holds. Each listed credential carries permissions, the names it keeps or null where it names none, beside effectivePermissions, what that leaves it holding under its user's grant at the moment of the reading; mfctl credential list shows them as "Narrows to" and "Holds". A token presented under PermissionsFromTokenScopes can narrow the second further for its own session. What a credential may do is the model behind those names.

--surface is repeatable and names the endpoints the credential may be presented on — mcp, client, or admin. Naming none lists mcp and client, so admin is reached only by a credential that names it, and only while its user holds an administrative role — who administers the deployment is the whole rule. --source-network is repeatable too, up to 32, and names an address or a network the credential is accepted from; naming none accepts it from anywhere, and naming one is refused while ReverseProxy:TrustedProxies names no proxy narrower than an address family — where a credential may be presented from says why. Both are fixed when the credential is provisioned, and mfctl credential list reads them back in its "Endpoints" and "Accepted from" columns. The route takes them as surfaces and allowedSourceNetworks, and a listing returns both on every credential.

$ mfctl credential create --method api-key --surface admin --source-network 10.20.0.0/16

Every command takes --user and none of them needs it on a deployment holding one user: the command reads the roster, acts on the single user there is, and refuses rather than guessing where there are several — naming the identifiers to choose from, so the refusal is where an operator reads the one to pass.

Rotation replaces material and is refused where there is none to replace. A password, an api-key, and a public-key each have material this deployment holds; an oauth-subject mapping has none — what it states is which token resolves which user — so rotating one is refused with what to do instead, which is to provision the mapping the person should act under and delete the old one.

Disabling and deleting are different acts. A disabled credential keeps the value it is resolved by claimed, so nothing else can be provisioned under it, and one command undoes the decision — which is what to reach for when a way into somebody's mail has to be closed now and the reason may turn out to be nothing. Deleting frees that value and nothing in MailFathom puts the record back; the command shows the credential and then asks, and --yes is how a scripted removal states the agreement instead. What it shows is never what decides the outcome: reading and removing are separately granted, so a token holding mailfathom.admin.credentials.write and not mailfathom.admin.read is refused the listing, and the command reports that refusal, asks anyway, and sends the removal — otherwise the credential would be unremovable through the tool that exists to remove it.

Both also remove the client sessions that credential minted, on every replica and in the act itself rather than at the next request each of them makes, so closing a way into somebody's mail closes the clients already signed in through it and reaches an abandoned session as readily as an active one. A rotation does not: it changes what may be presented at the exchange and says nothing about sessions already exchanged, so an operator ending somebody's sessions disables the credential rather than rotating it. Ending them is an act rather than a race, and PostgreSQL is what makes it one: a disable clears the flag and removes that credential's sessions in one transaction, while a sign-in holds the user record and then the enabled credential row until it commits. So an exchange that authenticated just before the act either matches no enabled credential and refuses, or commits first and has its session removed by the act that waited for it.

A rotation is one statement. There is no moment at which both credentials work and none at which neither does, so a client still presenting the previous material meets a refusal rather than a half-written record. The credential keeps its identifier, so nothing an operator wrote down about it goes stale. Where an overlap is wanted instead — a client that cannot be moved in one step — provision a second credential, move the client, and delete the first.

A listing publishes what a credential is resolved by, except where publishing it would publish the secret. A username, a fingerprint, and an issuer-and-subject pair are all values somebody wrote down or a provisioning reported, so each is listed; an API key's digest is a verifier for the key itself, so it is withheld and the listing says so rather than leaving the column empty. A password credential also carries login, the form a person types — SHORTNAME/username for a member of an organization and the username otherwise — composed from the organization the user belongs to now, and every other method carries null there. mfctl credential list shows that login in its "Resolved by" column for a password credential, since it is what the person types.

Every change to who can reach a user's mail is written to the audit record: the act, the credential's identifier, its method, the user, the administrator who made it, and when. The value it is resolved by is not among them, and neither is anything derived from its material — an audit record names a credential without naming a way to sign in.

Rate limiting

An enabled endpoint is bounded, whether or not anyone wrote a number. That is what stops an administrative surface reachable from a network from serving unbounded API-key guessing, which is the attack it is most exposed to and the one where a successful guess is worth the most.

AdminEndpoint:RateLimiting is the same section McpEndpoint:RateLimiting is, with the same keys, the same product defaults, and the same validation. Rate limiting is where the settings, the ranges, the reasoning, and what a refused request receives are recorded in full; endpoint configuration is the key table.

Two things differ here, and both follow from where the credential is judged:

  • The burst is the endpoint's, not one caller's. These routes are pre-authenticated by nothing — the authentication middleware in front of the pipeline deliberately leaves an administrative request anonymous, and the credential is judged by the authorization middleware, which runs behind the limiter so that a request about to be refused for a wrong key has still spent capacity. There is therefore no identity to partition on when the limiter counts, and every administrative caller shares one bucket and one per-user concurrency allowance. Size TokenCapacity as what the whole endpoint may burst to, and MaxConcurrentRequestsPerUser as what it may serve at once, rather than what one operator may.
  • No endpoint's traffic reaches another's limits. The partitions are keyed per surface, so a key spelled the same way under two sections is two independent buckets, and an agent that exhausted the MCP endpoint's capacity has taken nothing from the surface you would use to stop it.

Every endpoint's concurrency limit is separate for the same reason: a runaway agent saturating /mcp must not lock you out of /api/admin.

Turning the limits off is an explicit value and costs one startup warning, as it does on the MCP endpoint.

Request timeouts

AdminEndpoint:RequestTimeout bounds how long one administrative request may run before it is abandoned, answering 504 and releasing the concurrency permit it held. It is the same section the MCP endpoint carries, with the same keys and the same ten-minute default, configured independently. Request timeouts records the settings and the reasoning in full.

This is the endpoint whose default is worth narrowing. The ten minutes are sized for the MCP surface, where an ask_mail run can legitimately spend minutes against an AI provider; no administrative route reaches a provider at all. Their work is a bounded database read or a configuration inspection, so a ceiling of a minute or less costs these routes nothing and shortens how long a stalled request can hold one of this endpoint's twenty permits.

That matters more here than on the MCP surface for the reason the shared bucket does: the permits an administrative caller holds are the ones you need free to reach /api/admin while something else is going wrong.

Four postures the endpoint warns about

None is refused, because each is legitimate somewhere and only you know which you have.

Startup warning What it means
No authentication method named Anything that can reach the address administers the service as the default administrator admin. Right only for a loopback bind or a network you control.
Served in clear text Any credential a client presents is readable on the path. Right only behind a TLS-terminating reverse proxy, or on a loopback bind.
AdminEndpoint:RateLimiting:Enabled set to false Nothing bounds how fast a caller may present wrong credentials. Right only where something in front of the process already bounds the traffic reaching it.
AdminEndpoint:RequestTimeout:Enabled set to false Nothing bounds how long one administrative request may hold a concurrency permit. Right only where something in front of the process already abandons a stalled request.

Configure AdminEndpoint:Https:Endpoints to have Kestrel terminate TLS itself. It takes the same profile shape the MCP endpoint's does, including HttpProtocols, which defaults to HTTP/1.1 and HTTP/2. Naming any profile binds those listeners and no clear-text one stays open behind them serving these routes.

Redirecting mfctl after you configure TLS

A profile also binds one clear-text listener whose only answer is a 308 to the address the profiles are served at, on port 8091 unless you state another. It is what keeps an mfctl profile that still holds an http:// endpoint from failing as though the deployment were down:

$ curl -i http://admin.example.com:8091/api/admin/session
HTTP/1.1 308 Permanent Redirect
Location: https://admin.example.com:8543/api/admin/session

Repoint the profile rather than relying on it. An administrative API key sent in clear text was on the wire before anything answered, and this route stores mailbox credentials — a redirect protects the next request and never the one that arrived. mfctl login --endpoint https://admin.example.com:8543 writes the corrected address; see working with more than one deployment.

That listener maps no route. No administrative operation, no session probe, and no protected-resource metadata document is reachable over it, and no credential check runs for a request that arrived on it — every path gets the same redirect, and a Host header naming no configured domain gets 400. The port is checked against every other listener in the process, so a port another surface or the probes also bind is shared rather than refused. What the surfaces sharing it must then agree about is the socket itself — the scheme, the redirect, the client-certificate question — while their credentials, limits, and HTTPS ports stay their own; which settings a shared socket couples is the table.

Turn it off with AdminEndpoint:Https:Redirect:Enabled set to false, which is what a deployment behind a proxy that already answers the clear-text port wants. The setting shape and every refusal are the MCP endpoint's, documented once in redirecting a client still pointed at http://; only the default port differs, so enabling TLS on this surface and the MCP one opens two clear-text ports that do not collide.

Behind a TLS-terminating reverse proxy

If a proxy holds your certificate, the request states the public name it arrived under, which is what lets the endpoint's OAuth discovery complete over a proxied address. ReverseProxy:TrustedProxies is what limits who may state it; left empty it is anybody. Behind a TLS-terminating reverse proxy documents that in full, including what the unnamed default gives up; three things are worth stating from this endpoint's side.

  • It is one process-wide setting, not one per endpoint. This surface is a separate listener over the same request pipeline, so naming your proxy once covers it along with the MCP and probe listeners. There is no AdminEndpoint:ReverseProxy, deliberately.
  • The OAuth credential's Resource is unaffected. It stays the value you wrote, still ends in /api/admin, and is still what a token's audience is compared against. The mode never derives it from a header.
  • A proxy that authenticates its own callers is not this endpoint's authentication. A credential listing admin, held by a user with an administrative role, still decides who may administer the service, and the clear-text warning above still fires, because the hop between the proxy and this process is still clear text.

Whether the proxy publishes this listener at all is your decision: the administrative port is separate from the application port, so a deployment can proxy the MCP surface publicly and keep this one on a network you control.

Getting the command

Each release attaches a self-contained binary per platform, plus one checksum file covering all of them. The install script is one command that performs the whole of what follows on Linux; this is what it performs, and what to do on Windows.

Download the one for the machine you administer from — the command talks to a deployment over HTTP, so it does not have to run where the service runs.

Platform Asset
Linux, x86-64 mfctl-<version>-linux-x64
Linux, ARM64 mfctl-<version>-linux-arm64
Windows, x86-64 mfctl-<version>-win-x64.exe
Windows, ARM64 mfctl-<version>-win-arm64.exe

Nothing needs installing beside it: the .NET runtime is inside the file.

No binary is signed, on any platform, so Windows warns about an unknown publisher when you run one and the checksum file is the only thing that distinguishes a genuine download from a tampered one. Check it in the directory you downloaded into, before running anything:

sha256sum --check --ignore-missing 'mfctl-<version>.sha256'

--ignore-missing is what lets one file cover four binaries: it checks the ones present and says nothing about the three platforms you did not download. <version> is the release you downloaded — substitute it, and note that the name is quoted so a line pasted without that substitution fails with a missing file rather than with a redirection.

The command binaries carry no build provenance attestation either. That is the other question worth asking about a download — the checksum says the bytes are the ones published, and an attestation would say which workflow and commit produced them — and the image and the chart are where this repository answers it. The container image records how.

On Linux, with the install script

Everything above as one command. It resolves the newest release, downloads the binary for the architecture it is running on, checks it against that release's own checksum file, and installs it as ~/.local/bin/mfctl:

curl -fsSL https://raw.githubusercontent.com/fathomise/MailFathom/main/scripts/install-mfctl.sh | bash

Pass the version when the deployment is not on the newest release, because the two have to agree on major.minor — which is the next section. --directory chooses where it goes. MFCTL_VERSION and MFCTL_INSTALL_DIR set the same two things, so a shell profile can carry the answer instead of the command line, and an argument wins over either:

curl -fsSL https://raw.githubusercontent.com/fathomise/MailFathom/main/scripts/install-mfctl.sh \
  | bash -s -- --version 0.5.0 --directory ~/bin

It installs into your own directory and never runs sudo; a system-wide installation is --directory /usr/local/bin under a sudo you write yourself. If the directory it installed into is not on your PATH, it says so and prints the line that fixes it rather than leaving you to find out at the next prompt. Re-running it installs over what is there, which is how a version is changed.

Nothing is installed that could not be verified. The checksum check above is the script's, not a step it saves you: a download that does not match what the release publishes stops it, and the file it downloaded goes with the temporary directory. What the script does not do is tell you whether the release is the one you meant — it is fetched over HTTPS from this repository, and reading it before running it is a reasonable thing to do, which is why it is one short file with no second script behind it.

Windows has no equivalent. Take the .exe from the table above and check it as the section above describes.

Take the command from the deployment's own release line

mfctl and the deployment it administers have to agree on major.minor. Every command that reaches a deployment reads GET /api/admin/session before it asks for anything else, compares the version that comes back with its own, and stops there when the two name different release lines:

$ mfctl embedding status
mfctl is 0.5.0 and the deployment is 0.4.2. A minor release is permitted to change the administrative contract, so a
command is refused rather than sent to a deployment from another release line. Run the mfctl published with that
deployment's release, or upgrade the deployment to this one.

Nothing is sent when that happens, which is the point: the refusal lands before the request it is protecting, so a command that would have started a provider bill starts none.

The rule follows the version's own promise rather than adding one. Within 0.x a minor release may change any public surface and a patch may change none, so the release line is the whole of what the two builds have to share — ADR 0004 records that policy.

Everything below the line is a difference the command reports and carries on past:

The pair What happens
Identical versions Nothing is said.
Same major.minor, different patch — 0.5.0 and 0.5.1 The command runs, and writes one line to standard error saying the builds differ and problems may occur.
Same major.minor, one of them a nightly — 0.5.0 and 0.5.0-nightly.41 The same. A nightly is a preview of the release it will become, not a line of its own.
A version either side cannot read The command runs and says which of the two it could not read. A build reporting unknown is an unstamped one rather than an incompatible one, so it is never refused on that alone.

The warning is written once per command rather than once per request, and it goes to standard error, so a command whose output you redirect still captures the result alone.

Signing in

--mode chooses how the credential is produced, and it is stated rather than guessed — guessing would put a machine with no browser on a redirect that can never arrive.

Mode What it does When
key (default) Reads one credential from standard input An API key, or an access token you obtained elsewhere
password Reads the password of --username from standard input The default administrator's first sign-in, or anybody holding a password credential listing admin
keypair Signs each request with a private key on this machine A scheduled job, or anywhere a stored credential is one too many
interactive Opens a browser here and catches the redirect You are at the machine you are administering from
device Prints a code to enter on another device A jump host, or anything without a browser

With a password

The first sign-in to a new deployment is the default administrator's, with the password MAILFATHOM_ADMIN_PASSWORD gave it — the default administrator — so --username defaults to admin. The confirmation names the user the deployment signed you in as, by display name and identifier:

$ mfctl login --endpoint http://127.0.0.1:8090 --name local --mode password
Password for 'admin':
Signed in to http://127.0.0.1:8090 as admin (3f1d...) (MailFathom 0.2.0), saved as profile 'local' and selected.

Change a shipped password straight away, with the credential identifier mfctl credential list --user <admin's id> reports, and sign in again with the new one:

$ mfctl credential rotate --method password --id 0198f0c4-... --username admin --user 3f1d...
New password for credential 0198f0c4-...:

--username names anybody else holding a password credential that lists admin, as SHORTNAME/username for a member of an organization. The password is read without echo where somebody is at the terminal and as one line where the input is a pipe. The profile stores the username and password themselves, encoded as the HTTP Basic credential every command presents, because a password is not exchanged for anything shorter-lived on this endpoint — so a profile signed in this way is as sensitive as the password, and where the credential is kept is what protects it.

With an API key

$ mfctl login --endpoint https://mail.example.test:8443 --name production
Administrative credential (an API key, or an access token from the configured authorization server):
Signed in to https://mail.example.test:8443 as Alice Example (3f1d...) (MailFathom 0.2.0), saved as profile 'production' and selected.

The key is one provisioned with --surface admin for a user holding an administrative role; a key listing only the mail endpoints is refused here as a key nobody holds.

The credential is read from standard input rather than taken as an argument, because an argument reaches the shell history, the process list, and any log of either. A script pipes it in instead:

$ printf '%s' "$MAILFATHOM_KEY" | mfctl login --endpoint https://mail.example.test:8443

With a key pair

Generate a pair on the machine that will run the command, and give the deployment the public half only:

$ openssl genpkey -algorithm EC -pkeyopt ec_paramgen_curve:P-256 -out ~/.config/MailFathom/production.key
$ chmod 600 ~/.config/MailFathom/production.key
$ openssl pkey -in ~/.config/MailFathom/production.key -pubout

Provision that public key as a credential of your user that lists admin — mfctl credential create --method public-key --public-key-file production.pub --surface admin, on an endpoint whose Authentication accepts public-key; key pairs says what a key may be — then sign in:

$ mfctl login --endpoint https://mail.example.test:8443 --name production --mode keypair \
    --private-key ~/.config/MailFathom/production.key
Signed in to https://mail.example.test:8443 as Alice Example (7a20...) (MailFathom 0.4.0), saved as profile 'production' and selected.
No credential was stored. Every command signs a short-lived assertion with the key at
/home/you/.config/MailFathom/production.key, so keep that file readable by this account alone and the sign-in lasts as
long as the deployment accepts its public half.

Nothing presentable is written down. The profile records where the key lives and no credential at all, and every later command reads that key and signs a fresh assertion that expires within the minute. A credentials file that leaves this machine — in a backup, a synced folder, a support bundle — therefore carries nothing anyone could present, which is the difference from every other mode. The key itself is never copied into the store: it stays where you generated it, under the permissions you gave it.

The path is made absolute when it is stored, because a scheduled job rarely runs from the directory you signed in from. Move the key and sign in again; there is nothing to revoke in between, because nothing was issued.

This mode needs no browser, no authorization server, and no interactive step, so it is the one to reach for in a cron entry or a systemd timer. Signing in is still verified against the deployment, which is what proves it holds the matching public half before the first real command runs.

With OAuth

$ mfctl login --endpoint https://mail.example.test:8443 --name production --mode interactive --client-id mfctl

A browser has been opened for you. If it did not appear, open this address yourself:

  https://sso.example.test/realms/mailfathom/protocol/openid-connect/auth?client_id=mfctl&response_type=code&...

Waiting for the sign-in to come back to http://127.0.0.1:8765/...
Signed in to https://mail.example.test:8443 as Alice Example (5be8...) (MailFathom 0.2.0), saved as profile 'production' and selected.
The access token is renewed for you until the refresh token expires or is revoked, and the sign-in ends when it does.

Only --client-id is configured. Which authorization server to use, the resource the token must be issued for, and the scopes to ask for all come from the deployment: it publishes an RFC 9728 metadata document at /.well-known/oauth-protected-resource/api/admin, and the server it names publishes where to authorize. Nothing is transcribed, so nothing is transcribed wrongly.

The scope list is taken verbatim, and that includes offline_access. A refresh token is what makes the sign-in outlive its first access token, and a client is issued one by naming that scope — so the OAuth credential serving this endpoint has to advertise it, in AdvertisedScopes rather than in RequiredScopes. Without it the sign-in is refused where the token is issued rather than an hour later, naming what to do:

$ mfctl login --endpoint https://mail.example.test:8443 --mode interactive --client-id mfctl
The authorization server issued no refresh token, so the sign-in would end within the hour. Grant the client offline
access at the authorization server and have the deployment advertise 'offline_access', or sign in with an API key
instead.

Register the command as a public client with an authorization-code grant, PKCE required, and the redirect address http://127.0.0.1:8765/. It ships as a binary anyone can download, so it holds no client secret and presents none. Pass --redirect-uri if you registered a different loopback port, and --issuer if the deployment accepts tokens from more than one authorization server — with several configured, the command asks rather than picking one, because they are separate populations of people.

--mode device needs none of that redirect machinery:

$ mfctl login --endpoint https://mail.example.test:8443 --mode device --client-id mfctl

Open this address on any device with a browser:
  https://sso.example.test/device

and enter the code: WDJB-MJHT
The code expires at 2026-08-03 12:10:00Z. Waiting for the sign-in to complete...

It requires the authorization server to publish a device authorization endpoint; one that does not is reported as that rather than left polling.

What happens either way

The credential is verified before it is stored. A deployment that refuses it, an address serving no administrative endpoint, and a host that answers with something that is not MailFathom all fail here rather than at some later command.

--name is what the deployment is remembered as; without it the profile takes the host name. Signing in also selects the profile, because it is the deployment you just chose to work with. The profile records the user it signed in as, by the identifier and display name the deployment reported, which is what mfctl profiles lists; mfctl status asks the deployment again rather than trusting that record.

When a deployment issues a new credential, sign in again by profile name rather than by address — mfctl login --endpoint production — and the address it already holds is reused.

When the connection is weaker than the default

A deployment on an internal host commonly serves a certificate no workstation trusts — self-signed, or issued by an authority only your organization carries — and some are reached over http:// at all. Neither is refused outright and neither is waved through: login asks about it once, records the answer on the profile, and no later command asks again. Both questions default to no, and refusing either stores nothing and signs in to nothing.

A certificate this machine does not trust

Nothing happens for a deployment whose certificate validates on its own; the question exists only where it does not.

$ mfctl login --endpoint https://mail.internal.example:8443 --name internal

https://mail.internal.example:8443 presented a certificate this machine does not trust:

  Subject:     CN=mail.internal.example
  Issuer:      CN=Example internal authority
  Fingerprint: 3B:9A:1C:…:7F
  Valid:       2026-01-04 09:12:00Z to 2027-01-04 09:12:00Z
  Not trusted: this machine does not trust the chain it was presented with (UntrustedRoot)

Accepting it stores this fingerprint on the profile. Every later command then accepts this certificate and refuses any other,
so a deployment that renews or replaces its certificate is signed in to again rather than trusted silently.

Trust this certificate for this profile? [y/N]: y
Signed in to https://mail.internal.example:8443 as Alice Example (3f1d...) (MailFathom 0.5.0), saved as profile 'internal' and selected. The connection is protected by a pinned certificate rather than by a chain this machine trusts; the profile now accepts 3B:9A:1C:…:7F and refuses any other.

Read the fingerprint against the deployment's own before answering — openssl x509 -in server.crt -noout -fingerprint -sha256 prints it in the same form. Nothing is sent until you answer: the handshake was refused, so the credential was never on the wire.

A pin is stricter than what it replaces, not weaker. Ordinary chain validation accepts any certificate a trusted authority signed; a pinned profile accepts one certificate and refuses every other, including one your machine would have trusted on its own. That is what makes accepting a self-signed certificate once safe to live with — a later substitution fails as loudly as an untrusted certificate does today, naming both fingerprints.

The consequence is that a renewed certificate ends the profile's connection until you accept the new one. Run mfctl login --endpoint internal again: the sign-in starts from ordinary validation, presents whatever the deployment now serves, and asks again. mfctl logout removes the pin with the profile.

The pin covers the deployment and nothing else. An OAuth sign-in reaches an authorization server as well, and every request to it goes out under ordinary chain validation, because a fingerprint taken at your deployment says nothing about the machine your identity platform runs on.

An endpoint reached over http://

An address is taken as written and no scheme is guessed onto a bare host, so http:// is a decision — one that is easy to make out of habit:

$ mfctl login --endpoint http://mail.internal.example:8090 --name internal

http://mail.internal.example:8090 is an HTTP address, so nothing protects this connection.
The credential you are about to present, and every later request from this profile, cross the network in clear text.
A redirect the deployment might send to an https:// address would not change that: the credential is already on the wire by then.

Sign in over an unprotected connection anyway? [y/N]:

The redirect sentence is the part worth taking seriously. mfctl never follows a redirect — that is what stops a request carrying a bearer credential from being moved to an address you did not name — and the redirect this endpoint serves protects the next request rather than the one that arrived. So the question is asked from the address alone, before anything is sent, and a deployment that would have answered 308 never gets to answer it. Sign in to the https:// address instead wherever there is one.

Accepting is recorded on the profile and widens nothing else: a clear-text profile that later answers over HTTPS with an untrusted certificate is still refused.

Signing in with nobody at the terminal

--mode key reads the credential from standard input, so a piped sign-in has no terminal to read an answer from. Both questions are therefore stated up front instead, and a sign-in that needed one and did not get it fails naming the switch rather than prompting into the pipe:

$ printf '%s' "$MAILFATHOM_KEY" | mfctl login \
    --endpoint https://mail.internal.example:8443 --trust-untrusted-certificate
Switch What it accepts
--trust-untrusted-certificate Whatever certificate the deployment presents at this sign-in. It is pinned to the profile exactly as an interactively accepted one is, so the switch weakens the one sign-in rather than the profile it produces.
--allow-clear-text That an http:// endpoint carries the credential and every later request unprotected.

There is deliberately no fingerprint to pass: somebody who had to obtain the fingerprint first could have installed the certificate instead. Neither switch has any effect on a deployment whose transport is already protected.

Nothing on the service side changes for any of this, and no configuration key turns certificate validation or clear-text protection off globally. These are the client's decisions about one deployment.

How long an OAuth sign-in lasts

An access token is typically minted for an hour, and you should never notice. Every command checks the stored token before it sends anything and exchanges the refresh token for a new one when it is within a minute of expiring, which is what keeps that hour from being an hourly interruption.

Whether there is a refresh token at all is the deployment's decision, taken by advertising offline_access on the OAuth credential serving this endpoint — see with OAuth above. The command asks for exactly the scopes the metadata document lists and adds nothing of its own, so a deployment that advertises the scope gives every client a renewable session and one that does not gives none of them one.

The refresh token itself is never renewed, and a rotated one is not adopted. When the authorization server answers a renewal with a new refresh token, the command keeps the one issued at sign-in and discards the new one. That is deliberate: adopting it would make your session last as long as you kept using it, and revoking your access at the authorization server would then take effect only whenever you happened to stop.

The service does the opposite with its OAuth credentials, and the difference is the point rather than an inconsistency. A synchronizing account is a headless process that must keep reading a mailbox indefinitely with nobody there to sign it in, so it follows a rotated refresh token and stores it. A mfctl session belongs to a person who is present, can sign in again in seconds, and whose access someone may need to revoke — so it ends.

The cost is worth stating plainly, because it depends on a setting that is not MailFathom's. On an authorization server that invalidates the old refresh token when it rotates one — Keycloak and Entra ID do this by default — the session ends at the second renewal rather than at the refresh token's own expiry. It ends cleanly, naming what happened:

$ mfctl status
The sign-in has ended: the authorization server no longer accepts the stored refresh token ('invalid_grant').
Run 'mfctl login --endpoint <address>' to sign in again.

If that is too short for how you work, turn refresh-token rotation off for this client at the authorization server. The session then runs to the refresh token's configured lifetime, which is the length your identity platform already governs — and which is the only place that decision belongs, since MailFathom issues no tokens at all.

Working with more than one deployment

Every profile is a deployment you are signed in to, and one of them is the one commands act on.

$ mfctl profiles
In use  Profile     Endpoint                           User           Credential
*       production  https://mail.example.test:8443     Alice Example  user 3f1d... credential 41d7e2b0-...
        staging     https://staging.example.test:8443  Alice Example  user 3f1d... credential 6b20c7d4-...

$ mfctl switch staging
Now acting on 'staging' (https://staging.example.test:8443) as 'user 3f1d... credential 6b20c7d4-...'.

--endpoint overrides the selection for one invocation without changing it, and takes either a profile name or an address:

$ mfctl status --endpoint production
'production' (https://mail.example.test:8443) accepts the stored credential as 'user 3f1d... credential 41d7e2b0-...' (MailFathom 0.2.0).
Signed in as Alice Example (3f1d...).
The user holds Administrator over the deployment.
It holds mailfathom.admin.read, mailfathom.admin.operate.
Documentation for that version: https://fathomise.github.io/MailFathom/docs/v0.2.0/

The order is the option, then MAILFATHOM_ENDPOINT, then the profile last switched to: what you typed beats what your shell was told, and both beat what you chose last time. status is what asks a deployment whether the stored credential still works, which is how a revoked or expired key is distinguished from an unreachable host.

The documentation line names the deployment's version rather than the command's. The two are separate builds — that is the whole reason status reports the deployment's version at all — and a command from one release line pointed at a deployment on another would otherwise name pages for something nobody is running. A deployment on the nightly channel resolves to latest, which is what a nightly carries, and a deployment reporting a version the command cannot read is told nothing about documentation at all: that is the same absence of evidence the version check warns on rather than acts on, and naming a directory for it would be a guess printed as a fact.

mfctl logout forgets one profile — the selected one, or whichever --endpoint names. It does not revoke anything: the credential stays valid until the deployment stops accepting it. Forgetting the selected profile leaves none selected rather than promoting a neighbour, so the next command asks which deployment you mean instead of quietly reaching a different one.

Every command that needs a credential and has none says so, and says what to run:

$ mfctl status
Not signed in. Run 'mfctl login --endpoint https://host:port' first.

Where the credential is kept

Platform Path
Linux $XDG_CONFIG_HOME/MailFathom/credentials.json, or ~/.config/MailFathom/credentials.json
Windows %APPDATA%\MailFathom\credentials.json

One entry per profile, keyed by the name rather than by the address, so a deployment that moves port or gains a domain keeps its profile instead of becoming a second entry. On Linux the file and its directory are created user-only, and created that way rather than tightened afterwards — a file created readable and corrected later is readable for the moment in between.

The secrets themselves are held by your operating system, not by that file, wherever this machine has somewhere to hold them:

Platform Where a profile's secrets are held
Windows The Credential Manager, as a generic credential named MailFathom/mfctl/<address>/<profile>/<kind>, persisted for your logged-on user on this computer
Linux The Secret Service through libsecret — GNOME Keyring, KWallet, or another provider — in your session's default collection, listed by a keyring application as MailFathom mfctl <kind> for <address> (<profile>)

Two entries per profile at most: the bearer credential it presents, and an OAuth session's refresh token. Both are keyed by the deployment's address and by the profile holding them, so one deployment's credential is never presented to another, and two profiles at one deployment — an administrator's and a read-only one — each keep their own rather than the second sign-in overwriting the first. macOS is not covered because mfctl is not published for it.

What credentials.json then records is what a profile is rather than what it can do: the address, the credential's reported name, the user the profile signed in as by identifier and display name, a key-pair profile's key path, an OAuth session's endpoint, issuer, client identifier, resource, scopes, and expiry, and the transport trust you accepted. None of those is a secret and each was already in clear, though the display name is the user's personal data and sits in that file for as long as the profile does. Three shapes are written, and the keyPair member is present in all of them — it is its value rather than its presence that tells them apart. A profile with no token member and "keyPair": null is one whose secrets your operating system is holding. One whose keyPair names a private-key path stores no secret anywhere, which the section on key-pair profiles below covers. One that carries a token is sealed into this file, which the next paragraph is about.

Where this machine has no such store, the command seals them into the file instead — libsecret not installed, no D-Bus session bus, no provider running, a locked collection, or the store refusing. That is the ordinary state of a headless server or a jump host, and mfctl keeps working there: the tokens are encrypted in the file with AES-256-GCM, under a random key generated on first use and kept beside the store as credentials.key; on Windows that key file's contents are additionally wrapped with DPAPI under the current user. Each token is bound to its own endpoint, so a value moved between entries does not decrypt.

mfctl login says which of the two you got, so you never have to read the file to find out:

$ mfctl login --endpoint https://mail.example.test:8443
Signed in to https://mail.example.test:8443 as Alice Example (3f1d...) (MailFathom 0.8.0), saved as profile 'production' and selected.
The credential is held by the Windows Credential Manager.
$ mfctl login --endpoint https://mail.example.test:8443
Signed in to https://mail.example.test:8443 as Alice Example (3f1d...) (MailFathom 0.8.0), saved as profile 'production' and selected.
The credential is sealed in the credentials file under a key beside it, because this session has no D-Bus session bus, so no Secret Service provider can be reached.

Signing in again after a deployment has moved — a changed port keeps one profile rather than making two — clears what that profile left in the store under its old address, and says so if the store will not let it go. Nothing later in the profile's life reads that address, so this is the only moment those entries can be reached.

A profile signed in before your machine had a store moves into it by itself, on the first command that opens the profile — you do not sign in again, and credentials.key is removed once no profile is still sealed under it. A move that does not complete leaves the sealed profile exactly as it was and the command you ran carries on. A move interrupted after its first write can leave an entry behind in the store, and the command running at the time says that one was left for this profile and what the store refused it with. Removing it is yours to do, and the act is to remove that profile's entries from your keyring — both of them, since the warning names the profile rather than which of the two: the profile stays sealed in the file, so nothing afterwards reads either and no later command looks for them. The table above is how they are named.

A secret your operating system took and can no longer produce is not silently replaced by the file. A locked keyring and a removed entry say different things, because only one of them is answered by signing in again:

$ mfctl status
The credential for https://mail.example.test:8443 is held by this machine's secret store, which cannot be reached: the collection is locked. Make the store reachable and run the command again, or run 'mfctl login --endpoint https://mail.example.test:8443' to store the credential wherever this machine can hold it.

A provider that does not answer is given thirty seconds. On Linux a store that has claimed the session bus can hold a call open indefinitely — a wedged keyring daemon, or a locked collection whose unlock prompt was raised on a display nobody is watching, which is the jump-host case. The command withdraws the call after thirty seconds and reports the store as unreachable, so it falls back or fails rather than hanging. The wait is that long deliberately: an unlock prompt somebody is answering takes tens of seconds, and cutting it shorter would break the case the store exists for.

An OAuth profile holds a refresh token as well, kept wherever the access token is and bound to the same deployment — it is the longer-lived of the two secrets, so anything weaker would be a regression in the value most worth protecting. Beside it sit the values a renewal needs and that are not secrets: the token endpoint, the issuer, the client identifier, the resource, the scopes, and when the access token expires. They are recorded rather than rediscovered because a renewal happens on a command somebody is waiting on, and re-reading two discovery documents to spend a refresh token would put two more round trips in front of every expired session. A deployment that moves one of them is answered by signing in again.

A key-pair profile stores no credential at all, in either place. It records the absolute path of the private key and nothing else, so there is nothing an attacker could present even if the key file's protection failed. The path is not a secret and is stored in clear; what it names is, and it is protected by that file's own permissions rather than by anything here.

A profile that accepted something about its transport records that too, beside the endpoint and in clear: the pinned certificate's SHA-256 fingerprint, and whether the connection is unprotected. Neither is a secret — a fingerprint is what the deployment presents to anybody who connects — and what they protect is that the profile keeps talking to the same deployment. A profile that accepted nothing beyond the default records nothing, so the presence of the entry is itself the statement that something was accepted, and a file written before the entry existed reads as an ordinary profile rather than failing.

mfctl logout clears both halves. An entry your operating system will not let go of — a keyring that has locked since you signed in — is reported rather than left behind quietly, so you can remove it yourself once the keyring is open again. The profile is forgotten either way.

Be clear about what each arrangement buys. Where your operating system holds the secrets, another account on the same machine cannot read them, and a copy of your profile directory taken elsewhere does not open. Where they are sealed in the file, a credentials file that leaves the machine — in a backup, a synced folder, a support bundle, a screenshot of a directory listing — still discloses nothing on its own, because the key is random rather than derived from anything about the machine; but someone already able to read your files on your machine reads the key as easily as the store, and on Linux nothing prevents that. Neither arrangement defends against code running as you: a keyring answers whoever can ask it. That is the threat model this accepts, and packaging the command so it can be installed is tracked as #318.

What the command records about itself

Every invocation appends one line to a log beside the credential store, and that file is the only durable record of what mfctl did. The command holds no exporter and opens no span, so once your terminal's scrollback is gone nothing else on the machine answers what did I run against that deployment, when, and how did it end.

Platform Path
Linux $XDG_CONFIG_HOME/MailFathom/mfctl.log, or ~/.config/MailFathom/mfctl.log
Windows %APPDATA%\MailFathom\mfctl.log

One record per line, as JSON, so tail, grep, and jq each work on it without a parser that spans lines:

$ tail -1 ~/.config/MailFathom/mfctl.log
{"at":"2026-08-17T09:41:22.184+00:00","command":"mfctl contact delete","outcome":"Failed","durationMilliseconds":412,"exitCode":1,"deployment":"production","failure":"The deployment answered 404 rather than a contact."}

command is the path of names mfctl declares and deployment is your own name for the profile the command settled on. A field the invocation has nothing for is left out rather than written as a null.

outcome is one of four, and the last two are what makes this file worth having when something goes wrong:

outcome What happened What else the record carries
Completed The command did what you asked exitCode 0
Failed Something you can act on, already printed to your terminal exitCode 1, and failure with that same line
Faulted The command raised something that is a defect rather than your mistake fault with the type of it, and no exit code
Cancelled You stopped it before it finished, and it stopped where it was no exit code

fault is the type's name and nothing else about it — not the message, which is written for whoever will fix the defect and quotes what the code was working on, and not the stack, which is frames rather than data but would end the one-record-per-line shape. The stack itself went to your terminal, so what the log adds is that the crash happened at all, when, under which command, and what kind it was.

folder erase is the exception to the last row, and deliberately. It works through a mailbox in passes, so an interruption leaves a partial result rather than nothing: it catches the interruption itself, tells you how much it got through and that running it again continues from there, and reports that as a failure. Its records read Failed with that sentence, which is the more useful of the two answers — Cancelled would say you stopped it and not what it had done by then. No other command needs the exception, because a long operation the deployment carries is asked for in one request and watched from a second, and how far it got is read from the deployment rather than from this file.

No credential and no mail is in it. A credential never reaches a failure message in the first place, because those are written to be shown on your terminal. Mail is out by the split the command already keeps: what you asked for goes to standard output — a contact, an address, a subject — and failure is read back from the failure lines alone, which is narrower still than the stream carrying them: the guidance a command writes while it works and the cautions it raises are their own kinds and are passed over. Those failure sentences already avoid naming a person, for the same reason the log exists: a refusal that named one would end up in a file wherever the command is run from a script.

Your own deployment can be named in it. command carries no argument value, but the other two fields are not blind to where a deployment is. deployment is your name for the profile, and a sign-in that passed no --name is named after the deployment's own host. failure is the line the command already printed, and several of those quote the address or the alias you typed — Not signed in to https://… is the common one, and an invocation the parser refused outright carries whichever token it refused. Scrubbing both was considered and rejected: this file sits beside credentials.json, which records every profile's endpoint in clear, so a log naming none of them would be protecting an address the same directory already holds, at the cost of the field you read the log for. Treat the file as you treat that directory, which is to say read it before you paste it anywhere.

It is created readable by its user alone, on the same terms and for the same reason the credential store is, and it is bounded at one mebibyte: past that the current file becomes mfctl.log.1, replacing whatever was there, and a new one starts — so the log occupies at most two mebibytes however long you administer a deployment for. Every field of variable length is bounded as well — failure, fault, and the deployment name you chose — so one record stays one line. There is no retention policy beyond that, because retention for files on your own machine is yours to decide rather than this command's.

Turn it off for one invocation with --no-log, which is accepted after the subcommand as well, and for a shell session with MAILFATHOM_LOG=off. What you typed beats what your shell was told, and the default is on; every other value of the variable leaves the log on rather than failing a command over a typo in it.

A record that cannot be written — a read-only home directory, a full disk — is reported as one line on standard error and changes nothing else. The command's exit code and its own output stay exactly what they would have been, because the command's job is the command. Deleting the directory is not one of those cases: every append recreates it, so removing the log is a way to start a new one rather than a way to turn it off.

Troubleshooting

What you see What it means
Not signed in. No profile exists yet. Run mfctl login --endpoint https://host:port.
No default profile is set. Profiles exist but none is selected, which is what forgetting the selected one leaves behind. Run mfctl switch <name>.
There is no profile named … A typo, or a profile that was never created. The message lists the ones that exist.
Not signed in to https://… --endpoint named an address no profile serves. Sign in to it, or name a profile instead.
The deployment refused the credential. Nobody holds what was presented, or it is disabled or its lifetime has ended, or it does not list admin among its endpoints, or the request arrived from outside the networks it is accepted from, or what its own permission list leaves of its user's grant holds no administrative permission. The answer is the same for all of them by design. A credential provisioned without --surface admin — what an MCP client is given — is the commonest case.
this credential does not hold … The credential was accepted and the operation was not: no role assigned to its user grants the name the message states at the deployment, or the credential's own permission list or its token's scopes leave it out. Give the user a role that holds it, provision a credential whose list keeps it, or run the command as an administrator who already holds it. mfctl status prints what the one in use holds.
this credential holds … only over an organization or a user The credential's user holds the name the message states, but only through a role assigned over an organization or a user, and this endpoint admits the operation only at the deployment scope, as it does every operation but those a grant below the deployment reaches. Granting the name again changes nothing. Run the command as an administrator who holds it over the whole deployment, or assign the user a role holding it at the deployment scope only if they are meant to administer the whole deployment. mfctl status prints the scopes the one in use holds.
a role this would give, or sign somebody in with, lists a pattern The command would assign a role that lists a pattern, add a member to a group given one, or provision, rotate, or enable a credential for a user who holds one, and the credential in use does not hold mailfathom.admin.roles.write over the whole deployment. Holding it over the organization the command named changes nothing, because such a role widens on upgrade. Run the command as an administrator who holds that name over the whole deployment, or give the person a role of names alone. mfctl role list shows which roles list a pattern.
The deployment refused the operation: … The endpoint refused for a reason other than a missing permission, and the sentence is the deployment's own. A deployment publishing no permission for the route is a defect worth reporting, because no grant makes such a route reachable.
answered 429 The endpoint refused the request for its rate limit rather than for its credential. Retry-After on the response says when capacity returns where the limiter can compute one. The whole endpoint shares one bucket, so another caller's burst — including somebody guessing keys — is enough to cause this.
serves no administrative endpoint at /api/admin/… The address answered, but on a listener that serves something else. Check the port, and check that AdminEndpoint:Enabled is true.
This deployment configures no mail account named … mailbox authorize --account named an identifier no served user's record declares, or you are signed in to the wrong deployment. Nothing was stored.
is still mirrored, so erasing it would only cost a remirror folder erase named a folder the account still synchronizes, and nothing was erased. Switch that folder's Synchronize off, or remove its mapping, and ask again.
before the erasure was interrupted folder erase was stopped part way. What it reported erasing is gone and the rest is still there; run the same command again to continue from where it stopped.
The deployment refused the grant without saying why. The request was refused with no reason in the answer, which is what something in front of the endpoint answering 400 looks like. Check that --endpoint reaches the deployment itself.
rather than storing the token The endpoint answered with neither an acceptance nor an explained refusal. The token was not stored and the account is unchanged. A 500 here is most often a deployment with no DataEncryption key ring, which is what a stored token is sealed under; its own log names the cause.
did not identify itself as MailFathom Something else is answering on that port — a proxy, or another service.
refused rather than sent to a deployment from another release line The command and the deployment are from different major.minor releases, and nothing was sent. Take the command from the deployment's own release, or upgrade the deployment.
not the same build and problems may occur The two share a release line and so agree on the administrative contract, but are different builds of it — a patch apart, or one of them a nightly. The command ran.
is unchecked One of the two reported a version that could not be read, which is what an unstamped or locally built binary looks like. The command ran, and whether the two agree is unknown.
could not be reached Nothing is listening, or a firewall is in the way. The endpoint binds only what BindAddress names; 127.0.0.1 is unreachable from another machine by design.
presented a certificate this machine does not trust On login, the question described in when the connection is weaker than the default. On any other command, a profile that holds no pin met a certificate that stopped validating — sign in again to review it. Nothing was sent either way.
presented a certificate this profile has not pinned The deployment's certificate is not the one this profile accepted. Both fingerprints are named. A renewal is the ordinary cause and mfctl login is the answer; anything else is worth finding out about before you accept it.
The deployment's certificate was refused You answered no. Nothing was signed in to and nothing was stored.
Transport protection was refused You answered no to the clear-text question. Sign in to the https:// address, or accept the unprotected connection.
there is no terminal to ask on A piped or non-interactive login met one of the two questions. Pass --trust-untrusted-certificate or --allow-clear-text, whichever the message names.
did not answer in time The connection was accepted and no answer arrived within 30 seconds, so the address and the port are right and the deployment is what to look at — an overloaded host, a stalled process, or a firewall that drops rather than refuses.
The stored credential could not be read. The credentials file and the key that opens it no longer match, which is what a store copied from another machine or another user looks like. Sign in again to replace it.
No deployment was named. login needs an address the first time. Pass --endpoint, or set MAILFATHOM_ENDPOINT.
The sign-in has ended The refresh token expired, was revoked, or was invalidated by a server that rotates them. Run login again. This names the stored token, so it only ever appears on a command that had a session; a login that fails names what it presented instead.
did not accept the code the redirect carried The authorization code was already redeemed or had expired by the time it was exchanged, which is what a redirect answered twice or approved long after it was opened looks like. Run login again.
The device code is no longer valid Nobody finished at the verification address before the code expired, or the authorization server withdrew it. Run login --mode device again.
not a usable web address The authorization server published a verification_uri that is not an absolute http or https address, so there is nothing to put in front of the person signing in. This is a fault at the authorization server rather than in its configuration here.
publishes no OAuth metadata The endpoint names no oauth-subject entry under AdminEndpoint:Authentication. Sign in another way, or ask the operator to add one.
with something that is not a token response The authorization server was reached — at its token endpoint, or at its device authorization endpoint on login --mode device — and what came back is not the response the flow expects, with the status it answered named. A proxy, a login page, or an error page in front of the server looks like this, and so does an answer naming a character set this machine does not carry. Renewing a stored session fails the same way, so this reaches an ordinary command as well as login; nothing was stored either way.
accepts tokens from several authorization servers More than one is configured and only you know which population you belong to. Name it with --issuer.
issued no refresh token Nothing asked for offline access, so the session would end within the hour. Two settings can be missing: the deployment advertising offline_access in AdvertisedScopes, and the client being granted the scope at the authorization server. Check the metadata document first — if scopes_supported does not list it, nothing asked.
no device authorization endpoint That authorization server offers no device grant. Sign in from a machine with a browser.