Matrix user offboarding: deactivation and erasure for your leavers
An IT or compliance lead who must cut a leaver's access to a self-hosted Matrix server needs two answers: deactivation stops the person from signing in, and erasure additionally asks the server to remove the personal data it holds about them. The exact effects depend on the homeserver and on where logins are handled, so start by confirming your stack. On a Synapse-only deployment, local accounts and SSO mappings live in Synapse. Where Matrix Authentication Service (MAS) sits in front, account administration moves to MAS, so the leaver must be removed in the right place or may keep a working session. Confirm this in your environment before you write any procedure.
Offboarding should start at your identity provider. Synapse accepts logins through OpenID Connect, SAML2 or CAS, while MAS uses upstream OpenID Connect providers such as Keycloak, Microsoft Entra ID, Google or Authentik. MAS does not support SAML directly and recommends a bridge such as Dex. Disabling the leaver's directory account blocks new upstream logins, but it does not by itself end sessions that already exist. Test with a disposable account to see which sessions and devices survive upstream disablement in your setup. Also confirm whether directory deprovisioning triggers any Matrix action, because a step that depends on an admin remembering it is where gaps usually appear.
Erasure changes what remains of the leaver's data, and its effects on shared history need checking in your own environment. Confirm with test accounts what happens to the leaver's devices, cross-signing keys and key backup, and how other members' encrypted history depends on keys they hold. Ask your compliance lead to decide before the first real leaver whether erasure is required, whether retention rules or legal holds apply to chat data, and how that decision is recorded. Assign each decision a named owner, and rehearse the full procedure on a non-production account so the first live run is not the first test.
Which offboarding path fits your deployment
When Synapse holds the account and its password directly, there is no separate identity provider to change. Offboarding happens on the homeserver alone, and the account record in Synapse is the only place where access is granted and revoked. The admin work is to deactivate the user so they cannot log in, and to decide what happens to the devices and rooms they leave behind. Confirm the exact deactivation options and their effects against the Synapse Admin API documentation for your release before you script them.
- Deactivate the account: Use the Synapse Admin API to deactivate the user so logins stop and existing sessions are invalidated.
- Remove devices: Check whether the user's devices and access tokens are cleared as part of deactivation in your version, and remove any that remain.
- Review rooms: Confirm which rooms the leaver administers and whether any are left without an admin.
- Block local re-registration: Check that open registration is disabled so the same person cannot create a new account.
- Record the action: Keep a dated ticket that names the account and the operator who made the change.
Before you rely on this path, confirm with your team that no other system holds a copy of the password for this user.
When Matrix Authentication Service (MAS) handles sign-in, users authenticate against an upstream OpenID Connect provider such as Keycloak, Microsoft Entra ID, Google or Authentik. The identity provider is the authority for whether a person can sign in, so disabling the user there is the primary control. Homeserver cleanup still matters, because MAS sessions and Synapse data remain until you act on them. Session and account administration in MAS is covered in a sibling topic, so this path focuses on the handover between the two systems.
- Disable the upstream user: Disable or remove the leaver in the OIDC provider so new authorizations fail.
- End active sessions: Revoke the user's MAS sessions so existing tokens stop working, then confirm the account can no longer sign in.
- Check the homeserver: Confirm the matching Synapse account is deactivated or locked, since MAS does not replace the Synapse record.
- Handle SAML upstreams: MAS does not support SAML directly. If your directory uses SAML, place a bridge such as Dex between the two, and remember that the bridge also needs its own user disable step.
- Verify sign-in fails: Attempt a sign-in with the leaver's credentials from outside the network to confirm the block works.
Ask your identity team which system is the source of truth for account status, since disabling in the wrong place leaves access open.
Many organizations manage people in a central directory, such as an HR system feeding LDAP, Active Directory or an identity governance tool. In that model, the leaver's status changes upstream first, and the Matrix side must follow. The directory is the record you audit, so the offboarding trigger should originate there and reach Matrix through the connection your identity provider already uses. Confirm which provisioning connection exists between your directory and Synapse or MAS before assuming it removes accounts automatically.
- Disable at the source: Mark the person as inactive in the HR or directory system that feeds identity, so downstream tools see the change.
- Confirm propagation: Verify that the identity provider or sync process removes or disables the matching Matrix account, and record how long it took in your environment.
- Cover manual gaps: Where propagation is not automatic, document a manual Synapse or MAS step that runs the same day.
- Watch for orphaned accounts: Accounts created outside the directory will not be disabled by the sync, so reconcile the user list against the directory periodically.
- Test with a sample leaver: Run the full path with a test account before relying on it for real leavers.
Confirm with your provider whether the Synapse or MAS integration you use supports removing or deactivating accounts on directory change, and do not assume it does.
Offboarding options and when each fits
This table compares the main ways to remove a leaver from a self-hosted Matrix server, covering reversibility, effects on rooms and devices, and whether the action depends on the Synapse Admin API or MAS tooling. Read each row against your own retention and legal requirements, and treat version-specific behavior as something to confirm in the Synapse upgrade notes before you script it.
| Option | Reversibility and effect on rooms | Devices and keys | Tooling dependence and when it fits |
|---|---|---|---|
| Disable login only (suspend or lock the account) | Reversible. The user keeps membership and history, and can be reactivated if the leaver returns. | Existing sessions and devices may remain active unless you also end them. Confirm session behavior for your Synapse or MAS version. | Admin API or MAS CLI. Fits a short-term leave or an investigation where the account must be preserved. |
| Deactivate the account | Largely irreversible in practice. Reactivation is possible in some versions but does not restore erased content. Confirm with the upgrade notes. | Devices are typically removed and the user cannot log in. Confirm which keys and device records persist for your version. | Synapse Admin API deactivate endpoint, or MAS equivalent. Fits standard leavers when the identity provider cannot be relied on alone. |
| Deactivate and erase user data | Irreversible. Erasure requests remove personal content from events the user sent, subject to what your version retains. | Device and key material is removed or made unusable. Confirm which encrypted history remains readable to other members. | Synapse Admin API with the erase option. Fits leavers whose data must be removed under a documented data protection request. |
| Leave rooms before deactivation | Membership changes are visible to other members and remain in room history. Rooms stay active for remaining members. | Not affected directly, but sessions must still be ended afterward. | Room membership is managed per room or through scripts. Fits leavers who hold roles that other members depend on. |
| Reassign room admin power before leaving | Preserves room control for remaining members. Must be done before the leaver is deactivated. | No direct effect. | Power level changes through the client or admin tooling. Fits rooms where the leaver is the only admin, to avoid orphaned rooms. |
| Identity provider disables the user, Matrix follows | Reversible at the IdP. Matrix account state depends on how login is wired (OIDC via MAS, or Synapse SSO). | Depends on token and session lifetimes configured in the IdP and in MAS. Confirm propagation timing in your setup. | IdP admin console plus MAS or Synapse SSO configuration. Fits organizations where the IdP is the system of record for leavers. |
| SCIM or LDAP-driven lifecycle automation | Depends on the connector. Deprovisioning removes access centrally; erasure is a separate Matrix step. | Session revocation depends on the integration. Verify it ends active devices, not only new logins. | ESS includes LDAP and SCIM integration per Element's product page, so confirm it fits your deployment. Fits large estates with many leavers. |
How a leaver's access is removed across identity and homeserver
The removal starts when HR or the identity provider marks someone as leaving. That change must reach the upstream login first, because a user who can still sign in through the identity provider can reopen a Matrix session. The homeserver step deactivates the account, after which a decision point determines whether the account is only deactivated or also marked for erasure. Before closing the ticket, check that active sessions and devices are gone, since deactivation alone does not clear them in every setup. Confirm each step against the exact versions you run.
Offboarding order across the identity provider, login path and homeserver.
Set up offboarding in the order that keeps access closed
The sequence closes sign-in at the identity source first, then the Matrix account, then every live session, so a leaver cannot re-enter while you finish the cleanup. Each step ends with a check that you can rerun later and record as evidence.
Confirm the identity source of truth
Identify which system decides whether a person can sign in to Matrix. In a MAS deployment this is the upstream OpenID Connect provider such as Keycloak, Microsoft Entra ID, Google or Authentik. In a Synapse deployment using single sign-on, it is the configured oidc_providers, saml2_config or CAS source. Map each Matrix account to its upstream identity so you can find it from the leaver's HR or directory record. The step is done when you can name the upstream identity for every local account and can show a test lookup that returns the right account.
Disable upstream sign-in first
Disable or suspend the leaver's account in the upstream identity provider before touching anything on the Matrix side. This removes the ability to complete a new login, and it stops any single sign-on flow that would recreate access. Your identity team or the directory administrator usually performs this action, and the change should be recorded with a ticket reference. The check is a sign-in attempt through the Matrix client with the leaver's credentials, which should fail at the identity provider.
Deactivate the Matrix account
Deactivate the local Matrix account through the admin interface that matches your deployment. For Synapse this is the Admin API deactivation endpoint, and for MAS it is the MAS Admin API or CLI. Confirm the exact command for your version in the upstream documentation before running it, since admin endpoints change between releases. Deactivation should be requested with the erase option only if your written policy calls for it, which is covered in a later step. The check is that the account reports as deactivated in the admin listing and that a new login attempt is refused.
End active sessions and devices
Remove the leaver's devices and access tokens so that any client already signed in stops working. Deactivation alone does not guarantee that every existing session is closed in every deployment, so list the user's devices through the admin tooling and delete each one. Record the device count before and after. The check is that the device list is empty and that a previously open client, if you have one for testing, shows a signed-out state on its next sync.
Decide on erasure under written policy
Decide whether this leaver's personal data must be erased, retained or left as is, based on a written policy agreed with your legal, privacy and records owners. Erasure, where supported, removes or pseudonymizes the user's profile data in ways that differ from plain deactivation, so confirm the effect of the erase option on your Synapse or MAS version and on messages already sent. Document who approved the decision and the basis for it. The check is a signed or ticketed decision that names the account and the policy clause it follows.
Review rooms, keys and ownership
Check the rooms the leaver administered or created, because deactivation does not hand admin rights to anyone else. Identify rooms where the leaver was the only admin and plan how control moves to a current owner, and note any encrypted room where the leaver held the only copy of key material. Confirm with your encryption owner how key backup and verification are handled for the account. The check is a written list of affected rooms, each with a new admin or an accepted reason for leaving it, and no room left without an admin.
Verify with a test leaver account
Before relying on the process, run it end to end on a dedicated test account that you create for the purpose. Walk it through the upstream disable, the Matrix deactivation, the session cleanup and the erasure decision, then check the outcome from a client as the test user. Compare the result with what your written procedure states, and fix any gap before the next real leaver. Keep the test record with the procedure so auditors and reviewers can see that the steps were tested, not only written down.
What happens to a leaver's rooms, devices and encryption keys
Deactivating a leaver's account does not remove their history from the rooms they used. Messages they sent stay in shared rooms for the remaining members, and the room keeps its membership, state and room administrators. Whether any of that content is redacted, and how much, depends on the erasure option you choose and on your Synapse version, so confirm the exact behavior in the Synapse documentation for the release you run before you promise anyone that a person's messages will disappear. Also check who holds power in each room. If the leaver was the only room administrator, the room may be left without anyone who can change its settings or remove a bad actor, which is a planning problem to solve before the account is closed.
Devices and cross-signing keys need separate attention. Deactivation is meant to stop the account from signing in, but the device list and the leaver's cross-signing keys can remain visible to other users unless you remove them. Other members may see a verified identity that no longer belongs to anyone active, and a stale device can still hold message keys that were never shared with the rest of the room. Decide whether you want to delete the leaver's devices as part of offboarding, and confirm with your Synapse version how the admin endpoints handle device deletion and whether they affect the cross-signing keys.
Key backups are the item most often forgotten. A server-side key backup holds encrypted room keys that let a user recover history on a new device, and it belongs to the account. Left in place, it is unused data that still sits on your server, and it may be the only copy of keys for a conversation that a successor needs to read. Before the account is closed, decide whether anyone with a legitimate need should recover that history, and document the answer. Then check how your deployment stores and deletes backup data, and confirm this behavior in the Synapse documentation for your version and in your own test environment.
Security risks when leavers keep access
A leaver's access to a Matrix server rarely disappears in one step. It persists in the upstream identity provider, in live sessions, in admin and bot accounts, and in room permissions, and each of these leaves a different trail. The controls below close those gaps in the order a departure can unfold.
Upstream SSO still active
If Matrix Authentication Service (MAS) or Synapse signs users in through an upstream provider such as Keycloak, Microsoft Entra ID or Authentik, disabling the Matrix account alone does not stop a fresh login path from being recreated by the same identity. Disable or remove the user in the upstream provider first, then confirm that the homeserver account is deactivated. Check that no other application still trusts the same directory entry.
MAS upstream providersLive devices and sessions
A deactivated account can still hold open sessions and devices that hold message keys and cached content until those sessions are ended. Confirm that every device for the leaver is signed out and that the access tokens they hold are revoked. Record the device list before you remove it, because it is useful evidence if the departure is later questioned.
Admin accounts left behind
A leaver who held server admin rights keeps those rights unless you remove them explicitly. Review the admin flag on every account, and check whether the leaver set up any shared admin logins, service accounts or recovery addresses that still point to them. Ask for a short written list of admin accounts from each administrator before the departure date.
Bots and bridges owned by leavers
Bots, bridges and automation often run under a personal account that belongs to the person who set them up. When that person leaves, the bot may keep reading rooms, posting messages or holding encryption keys with no one responsible for it. Identify every bot and bridge account the leaver created, reassign ownership, and rotate any credentials the service used.
Room admin rights
Rooms can keep a leaver as the only administrator, which blocks room changes, or let them invite users and change settings after they stop working for you. Review power levels in rooms the leaver administered and promote a successor before deactivation. Rooms left without an admin become difficult to manage, so plan that handover in advance.
Audit gaps
Without a record of when the account was disabled, which sessions were ended and who approved the change, you cannot show that a leaver's access ended on time. Keep a timestamped log of each offboarding step, including the upstream change, the homeserver deactivation and the admin review. Store it with your identity records, not only in chat.
Questions buyers ask about offboarding Matrix users
What drives the cost of offboarding Matrix users?
The main cost driver is how many systems must agree on a leaver's status before the Matrix account is deactivated. A Synapse deployment with a single local login is cheap to change, while one that authenticates through an identity provider, Matrix Authentication Service (MAS) and a directory sync needs each layer mapped and tested. Other drivers include the number of bridges and bots holding the user's access, the number of rooms and encrypted devices involved, and whether your retention rules require a particular erasure workflow. Ask any partner to price the work from a written list of those systems, and separate one-time design and build from any recurring review or retainer.
How long does a first offboarding setup take?
Duration depends on how much of the process already exists. If your identity provider already disables accounts for leavers, the Matrix part is mostly mapping that signal to a deactivation call and proving it works. If there is no joiner, mover and leaver process yet, the first setup also needs owners, rules for rooms and devices, and sign-off from HR and legal. Ask for a timeline that lists the discovery, build, test and handover phases separately, and confirm which systems must be available in a test environment before the work starts.
What does offboarding need from our identity provider and admin staff?
It needs a reliable source of truth for employment status, a way to deactivate a login in that source, and an agreed owner for every step after the identity provider signals a leaver. On the identity side, confirm how MAS or your Synapse login method maps users to the upstream provider, and whether group or attribute changes can trigger the offboarding flow. On the admin side, you need named people who can approve erasure, review exceptions for shared or service accounts, and confirm that bots and bridges no longer rely on the leaver's credentials. Document these roles before engineers write any automation.
Can an internal team set up Matrix offboarding without outside help?
An internal team with Synapse and identity provider experience can usually build the basic flow, provided it has time to test the admin API calls against a copy of production data. The harder parts are usually policy decisions about what erasure means for shared history, and verifying that devices, keys and bridge sessions are handled consistently. Outside help is most useful when the team lacks recent Synapse operations experience, when several identity sources must be reconciled, or when auditors expect written evidence of the process. Whichever route you take, assign an owner for the runbook and for each test.
How does erasure interact with our retention policy?
Deactivation and erasure are different steps, and retention policy decides when you move from one to the other. Deactivating an account stops login and removes it from active use, but room history may still contain the leaver's messages, which other members can see. Erasure, where the server supports it, removes or redacts the user's personal data under a defined rule. Before you configure anything, get written retention periods from your data protection or legal team, then map each category of data (messages, media, device keys, account records) to a deletion or retention decision. The Matrix compliance pages on this site explain the server-side controls in more detail.
Which parts of offboarding are hardest to get right?
The hardest parts are usually the ones that touch state outside the main account: devices and end-to-end encryption keys, bridge and bot sessions, room administrator roles, and media the leaver uploaded. A deactivated account can still own rooms, and a room with no remaining admin can become hard to manage. Bridges may keep forwarding messages under their own credentials, and personal access tokens or sessions in MAS may remain valid until revoked. Build a checklist for each of these and test it with a sample leaver account before relying on it for real departures.
How do we test that offboarding works?
Test offboarding with dedicated test accounts in a non-production homeserver that mirrors your identity provider and federation settings. Create a leaver scenario that covers an active login, several devices, a room where the user is the only admin, an uploaded file and a bridge connection, then run the offboarding flow and check each result against the expected outcome. Repeat the test after every Synapse or MAS upgrade, since admin API behavior and database schema can change between releases. Keep the test results and the runbook together so that an auditor or security reviewer can see what was checked and when.
How DeployOpen scopes and delivers Matrix offboarding
DeployOpen starts Matrix offboarding work with a written scope that names the systems involved: the homeserver (Synapse, or Synapse with Matrix Authentication Service if MAS is in place), the identity provider that is the source of truth for employment status, the clients and devices your users rely on, and any bridges or bots in rooms that leavers administer. The scope also records which decisions belong to your team, such as whether a leaver's account is deactivated only or later erased, who approves erasure requests, and how long records are kept. Deliverables are agreed in writing before work starts, so the offboarding runbook, the configuration changes and the test evidence are all defined up front and can be quoted against that scope.
On the identity side, the work covers how a disabled account in your identity provider leads to a Matrix deactivation. Where MAS is deployed, the upstream OpenID Connect provider's disabled state is the first control to confirm, and DeployOpen checks how that state reaches the homeserver. Where Synapse authenticates users directly, the process must reach the Synapse Admin API instead. Each path is tested with dedicated test accounts that go through the full sequence: sign-in is blocked, existing sessions and devices are handled as agreed, and the account's rooms and keys behave as your policy requires. Test results are recorded so your security and compliance teams can review them.
Offboarding does not end at handover. Because identity providers, Synapse and MAS each receive upgrades on their own schedules, DeployOpen can offer a retainer that re-runs the offboarding tests after changes and keeps the runbook current. Ask any partner, DeployOpen included, to confirm the retainer's coverage, response expectations and what is re-tested in writing before you sign. This section describes DeployOpen's delivery approach only. It does not represent certifications, partner status or audit outcomes.

