---
source_url: https://www.pubnub.com/docs/chat/unreal-chat-sdk/build/features/users/delete
title: Delete users
updated_at: 2026-06-25T07:47:00.263Z
---

> 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

Remove users with `Delete()`.

##### Usage in Blueprints and C++

You can use PubNub's functionality via Blueprints or directly in C++ code.

* In Blueprints, you can access PubNub from any Widget or Actor. Start by [initializing chat](https://www.pubnub.com/docs/chat/unreal-chat-sdk/build/configuration#initialize-pubnub-chat) using `InitChat` on `UPubnubChatSubsystem`. Afterwards, you can use the returned `UPubnubChat` object reference to call all Chat SDK functions.

:::warning Blueprint functions
The Blueprints provided in the documentation show how you can structure your application and may contain utility methods and elements like buttons that are not part of the Unreal Chat SDK and are meant to serve as guidance.
:::

* In C++, you can use UPubnubChatSubsystem as any other Game Instance Subsystem. #include "Kismet/GameplayStatics.h" #include "Engine/GameInstance.h" #include "PubnubChatSubsystem.h" // ACTION REQUIRED: Replace ASample_ChatSubsystem with name of your Actor class void ASample_ChatSubsystem::InitChatSample() { // Get PubnubChatSubsystem from GameInstance UGameInstance* GameInstance = UGameplayStatics::GetGameInstance(this); UPubnubChatSubsystem* PubnubChatSubsystem = GameInstance->GetSubsystem<UPubnubChatSubsystem>(); // Initialize Chat - InitChat may fail under some conditions so make sure to check the Result for errors before using the Chat FPubnubChatInitChatResult InitChatResult = PubnubChatSubsystem->InitChat(TEXT("demo"), TEXT("demo"), TEXT("Player_001")); UPubnubChat* PubnubChat = InitChatResult.Chat; } Chat now allows you to call all Chat SDK functions, for example, Chat->GetChannel("my_channel").

:::note Asynchronous and synchronous method execution
Most PubNub Unreal SDK methods are available in both asynchronous and synchronous variants.
* Asynchronous methods (Async suffix) return void and take an optional delegate parameter that fires when the operation completes. 1User->DeleteAsync(OnOperationResponseDelegate); You can also use native callbacks that accept lambdas instead of dynamic delegates. Native callback types have the Native suffix (for example, FOnPubnubChatOperationResponseNative).
* Synchronous methods (no suffix) block the main game thread until the operation completes and return a result struct directly. 1FPubnubChatOperationResult Result = User->Delete();
:::

* `User->Delete()` - call on a `User` object (no ID needed)
* `Chat->DeleteUser()` - call on a `Chat` object (requires user ID)

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

## Delete a user (hard delete)

### Method signature

#### C++ / Input parameters

* User->Delete() 1User->Delete();
* Chat->DeleteUser() 1Chat->DeleteUser(FString UserID);

| Parameter | Required in User->Delete() | Required in Chat->DeleteUser() | Description |
| --- | --- | --- | --- |
| UserID | FString | 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). |

#### Blueprint

#### Output

| Type | Description |
| --- | --- |
| `FPubnubChatOperationResult` | Returned object containing `Error` (bool) and `ErrorMessage` (FString). |

### Sample code

:::tip Reference code
This example is a self-contained code snippet ready to be run. Set up your Unreal project and follow the instructions in the lines marked with `ACTION REQUIRED` before running the code. Use it as a reference when working with other examples in this document.
:::

Delete a user asynchronously.

###### C++

###### Actor.h

```cpp
// blueprint.uz50yfrv
UFUNCTION(BlueprintCallable, Category = "PubnubChat|Samples|ChatUser")
void DeleteUserSample();
```

###### Actor.cpp

```cpp
// ACTION REQUIRED: Replace ASample_ChatUser with name of your Actor class
void ASample_ChatUser::DeleteUserSample()
{
	// snippet.hide
	UPubnubChatUser* User = nullptr;
	// snippet.show

	// Assumes User is a valid UPubnubChatUser (e.g. from GetUser)

	// Delete this user on the server
	User->DeleteAsync(nullptr);
}
```

###### Blueprint

* `Chat->DeleteUser()`

###### C++

```cpp
// ACTION REQUIRED: Replace ASample_Chat with name of your Actor class
void ASample_Chat::DeleteUserSample()
{
	// snippet.hide
	UPubnubChat* Chat = nullptr;
	// snippet.show

	// Assumes Chat is a valid and initialized instance of UPubnubChat

	// Bind a callback with signature matching FOnPubnubChatOperationResponseNative, then call Async
	FOnPubnubChatOperationResponseNative Callback;
	// ACTION REQUIRED: Replace ASample_Chat with name of your Actor class
	Callback.BindUObject(this, &ASample_Chat::OnDeleteUserResponse);
	Chat->DeleteUserAsync(TEXT("Player_002"), Callback);
}

// ACTION REQUIRED: Replace ASample_Chat with name of your Actor class
void ASample_Chat::OnDeleteUserResponse(const FPubnubChatOperationResult& Result)
{
	if (Result.Error) { return; }
	// Deletion completed
}
```

###### Blueprint