# Delete a group

Disband the specified group by chat_id. After disbanding the group through the API, the group chat history will not be saved.

## Prerequisites

The app needs to enable [bot capability](https://open.feishu.cn/document/uAjLw4CM/ugTN1YjL4UTN24CO1UjN/trouble-shooting/how-to-enable-bot-ability).

## Usage restrictions

- If you disband a group with the app identity (tenant_access_token), the app bot must meet any of the following conditions.

- The app bot is the group owner.

- The app bot is the creator of the group, and the app has enabled the **Update the information of groups created by app** (im:chat:operate_as_owner) permission.

- If you disband a group with the user identity (user_access_token), the user must be the group owner.

## Request

Facts | &nbsp;
---|---
HTTP URL | https://open.feishu.cn/open-apis/im/v1/chats/:chat_id
HTTP Method | DELETE
Rate Limit | [1000 per minute & 50 per second](https://open.feishu.cn/document/ukTMukTMukTM/uUzN04SN3QjL1cDN)
Supported app types | Custom App、Store App
Required scopes<br>**To use this API, you must have at least 1 of the listed scopes.**<br>Enable any scope from the list | Obtain and update group information(im:chat)<br>Disband group(im:chat:delete)

### Request header

Parameter | Type | Required | Description
---|---|---|---
Authorization | string | Yes | `tenant_access_token`<br>or<br>`user_access_token`<br>**Value format**: "Bearer `access_token`"<br>**Example value**: "Bearer u-7f1bcd13fc57d46bac21793a18e560"<br>[How to choose and get access token](https://open.feishu.cn/document/uAjLw4CM/ugTN1YjL4UTN24CO1UjN/trouble-shooting/how-to-choose-which-type-of-token-to-use)

### Path parameters

Parameter | Type | Description
---|---|---
chat_id | string | Group ID. How to get it:<br>- [Create a group](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/im-v1/chat/create), get the chat_id of the group from the returned result.<br>- Call the [Get the list of groups that the user or robot is in](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/im-v1/chat/list) interface to query the chat_id of the group that the user or robot is in.<br>- Call the [Search the list of groups visible to the user or robot](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/im-v1/chat/search) to search for the chat_id of the group that the user or robot is in and the group that is open to the user or robot.<br>**Notice**: Only group IDs with group mode of `group` are supported. You can call the [get group information](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/im-v1/chat/get) interface and check whether the value of the `chat_mode` parameter is `group` in the returned result.<br>**Example value**: "oc_a0553eda9014c201e6969b478895c230"

## Response

### Response body

Parameter | Type | Description
---|---|---
code | int | Error codes, fail if not zero
msg | string | Error descriptions
data | \- | \-

### Response body example
```json
{
    "code": 0,
    "msg": "success",
    "data": {}
}
```

### Error code

HTTP status code | Error code | Description | Troubleshooting suggestions
---|---|---|---
400 | 232004 | Such an app does NOT exist. | The app_id as the operator doesn't exist. Please contact [technical support](https://applink.feishu.cn/TLJsX982).
400 | 232006 | Your request specifies a chat_id which is invalid. | Invalid chat_id, please check whether the chat_id is correct. How to obtain:<br>- [Create a group](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/im-v1/chat/create), and obtain the chat_id of the group from the returned result.<br>- Call the [Get the list of groups where the user or bot is](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/im-v1/chat/list) interface to query the chat_id of the group where the user or bot is.<br>- Call [Search the list of groups visible to users or bots](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/im-v1/chat/search) to search for the chat_id of the group where the user or bot is and the group that is open to the user or bot.
400 | 232008 | Your request specifies a chat whose type is NOT supported currently. | Unsupported chat mode (chat_mode) or chat type (chat_type). This interface only supports group IDs with group mode set to `group`. You can call the [get group information](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/im-v1/chat/get) interface and check whether the `chat_mode` parameter value is `group` in the returned result.
400 | 232009 | Your request specifies a chat which has already been dissolved. | The group has been disbanded and cannot be operated.
400 | 232010 | Operator and chat can NOT be in different tenants. | The operator and the group being operated should be under the same tenant.
400 | 232011 | Operator can NOT be out of the chat. | The operator is not in the group. You need to [add the application or user currently calling the API to the group to be operated](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/im-v1/chat-members/create) and try again.
400 | 232017 | No Permission: If the operator is NOT owner or creator with the scope, the operator can NOT complete the request. | The operator who calls the interface does not have the management identity such as group owner or group creator in the group and cannot operate.<br>- If the group is disbanded with the app identity (tenant_access_token), the app bot needs to meet any of the following conditions.<br>- The app bot is the group owner.<br>- The app bot is the creator of the group, and the app has enabled the **Update the information of groups created by app** (im:chat:operate_as_owner) permission.<br>- If the group is disbanded with the user identity (user_access_token), the user must be the group owner.
400 | 232025 | Bot ability is not activated. | The app does not have bot capabilities enabled. You need to log in to the [Developer Console](https://open.feishu.cn/app), add the **Bot** capability in **Features** > **Add Features** on the app details page, and publish the app to make the configuration effective. For specific operations, see [Bot Capabilities](https://open.feishu.cn/document/uAjLw4CM/ugTN1YjL4UTN24CO1UjN/trouble-shooting/how-to-enable-bot-ability).
400 | 232033 | The operator or invited bots does NOT have the authority to manage external chats without the scope. | The group being operated on is an external group, and operations on external groups are not currently supported. Only bots with external sharing capabilities can support external groups. For more details, please refer to [Bot support for external groups and One-on-One chats with external users](https://open.feishu.cn/document/uAjLw4CM/ukzMukzMukzM/develop-robots/add-bot-to-external-group).
400 | 232034 | The app is unavailable or inactivated by the tenant. | The app is not installed or enabled in this tenant. You need to install the app before using the app call interface.

For more error code information, see [General error codes](https://open.feishu.cn/document/ukTMukTMukTM/ugjM14COyUjL4ITN).

