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

# Create Channel

> Create new chat channels

## Overview

Create new chat channels, supporting both personal and group channel creation.

## Request Body

### Required Parameters

<ParamField body="channel_id" type="string" required>
  Channel ID, must be unique
</ParamField>

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

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

### Optional Parameters

<ParamField body="ban" type="integer" default={0}>
  Whether to mute

  * `0` - Allow speaking
  * `1` - Mute all members
</ParamField>

<ParamField body="disband" type="integer" default={0}>
  Whether to disband channel

  * `1` - Disband channel (irreversible)
</ParamField>

<ParamField body="send_ban" type="integer" default={0}>
  Whether to prohibit sending messages (0=not prohibited, 1=prohibited). When prohibited, all members in the channel cannot send messages. Personal channels can receive messages but cannot send messages.
</ParamField>

<ParamField body="allow_stranger" type="integer" default={0}>
  Whether to allow strangers to send messages (0=not allowed, 1=allowed) (this configuration currently only supports personal channels)
  Personal channel: If AllowStranger is 1, strangers can send messages to the current user. For example: if the current account needs to accept stranger messages, channel\_id is the current user's uid
</ParamField>

<ParamField body="subscribers" type="array">
  Subscriber list

  <ParamField body="subscribers[]" type="string">
    Subscriber user ID
  </ParamField>
</ParamField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST "http://localhost:5001/channel" \
    -H "Content-Type: application/json" \
    -d '{
      "channel_id": "group123",
      "channel_type": 2,
      "large": 0,
      "ban": 0,
      "subscribers": ["user1", "user2", "user3"]
    }'
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch('http://localhost:5001/channel', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      channel_id: 'group123',
      channel_type: 2,
      large: 0,
      ban: 0,
      subscribers: ['user1', 'user2', 'user3']
    })
  });

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

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

  data = {
      "channel_id": "group123",
      "channel_type": 2,
      "large": 0,
      "ban": 0,
      "subscribers": ["user1", "user2", "user3"]
  }

  response = requests.post('http://localhost:5001/channel', 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,
          "large":        0,
          "ban":          0,
          "subscribers":  []string{"user1", "user2", "user3"},
      }
      
      jsonData, _ := json.Marshal(data)
      
      resp, err := http.Post(
          "http://localhost:5001/channel",
          "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 created successfully |
| 400         | Request parameter error      |
| 409         | Channel ID already exists    |
| 500         | Internal server error        |

## Best Practices

1. **Channel ID Uniqueness**: Ensure channel ID is unique in the system
2. **Member Management**: Properly set initial subscriber list
3. **Permission Control**: Set mute status as needed
