# DeleteSecurityGroup

## 1. API Description

This API (DeleteSecurityGroup) is used to delete a security group.

{% hint style="info" %} <mark style="color:blue;">**Note**</mark>

<mark style="color:blue;">Not supported for the default security group.</mark>
{% endhint %}

## 2. Input Parameters

The following request parameter list only provides API request parameters.

| Parameter Name  | Required | Type   | Description        |
| --------------- | -------- | ------ | ------------------ |
| securityGroupId | Yes      | String | Security group ID. |

## 3. Output Parameters

| Parameter Name | Type   | Description                                                                                                           |
| -------------- | ------ | --------------------------------------------------------------------------------------------------------------------- |
| requestId      | String | <p>The unique request ID, which is returned for each request.</p><p>RequestId is required for locating a problem.</p> |

## 4. Code Example

{% tabs %}
{% tab title="Example" %}
**Delete a security group.**

```json
POST /api/v2/zec HTTP/1.1
Host: console.zenlayer.com
Content-Type: application/json
X-ZC-Action: DeleteSecurityGroup
<Common Request Params>

Request:
{
  "securityGroupId": "your-security-group-id"
}

Response:
{
  "requestId": "T980F9D21-D7E4-4C6D-8B79-91A15861FB05",
  "response": {
    "requestId": "T980F9D21-D7E4-4C6D-8B79-91A15861FB05"
  }
}
```

{% endtab %}
{% endtabs %}

## 5. Developer Resources

Zenlayer Cloud API 2.0 integrates [SDKs](https://docs.console.zenlayer.com/api-reference/api-introduction/toolkit/api-sdk)，to make it easier for you to call APIs. More programming languages will be supported.

## 6. Error Codes

The following only lists the error codes related to the API business logic. For other error codes, see [Common Error Codes](https://docs.console.zenlayer.com/api-reference/api-introduction/instruction/commonerrorcode).

| HTTP Status Code | Error Code                                                    | Description                                                                        |
| ---------------- | ------------------------------------------------------------- | ---------------------------------------------------------------------------------- |
| 400              | OPERATION\_DENIED\_DEFAULT\_SECURITY\_GROUP\_NOT\_SUPPORT     | Not supported for the default security group.                                      |
| 409              | OPERATION\_DENIED\_SECURITY\_GROUP\_ASSOCIATE\_VNIC           | Operation is not supported for the security group associated with a vNIC.          |
| 404              | INVALID\_SECURITY\_GROUP\_NOT\_FOUND                          | The specified security group does not exist.                                       |
| 409              | OPERATION\_DENIED\_SECURITY\_GROUP\_ASSOCIATE\_NAT            | Operation is not supported for the security group associated with a NAT gateway.   |
| 409              | OPERATION\_DENIED\_SECURITY\_GROUP\_ASSOCIATE\_LOAD\_BALANCER | Operation is not supported for the security group associated with a load balancer. |
