> 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/regeneratebyoasnverifycode.md).

# RegenerateByoAsnVerifyCode

## 1. API Description

This API (RegenerateByoAsnVerifyCode) is used to reissue the verification code for a specified bring-your-own ASN. The old verification code becomes invalid at the same time.

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

* After you update the aut-num object of this ASN on the RIR according to the new `exportDeclaration`, you need to call [VerifyByoAsn](/api-reference/zec/byo-asn/verifybyoasn.md) again to confirm the ownership.
* **Only the `EXPIRED` status supports this operation.** In the `VERIFYING` status, the verification code is still valid and does not need to be reissued. If you confirm that the declaration is misconfigured, call [DeleteByoAsn](/api-reference/zec/byo-asn/deletebyoasn.md) and then onboard the ASN 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 whose verification code is to be regenerated.</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>                                                                      |
| byoAsnId          | String                                                           | ID of the BYO ASN.                                                                                                                                                                         |
| asn               | Integer                                                          | ASN number.                                                                                                                                                                                |
| status            | [ByoAsnStatus](/api-reference/zec/datastructure.md#byoasnstatus) | Status after the verification code is regenerated, which returns to `VERIFYING`.                                                                                                           |
| verifyCode        | String                                                           | <p>New verification code.</p><p>The old verification code becomes invalid immediately, and you need to write the new verification code into the aut-num object of this ASN on the RIR.</p> |
| exportDeclaration | String                                                           | <p>The complete export declaration statement.</p><p>You can copy this statement directly to update the aut-num object of this ASN on the RIR.</p>                                          |

## 4. Code Example

{% tabs %}
{% tab title="Example" %}
**1. The verification code has expired and needs to be regenerated.**

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

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

Response：
{
  "requestId": "TBFC01FCF-6439-4530-ADBC-16809F0C3E8F",
  "response": {
    "requestId": "TBFC01FCF-6439-4530-ADBC-16809F0C3E8F",
    "byoAsnId": "byoasn-3JK29DKS",
    "asn": 12340,
    "status": "VERIFYING",
    "verifyCode": "62610:774301",
    "exportDeclaration": "export: to AS62610 action community .= {62610:774301}; announce AS12340"
  }
}
```

{% 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\_STATUS | Operations on the BYO ASN with current status are not supported. |
