---
source_url: https://www.pubnub.com/docs/chat/swift-chat-sdk/build/features/users/delete
title: Delete users
updated_at: 2026-06-18T11:25:46.007Z
---

> 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 permanently 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() (on the User object) 1user.delete() async throws
* deleteUser() (on the Chat object) 1chat.deleteUser(2 id: String3) async throws

#### 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

This method doesn't return any value.

### Sample code

:::tip Sample code
The code samples in Swift Chat SDK focus on asynchronous code execution.
You can also write synchronous code as the parameters are shared between the async and sync methods but we don't provide usage examples of such.
:::

Permanently delete user `support_agent_15`.

* delete() // Assumes a "ChatImpl" reference named "chat" Task { if let user = try await chat.getUser(userId: "support_agent_15") { try await user.delete() } else { debugPrint("User not found") } }
* deleteUser() // Assumes a "ChatImpl" reference named "chat" Task { try await chat.deleteUser(id: "support_agent_15") }