> ## Documentation Index
> Fetch the complete documentation index at: https://learn.social.plus/llms.txt
> Use this file to discover all available pages before exploring further.

# Delete Community

> Delete a community by ID with SDK permission enforcement and client-side cleanup.

The SDK exposes a delete-community API for authorized users when a community is no longer needed. Treat deletion as irreversible from the client UI, and confirm your product's data-retention and recovery policy outside the client SDK.

<Warning>
  Deleting a community cannot be undone through the client SDK. Use explicit confirmation in your product UI before calling the SDK method.
</Warning>

## Parameters

| Parameter     | Type   | Required | Description                                  |
| ------------- | ------ | -------- | -------------------------------------------- |
| `communityId` | String | Yes      | Unique identifier of the community to delete |

## Permission Requirements

Deletion is permission-gated by the backend. In most products, deletion controls are shown only to community creators, moderators, or administrators, but the SDK call is still validated server-side.

## Delete a Community

Call the delete-community method with a `communityId`. TypeScript, Android, and Flutter use `deleteCommunity`; iOS uses `deleteCommunity(withId:)`.

<CodeGroup>
  ```typescript TypeScript theme={null}
  import { CommunityRepository } from '@amityco/ts-sdk';

  async function deleteCommunity(communityId: Amity.Community['communityId']): Promise<Amity.Community> {
    const deletedCommunity = await CommunityRepository.deleteCommunity(communityId);

    return deletedCommunity;
  }
  ```

  ```swift iOS theme={null}
  try await communityRepository.deleteCommunity(withId: "community-id")
  ```

  ```kotlin Android theme={null}
  fun deleteCommunity() {
      AmitySocialClient.newCommunityRepository()
          .deleteCommunity(communityId = "communityId")
          .doOnComplete {
              // Community deleted.
          }
          .doOnError { error ->
              // Handle error.
          }
          .subscribe()
  }
  ```

  ```dart Flutter theme={null}
  void deleteCommunity(String communityId) {
    AmitySocialClient.newCommunityRepository()
        .deleteCommunity(communityId)
        .then((value) {
          // Community deleted.
        })
        .onError((error, stackTrace) {
          // Handle error.
        });
  }
  ```
</CodeGroup>

## Client Impact

After successful deletion, handle the client-side effects explicitly:

* Remove the community from any local list or cached UI state.
* Navigate away from deleted community detail screens.
* Stop showing actions that require the deleted `communityId`.
* Refresh affected discovery or membership queries when needed.

## Pre-deletion Considerations

### Product Policy

Before exposing deletion, decide how your product handles:

1. What data is retained or recoverable outside the client SDK.
2. Whether members should be notified before deletion.
3. Whether archive, privacy, or moderation actions are safer than deletion.

### Member Management

Refresh membership and discovery views after deletion so users do not see stale references to the deleted community.

## Best Practices

<Tip>
  Implement multiple confirmation steps and consider a cooling-off period for community deletion requests to prevent impulsive decisions.
</Tip>

### Implementation Guidelines

1. Require multiple explicit confirmations.
2. Make users type the community name to confirm.
3. Verify user permissions before showing delete options.
4. Show clear progress during deletion operations.
5. Provide clear confirmation of successful deletion.

### User Experience Considerations

1. Emphasize the permanent nature of deletion.
2. Offer data export before deletion if your product supports it.
3. Provide tools to notify community members.
4. Handle post-deletion navigation appropriately.

## Related Topics

<CardGroup cols={2}>
  <Card title="Update Community" href="./update-community" icon="pencil">
    Modify community settings as an alternative to deletion
  </Card>

  <Card title="Community Moderation" href="../organization/community-moderation" icon="shield-check">
    Manage communities with moderation tools instead of deletion
  </Card>

  <Card title="Create Community" href="./create-community" icon="plus">
    Learn about community creation to understand deletion impact
  </Card>

  <Card title="Member Management" href="../organization/query-community-members" icon="users">
    Handle member relationships before community deletion
  </Card>
</CardGroup>
