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

# VerifyByoAsn

## 1. API Description

This API (VerifyByoAsn) is used to confirm whether the export declaration of a BYO ASN has taken effect on the RIR.

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

* Before calling this interface, make sure that the declaration has been completed on the RIR that manages this ASN according to the `exportDeclaration` returned by [CreateByoAsn](/api-reference/zec/byo-asn/createbyoasn.md).
* BYO ASNs in the `EXPIRED` status do not support this operation. Call [RegenerateByoAsnVerifyCode](/api-reference/zec/byo-asn/regeneratebyoasnverifycode.md) first to regenerate the verification code.
  {% 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 verified.</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) | <p>Status after the verification.</p><p><code>AVAILABLE</code> indicates that the ownership has been confirmed and this ASN can be used to create BYOIPs. If it is still <code>VERIFYING</code>, the export declaration has not been detected yet and you can try again later.</p> |
| verifyCode        | String                                                           | <p>Verification code.</p><p>You need to write it 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 into the aut-num object of this ASN on the RIR.</p>                                                                                                                                       |

## 4. Code Example

{% tabs %}
{% tab title="Example" %}
**1. The declaration has been added; confirm the ASN ownership.**

```json
POST /api/v2/zec HTTP/1.1
Host: console.zenlayer.com
Content-Type: application/json
X-ZC-Action: VerifyByoAsn
<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": "AVAILABLE",
    "verifyCode": "62610:831522",
    "exportDeclaration": "export: to AS62610 action community .= {62610:831522}; announce AS12340"
  }
}
```

**2. The declaration has not been detected yet.**

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

Request：
{
  "byoAsnId": "byoasn-7PQ41MZX"
}

Response：
{
  "requestId": "TBFC01FCF-6439-4530-ADBC-16809F0C3E8F",
  "response": {
    "requestId": "TBFC01FCF-6439-4530-ADBC-16809F0C3E8F",
    "byoAsnId": "byoasn-7PQ41MZX",
    "asn": 59798,
    "status": "VERIFYING",
    "verifyCode": "62610:519890",
    "exportDeclaration": "export: to AS62610 action community .= {62610:519890}; announce AS59798"
  }
}
```

{% 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. |
