# User lifecycle

Every Mosaic user has a lifecycle that starts when the user record is created and continues through login, suspension, and removal. The user's status shows whether they have logged in and whether they can still log in. When you later suspend the user, delete them, or remove them from an app, that choice changes what the user can access and what Mosaic keeps.

See [User management](/guides/user/how_users_work) for how Mosaic stores identity and profile data, and [Manage users](/guides/user/manage_users) for Admin Portal tasks.

## User statuses

A user's status indicates whether they have logged in, and whether they are allowed to log in. Mosaic uses three statuses: **Pending**, **Active**, and **Suspended**.

| Status | Meaning |
|  --- | --- |
| **Pending** | An administrator created the user, and the user has not yet authenticated to an assigned app. |
| **Active** | The user has logged in. |
| **Suspended** | An administrator suspended the user. The user cannot log in to any app in the tenant. |


### Pending

When an administrator creates a user in the Admin Portal, with the [Users APIs](/openapi/user/user.openapi), or with the [Create User](/guides/orchestration/journeys/create_user) journey step, and the user has not yet authenticated to an assigned app, Mosaic sets the status to **Pending**.

### Active

After the user logs in, Mosaic sets the status to **Active**. If you allow authentication flows to create new users, a user created on first login is **Active**, because that login is their first authentication.

### Suspended

Suspend a user who should not be able to sign in. For example, suspend a temporary user, such as a project-based employee, or a user identified as fraudulent. A **Suspended** user cannot log in to any app in the tenant.

Note
In the Admin Portal, this state is **Suspended**. In the Users API `status` field, the same state is `Disabled`.

Reactivating a suspended user in the Admin Portal restores their previous status, **Pending** or **Active**.

## Change a user's status

In the Admin Portal, go to **B2C Identity** or **B2B Identity** > **Users**. Open the action menu for the user and select the status:

- If the user is **Active** or **Pending**, select **Suspend user**.
- If the user is **Suspended**, select **Activate user**.


You can also set `status` with the [Update user API](/openapi/user/user.openapi/other/updateuser). Use `Disabled` to suspend the user. `Active` and `Pending` are the other accepted values.

## Delete or remove a user

Removing or deleting a user is a final step in their identity lifecycle. Mosaic provides three operations to choose from depending on your data and PII policies:

| Operation | What it does | User record afterward |
|  --- | --- | --- |
| [Delete user](#delete-a-user) | Soft-deletes the user | Kept with a deleted status, and no longer queryable |
| [Erase user data](#erase-user-data) | Permanently removes the user's core data from active databases | Removed from active databases |
| [Remove user from app](#remove-a-user-from-an-app) | Unlinks the user from one app | Kept at the user store, and still queryable |


### Delete a user

Deleting a user is a soft delete. You can delete a user from the **Users** page (**Delete** in the action menu) or with the [Delete user API](/openapi/user/user.openapi/other/deletetenantuser) (`DELETE /v1/manage/users/{user_id}`). The API requires an admin access token from a [management application](/guides/user/management_apps).

After a soft delete:

- The user's core data is no longer queryable. The Admin Portal does not return or display the user, or associations such as devices and credential data.
- Mosaic keeps the underlying user record with a deleted status. The record supports traceability, auditing, and troubleshooting after deletion, including activity that occurred after the user was deleted.
- Mosaic deletes the password credential and preserves other credentials.
- Session data can remain after the user is deleted.
- Mosaic preserves user activity and event data, and that data stays queryable. You can review it in [user activity](/guides/user/user_audit_logs).


A soft-deleted user ID stays reserved. To remove the remaining data and make the user ID available for reuse, [erase the user](#erase-user-data).

### Erase user data

Erasing a user is a hard delete. Call the [Erase user data API](/openapi/user/user.openapi/other/harddeleteuser) (`DELETE /v1/users/{user_id}/erase`). You can erase an active user, or a user you already soft-deleted, when the remaining record must be removed.

Important
Use this operation only when user data must be permanently erased, such as to fulfill a right-to-erasure request. Erase removes the user from Mosaic's active databases. You cannot undo it through Mosaic. Mosaic retains database snapshots for recovery for up to one week, so the erase does not immediately remove the data from those snapshots.

After an erase:

- The user record no longer exists in the active databases. Queries do not return the user, the Admin Portal does not display the user, and the underlying user record is not accessible.
- Session data can remain after the user is erased.
- Mosaic preserves user activity and event data. Information in those events that depends on the deleted user record may no longer be available.


### Remove a user from an app

Removing a user from an app unlinks the user record from one Mosaic application. The user record and its data remain at the tenant level and stay queryable.

You can remove a user from apps in the Admin Portal (**Remove from apps** in the action menu), with the [Remove user from app API](/openapi/user/user.openapi/other/removeuserfromapp) (`DELETE /v1/users/{user_id}/apps`), or with the [Remove User From App](/guides/orchestration/journeys/delete_user) journey step. The API removes the user from the application that authorized the call.

Passwords belong to a specific application. Removing a user from an app also deletes that user's password for the application.