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

# CreateByoAsn

## 1. API Description

This API (CreateByoAsn) is used to submit a bring-your-own ASN and obtain the verification code used for ownership verification.

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

* `asn` supports both 2-byte and 4-byte ASNs, with a maximum value of **4294967295** (2^32-1). Requests exceeding this value are rejected. Which ASNs can be onboarded (private ranges, reserved ranges, and so on) is determined by the underlying system.
* This interface only generates a verification code, which does not mean the ASN is available. You need to complete the declaration on the RIR that manages this ASN (ARIN, RIPE NCC, APNIC, and so on) according to the `exportDeclaration` in the response, and then call [VerifyByoAsn](/api-reference/zec/byo-asn/verifybyoasn.md) to confirm the ownership. The ASN can be used to create BYOIPs only after its status changes to `AVAILABLE`.
  {% endhint %}

## 2. Input Parameters

The following request parameter list only provides API request parameters.

| Parameter Name  | Required | Type                                                                 | Description                                                                                                                                                    |
| --------------- | -------- | -------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| asn             | Yes      | Integer                                                              | <p>Public ASN to be onboarded.</p><p>Both 2-byte and 4-byte ASNs are supported, with a maximum value of 4294967295.</p><p>Value range: \[-, 4294967295]</p>    |
| resourceGroupId | No       | String                                                               | <p>ID of the resource group that the BYO ASN belongs to after creation.</p><p>If it is not specified, the BYO ASN is placed in the default resource group.</p> |
| tags            | No       | [TagAssociation](/api-reference/zec/datastructure.md#tagassociation) | <p>Tags bound when creating the BYO ASN.</p><p>Note: the bound "tag keys" cannot be duplicated.</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 newly created BYO ASN.                                                                                                             |
| asn               | Integer                                                          | ASN number.                                                                                                                                  |
| status            | [ByoAsnStatus](/api-reference/zec/datastructure.md#byoasnstatus) | Current status.                                                                                                                              |
| 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> |
| createTime        | String                                                           | Creation time.                                                                                                                               |

## 4. Code Example

{% tabs %}
{% tab title="Example" %}
**1. Submit a bring-your-own ASN and obtain the verification code.**

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

Request：
{
  "asn": 12340
}

Response：
{
  "requestId": "TBFC01FCF-6439-4530-ADBC-16809F0C3E8F",
  "response": {
    "requestId": "TBFC01FCF-6439-4530-ADBC-16809F0C3E8F",
    "byoAsnId": "byoasn-3JK29DKS",
    "asn": 12340,
    "status": "VERIFYING",
    "verifyCode": "62610:831522",
    "exportDeclaration": "export: to AS62610 action community .= {62610:831522}; announce AS12340",
    "createTime": "2026-09-03T07:21:17Z"
  }
}
```

{% 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                       |
| ---------------- | ---------------------------------- | --------------------------------- |
| 400              | INVALID\_BYO\_ASN\_ALREADY\_EXISTS | The ASN number is already in use. |
