> For the complete documentation index, see [llms.txt](https://docs.console.zenlayer.com/api-reference/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.console.zenlayer.com/api-reference/zec/byo-asn/deletebyoasn.md).

# DeleteByoAsn

## 1. API Description

This API (DeleteByoAsn) is used to delete a BYO ASN. Before deleting it, make sure that no BYOIP CIDR block is advertised under this ASN.

{% hint style="info" %}
**Notes**

* Before the deletion, all BYOIP CIDR blocks advertised under this ASN must be released, otherwise the deletion is rejected. You can call [DescribeCidrs](/api-reference/zec/cidr-block/describecidrs.md) and [DescribeIpv6Cidrs](/api-reference/zec/cidr-block/describeipv6cidrs.md) to query them by `asn`.
* After the deletion, this ASN can no longer be used to create BYOIPs. To onboard it again, call [CreateByoAsn](/api-reference/zec/byo-asn/createbyoasn.md) again and complete the ownership verification again.
  {% endhint %}

## 2. Input Parameters

The following request parameter list only provides API request parameters.

| Parameter Name | Required | Type   | Description                                                                                                                                              |
| -------------- | -------- | ------ | -------------------------------------------------------------------------------------------------------------------------------------------------------- |
| byoAsnId       | Yes      | String | <p>ID of the BYO ASN to be deleted.</p><p>It can be obtained by calling <a href="/api-reference/zec/byo-asn/describebyoasns.md">DescribeByoAsns</a>.</p> |

## 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" %}
**1. Delete a BYO ASN.**

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

Request：
{
  "byoAsnId": "byoasn-3JK29DKS"
}

Response：
{
  "requestId": "TBFC01FCF-6439-4530-ADBC-16809F0C3E8F",
  "response": {
    "requestId": "TBFC01FCF-6439-4530-ADBC-16809F0C3E8F"
  }
}
```

{% endtab %}
{% endtabs %}

## 5. Developer Resources

Zenlayer Cloud API 2.0 integrates [SDKs](/api-reference/api-introduction/toolkit/api-sdk.md)，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](/api-reference/api-introduction/instruction/commonerrorcode.md).

| HTTP Status Code | Error Code                             | Description                                                         |
| ---------------- | -------------------------------------- | ------------------------------------------------------------------- |
| 404              | INVALID\_BYO\_ASN\_NOT\_FOUND          | The BYO ASN does not exist.                                         |
| 400              | OPERATION\_DENIED\_BYO\_ASN\_HAS\_CIDR | The BYO ASN still has advertised CIDR blocks and cannot be deleted. |
