---
source_url: https://www.pubnub.com/docs/chat/kotlin-chat-sdk/build/features/users/delete
title: Delete users
updated_at: 2026-06-15T12:11:35.959Z
---

> 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()` or `deleteUser()`.

* `delete()` - call on a `User` object (no ID needed)
* `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.
:::

### Method signature

These methods take the following parameters:

* delete() 1user.delete(): PNFuture<Unit>
* deleteUser() 1fun deleteUser(id: String): PNFuture<Unit>

#### Input

| Parameter | Required in delete() | Required in deleteUser() | Description |
| --- | --- | --- | --- |
| id | 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

| Method | Description |
| --- | --- |
| `delete()`Type: `PNFuture<Unit>` | Returns when the user is successfully deleted. |
| `deleteUser()`Type: `PNFuture<Unit>` | Returns when the user is successfully deleted. |

### Sample code

Delete user `support_agent_15`.

* delete() 1// reference the "chat" object and invoke the "getUser()" method2chat.getUser("support_agent_15").async { result ->3 result.onSuccess { user ->4 // delete the user5 user.delete().async { deleteResult ->6 deleteResult.onSuccess {7 // handle success8 println("User successfully deleted.")9 }.onFailure { exception ->10 // handle failure11 exception.printStackTrace()12 println("Failed to delete the user: ${exception.message}")13 }14 }15 }.onFailure { exception ->16 // handle failure17 exception.printStackTrace()18 println("Failed to get user metadata: ${exception.message}")19 }20}
* deleteUser() 1// reference the "chat" object and directly invoke the "deleteUser()" method2chat.deleteUser("support_agent_15").async { deleteResult ->3 deleteResult.onSuccess {4 // handle success5 println("User successfully deleted permanently.")6 }.onFailure { exception ->7 // handle failure8 exception.printStackTrace()9 println("Failed to delete the user: ${exception.message}")10 }11}