
## Deleting users and groups

URL: https://docs.atlan.com/product/capabilities/build-apps/sdks/python/users-groups/how-tos/delete-users-groups

> Delete users and groups in Atlan using AtlanUser and AtlanGroup with the Python SDK (pyatlan).

# AtlanUser: delete users and groups

Use `AtlanUser` and `AtlanGroup` in the Atlan Python SDK to programmatically delete users and groups from your Atlan environment.

Deleting users and groups uses a similar pattern to the retrieval operations. For this you can use static methods provided by the `AtlanUser` and `AtlanGroup` classes.

:::warning[All delete operations are permanent]
All delete operations on users and groups are permanent, hard-deletes. There is no way to archive (soft-delete) users and groups.
:::

## Delete group

For example, to delete a group:

### Java

```java showLineNumbers title="Delete a group"
AtlanGroup.delete(client, "e79cb8eb-2bb6-4821-914c-f8dfd21fedc7"); // (1)
```

1. To delete a group, you must specify its GUID and can simply call the `AtlanGroup.delete()` method. Because this operation will remove the group from Atlan, you must [provide it an `AtlanClient`](https://docs.atlan.com/llms/platform/python/set-up-sdk/llms.txt) through which to connect to the tenant.

### Python

```python showLineNumbers title="Delete a group"
from pyatlan.client.atlan import AtlanClient

client = AtlanClient()
client.group.purge("e79cb8eb-2bb6-4821-914c-f8dfd21fedc7") # (1)
```

1. To delete a group, you must specify its GUID and can simply call the `group.purge()` method.

### Kotlin

```kotlin showLineNumbers title="Delete a group"
AtlanGroup.delete(client, "e79cb8eb-2bb6-4821-914c-f8dfd21fedc7") // (1)
```

1. To delete a group, you must specify its GUID and can simply call the `AtlanGroup.delete()` method. Because this operation will remove the group from Atlan, you must [provide it an `AtlanClient`](https://docs.atlan.com/llms/platform/python/set-up-sdk/llms.txt) through which to connect to the tenant.

### Go

```go showLineNumbers title="Delete a group"
ctx.GroupClient.Purge("a99f50bc-46bf-4d08-a987-3411ef5cfc33") // (1)
```

1. To delete a group, you must specify its GUID and can simply call the `GroupClient.Purge()` method.

### Raw REST API

```json showLineNumbers title="POST /api/service/groups/e79cb8eb-2bb6-4821-914c-f8dfd21fedc7/delete"
// (1)
```

1. All details are in the URL itself.

 :::tip[Group ID in the URL]
Note that you must provide the unique ID (GUID) of the group to delete it.
 :::

## Delete user

:::warning[Irreversible operation that requires admin user's bearer token]
Deleting a user is irreversible—be certain you want to fully remove the user and all references to the user (their ownership of assets, workflows, and so on) before running this operation. This operation can only be done using an admin user's bearer token, not an API token.
:::
**Go**

```go showLineNumbers title="Delete a user"
response, atlanErr := ctx.UserClient.RemoveUser(
 "test-user-1", 
 "test-user-2", 
 "test-user-3",
) // (1)
if atlanErr != nil {
 logger.Log.Errorf("Error deleting user: %v", atlanErr) // (2)
}
```

1. Call the `ctx.UserClient.RemoveUser()` method with the following parameters :

 - **userName**: The username of the user to be removed (`"test-user-1"` in this example).
 - **transferToUserName**: The username of the user to whom the assets should be transferred (`"test-user-2"` in this example).
 - **wfCreatorUserName (optional)**: The username of the workflow creator (`"test-user-3"` in this example). If `nil`, it defaults to `transferToUserName`.

2. If an error occurs during the deletion, it will be logged.

> **Note:** A user can only be removed if they have fewer permissions than an admin. An admin can't remove another admin.

---
