---
source_url: https://www.pubnub.com/docs/chat/unity-chat-sdk/build/features/users/delete
title: Delete users
updated_at: 2026-06-01T12:02:11.303Z
---

> Documentation Index
> For a curated overview of PubNub documentation, see: https://www.pubnub.com/docs/llms.txt
> For the full list of all documentation pages, see: https://www.pubnub.com/docs/llms-full.txt


# Delete users

Permanently remove a user from [App Context](https://www.pubnub.com/docs/sdks/unity/api-reference/objects) storage with `Delete()` or `DeleteUser()`.

Both methods produce the same result. Call `Delete()` on a `User` object or `DeleteUser()` on the `Chat` object with the user ID.

:::warning Soft delete deprecated
Soft deletion for users has been deprecated. `Delete()` now always performs a hard delete. Use `Delete()` without any parameters to permanently remove a user. The `soft` parameter and `Restore()` method are no longer available for users.
:::

:::note Requires App Context
Enable [App Context](https://youtu.be/9UEoSlngpYI) in the [Admin Portal](https://admin.pubnub.com/) to store user data.
:::

### Method signature

These methods take the following parameters:

* Delete() (on the User object) 1user.Delete()
* DeleteUser() (on the Chat object) 1chat.DeleteUser(string userId)

#### Input

| Parameter | Required in Delete() | Required in DeleteUser() | Description |
| --- | --- | --- | --- |
| userId | string | Optional |  | No | Yes | [Unique user identifier](https://www.pubnub.com/docs/general/setup/users-and-devices#user-id-usage) (up to 92 UTF-8 characters). |

#### Output

| Type | Description |
| --- | --- |
| `Task<ChatOperationResult>` | Returned `Task` that you can `await` to get the result of the delete operation. |

### Sample code

Permanently delete user `support_agent_15`.

* Delete() (on the User object) using System.Threading.Tasks; using PubnubApi; using PubnubChatApi; using UnityEngine; // Configuration PubnubChatConfig chatConfig = new PubnubChatConfig(); PNConfiguration pnConfiguration = new PNConfiguration(new UserId("myUniqueUserId")) { SubscribeKey = "demo", PublishKey = "demo", Secure = true }; // Initialize Unity Chat var chatResult = await UnityChat.CreateInstance(chatConfig, pnConfiguration); if (!chatResult.Error) { chat = chatResult.Result; } var userResult = await chat.GetUser("support_agent_15"); if (userResult.Error) { Debug.Log("Couldn't find user!"); return; } var user = userResult.Result; await user.Delete();
* DeleteUser() (on the Chat object) using System.Threading.Tasks; using PubnubApi; using PubnubChatApi; using UnityEngine; // Configuration PubnubChatConfig chatConfig = new PubnubChatConfig(); PNConfiguration pnConfiguration = new PNConfiguration(new UserId("myUniqueUserId")) { SubscribeKey = "demo", PublishKey = "demo", Secure = true }; // Initialize Unity Chat var chatResult = await UnityChat.CreateInstance(chatConfig, pnConfiguration); if (!chatResult.Error) { chat = chatResult.Result; } await chat.DeleteUser("support_agent_15");