> 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/networking/sdn/cloud-router/createcloudrouter.md).

# CreateCloudRouter

## 1. API Description

This API (CreateCloudRouter) is used to create Cloud Router

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

* Currently only postpaid Cloud Routers can be created.
* A VPC can join only one Cloud Router.
* This is an asynchronous API. Once the create request is successfully submitted, a Cloud Router `ID` is returned, but the create operation is not completed immediately. During this period the instance status will be **`DEPLOYING`**. The creation result can be checked by calling the [**`DescribeCloudRouters`**](https://github.com/zenlayer/zenlayercloud-api-doc-en/tree/main/sdn/cloud-router/describe-cloud-routers.md) API -- if the status (`cloudRouterStatus`) changes from `DEPLOYING` (creating) to **RUNNING** (available), the creation succeeded; if no record is found, the creation failed. Do not perform any operation on the Cloud Router while it is being created.
  {% endhint %}

## 2. Input Parameters

The following request parameter list only provides API request parameters.

| Parameter Name         | Required | Type                                                                                                             | Description                                                                                                                 |
| ---------------------- | -------- | ---------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- |
| cloudRouterName        | Yes      | String                                                                                                           | Name of the Cloud Router, up to 255 characters. Defaults to cloud-router-{timestamp} if not specified.                      |
| edgePoints             | Yes      | Array of [CreateCloudRouterEdgePoint](/api-reference/networking/sdn/datastructure.md#createcloudrouteredgepoint) | <p>Edge point information. At least 2 edge points are required.</p><p>Value range: \[-, 500.0]</p>                          |
| cloudRouterDescription | No       | String                                                                                                           | Description of the Cloud Router, up to 255 characters.                                                                      |
| resourceGroupId        | No       | String                                                                                                           | Resource group ID. If not specified, the resource is placed in the default resource group.                                  |
| marketingOptions       | No       | [MarketingInfo](/api-reference/networking/sdn/datastructure.md#marketinginfo)                                    | Marketing activity information.                                                                                             |
| tags                   | No       | [TagAssociation](/api-reference/networking/sdn/datastructure.md#tagassociation)                                  | <p>Tags associated when creating the Cloud Router.</p><p>Note: associated <code>tag keys</code> must not 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> |
| cloudRouterId  | String | Cloud Router ID.                                                                                                      |

## 4. Code Example

{% tabs %}
{% tab title="Example" %}
**1. Create a Cloud Router with 2 edge points, each with a bandwidth of 1 Mbps. One edge point is a port, and the other is a VPC.**

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

Request:
{
    "edgePoints":[
        {
            "ipAddress":"4.4.4.4/24",
            "vlanId": 1024,
            "portId":"your-portId",
            "bgpConnection":{
                "password":"",
                "peerIpAddress":"4.4.4.3",
                "localAsn":62610,
                "peerAsn":6543
            },
            "bandwidthMbps":1
        },
        {
            "vpcId":"your vpc id",
            "bandwidthMbps":1
        }
    ],
    "cloudRouterName":"Test",
    "cloudRouterDescription":""
}

Response:
{   
  "requestId": "T05992D0C-7E8B-4047-B0C0-780F2CD549D3",
  "response": {
     "requestId": "T98044459-95B2-477E-9A2F-00253A70CC6E",
     "cloudRouterId": "cloud router id"
  }
}
```

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