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

# Delete Channel

> Delete a specified channel

## Overview

Delete a specified channel, including all related data and member relationships.

## Request Body

### Required Parameters

<ParamField body="channel_id" type="string" required>
  Channel ID
</ParamField>

<ParamField body="channel_type" type="integer" required>
  Channel type

  * `1` - Personal channel
  * `2` - Group channel
</ParamField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST "http://localhost:5001/channel/delete" \
    -H "Content-Type: application/json" \
    -d '{
      "channel_id": "group123",
      "channel_type": 2
    }'
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch('http://localhost:5001/channel/delete', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      channel_id: 'group123',
      channel_type: 2
    })
  });

  const data = await response.json();
  console.log(data);
  ```

  ```python Python theme={null}
  import requests

  data = {
      "channel_id": "group123",
      "channel_type": 2
  }

  response = requests.post('http://localhost:5001/channel/delete', json=data)
  result = response.json()
  print(result)
  ```

  ```go Go theme={null}
  package main

  import (
      "bytes"
      "encoding/json"
      "fmt"
      "net/http"
  )

  func main() {
      data := map[string]interface{}{
          "channel_id":   "group123",
          "channel_type": 2,
      }
      
      jsonData, _ := json.Marshal(data)
      
      resp, err := http.Post(
          "http://localhost:5001/channel/delete",
          "application/json",
          bytes.NewBuffer(jsonData),
      )
      if err != nil {
          panic(err)
      }
      defer resp.Body.Close()
      
      var result map[string]interface{}
      json.NewDecoder(resp.Body).Decode(&result)
      fmt.Printf("%+v\n", result)
  }
  ```
</RequestExample>

<ResponseExample>
  ```json Success Response theme={null}
  {
    "status": "ok"
  }
  ```
</ResponseExample>

## Response Fields

<ResponseField name="status" type="string" required>
  Operation status, returns `"ok"` on success
</ResponseField>

## Status Codes

| Status Code | Description                  |
| ----------- | ---------------------------- |
| 200         | Channel deleted successfully |
| 400         | Request parameter error      |
| 403         | No deletion permission       |
| 404         | Channel does not exist       |
| 500         | Internal server error        |

## Deletion Impact

### Data Cleanup

Deleting a channel will clean up the following related data:

| Data Type            | Cleanup Scope                         | Impact                                  |
| -------------------- | ------------------------------------- | --------------------------------------- |
| Channel Info         | Channel basic info, settings          | Channel completely disappears           |
| Member Relationships | All member subscription relationships | Members can no longer receive messages  |
| Message History      | All messages in the channel           | Message records permanently deleted     |
| Conversation Records | Channel in user conversation lists    | Channel removed from conversation lists |

### User Impact

* **Member Notification**: All members will receive channel dissolution notification
* **Conversation Cleanup**: Channel removed from all members' conversation lists
* **Message Loss**: Message history in the channel will be unrecoverable
* **Permission Invalidation**: All channel-related permissions immediately invalidated

## Permission Requirements

### Personal Channel (channel\_type = 1)

* **Participants**: Any participant in the channel can delete it
* **System Administrator**: Has permission to delete any personal channel

### Group Channel (channel\_type = 2)

* **Group Owner**: Only the group owner can dissolve the group
* **System Administrator**: Has permission to delete any group
* **Regular Members**: No deletion permission, can only leave the group

## Security Considerations

### Deletion Confirmation

Recommend secondary confirmation before deletion:

1. **Permission Verification**: Confirm the operator has deletion permission
2. **Identity Verification**: Require password or verification code input
3. **Impact Warning**: Clearly inform the scope of deletion impact
4. **Final Confirmation**: Provide a final chance to cancel

### Data Backup

Consider data backup before deletion:

* **Message Export**: Allow export of important messages
* **Member List**: Save member information for rebuilding
* **File Backup**: Backup important files in the channel
* **Operation Logging**: Record detailed information about deletion operations

## Alternative Solutions

### Soft Delete

For important channels, consider soft deletion:

* **Hide Channel**: Hide from user interface but retain data
* **Disable Features**: Prohibit sending messages but retain history
* **Set Expiration**: Set automatic deletion time
* **Permission Revocation**: Remove all member permissions

### Archive Processing

* **Message Archive**: Transfer messages to archive storage
* **Read-only Mode**: Set to read-only status
* **History Viewing**: Allow viewing but no operations
* **Periodic Cleanup**: Regularly clean up archived data

## Best Practices

1. **Permission Control**: Strictly control deletion permissions to prevent misoperations
2. **Operation Logging**: Detailed logging of deletion operations including time, operator, reason
3. **Notification Mechanism**: Timely notification to all related members
4. **Data Backup**: Perform data backup before deleting important channels
5. **Recovery Mechanism**: Provide recovery functionality within a certain time period
6. **Batch Deletion**: Support batch deletion of multiple channels
