# CreateEips

## 1. API Description

This API (CreateEips) is used to create one or more elastic IPs.

#### Prerequisites

* Query regions: call [`DescribeEipRegions`](/api-reference/compute/zec/elastic-ip/describeeipregions.md) to check the available regions supporting the sale of elastic IPs.
* Query network billing methods: call [`DescribeEipInternetChargeTypes`](/api-reference/compute/zec/elastic-ip/describeeipinternetchargetypes.md) to check the available network billing methods.
* Query remote regions: call [`DescribeEipRemoteRegions`](/api-reference/compute/zec/elastic-ip/describeeipremoteregions.md) to check the available regions you want to remote to.
* Query CIDR ID: call [`DescribeCidrs`](/api-reference/compute/zec/cidr-block/describecidrs.md) to check the available CIDR IDs.

{% hint style="info" %} <mark style="color:blue;">**Note**</mark>

* <mark style="color:blue;">`eipV4Type`</mark> <mark style="color:blue;">and</mark> <mark style="color:blue;">`cidrId`</mark> <mark style="color:blue;">cannot be passed together or left empty.</mark>
* <mark style="color:blue;">Passing</mark> <mark style="color:blue;">`cidrId`</mark> <mark style="color:blue;">means the public IP is generated from a CIDR block.</mark>
* <mark style="color:blue;">If assigning to an instance, ensure that the primary private IP on the instance’s primary vNIC can still be assigned an elastic IP.</mark>
  {% endhint %}

## 2. Input Parameters

The following request parameter list only provides API request parameters.

| Parameter Name          | Required | Type                                                                                 | Description                                                                                                                                                                                                               |
| ----------------------- | -------- | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| regionId                | Yes      | String                                                                               | Region ID.                                                                                                                                                                                                                |
| name                    | Yes      | String                                                                               | <p>Name of the elastic IP.</p><p>This parameter must start with a number or a letter, containing 2 to 63 characters. Only letters, numbers, - and periods (.) are supported.</p>                                          |
| internetChargeType      | Yes      | [InternetChargeType](/api-reference/compute/zec/datastructure.md#internetchargetype) | Network billing methods .                                                                                                                                                                                                 |
| amount                  | No       | Integer                                                                              | <p>Quantity.</p><p>Value range: \[1, +)</p><p>Default value: 1</p>                                                                                                                                                        |
| eipV4Type \[Deprecated] | No       | [EipNetworkType](/api-reference/compute/zec/datastructure.md#eipnetworktype)         | <p>Network types of public IPv4.</p><p>Deprecated. Please use networkLineType instead.</p>                                                                                                                                |
| networkLineType         | No       | [NetworkLineType](/api-reference/compute/zec/datastructure.md#networklinetype)       | Network types of public IPv4.                                                                                                                                                                                             |
| primaryIsp              | No       | [EipIsp](/api-reference/compute/zec/datastructure.md#eipisp)                         | <p>If the eipV4Type field is set to ThreeLine , this field is required and must include:</p><p>CHINA\_TELECOM CHINA\_UNICOM CHINA\_MOBILE</p>                                                                             |
| bandwidth               | No       | Integer                                                                              | <p>Public outbound bandwidth cap.</p><p>Unit: Mbps .</p><p>Bandwidth cap varies by instance size.</p><p>Value range: \[1, +)</p>                                                                                          |
| cidrId                  | No       | String                                                                               | <p>CIDR ID.</p><p>If this parameter is specified, eipV4Type must be empty.</p>                                                                                                                                            |
| publicIp                | No       | String                                                                               | <p>The starting public IP address from which elastic IPs are allocated within the CIDR block.</p><p>This field only takes effect when <code>cidrId</code> is specified.</p>                                               |
| resourceGroupId         | No       | String                                                                               | Resource group ID for the elastic public IP. If not specified, the IP will be placed in the default resource group.                                                                                                       |
| flowPackage             | No       | Float                                                                                | <p>Traffic package size (TB).</p><p>The parameter is valid only when internetChargeType is ByTrafficPackage .</p><p>Default value: 0 .</p><p>The value supports up to one decimal place.</p><p>Value range: \[0.0, +)</p> |
| clusterId               | No       | String                                                                               | <p>Bandwidth cluster ID for the public IPv6 address.</p><p>This parameter must be specified when the subnet's stack type includes public IPv6, and the network billing model is <code>BandwidthCluster</code>.</p>        |
| peerRegionId            | No       | String                                                                               | Remote region ID.                                                                                                                                                                                                         |
| marketingOptions        | No       | [MarketingInfo](/api-reference/compute/zec/datastructure.md#marketinginfo)           | Information on marketing campaigns.                                                                                                                                                                                       |
| tags                    | No       | [TagAssociation](/api-reference/compute/zec/datastructure.md#tagassociation)         | <p>Bound tags when creating the elastic IP.</p><p>Tag keys must be unique.</p>                                                                                                                                            |
| instanceIds             | No       | Array of String                                                                      | <p>IDs of instances to be attached.</p><p>The number of IDs should be the same as diskAmount .</p>                                                                                                                        |
| bindType                | No       | [BindType](/api-reference/compute/zec/datastructure.md#bindtype)                     | <p>Elastic IP mode when binding to resources.</p><p>Effective when specific instanceIds are specified.</p><p>Defaults to standard NAT mode.</p>                                                                           |
| rateLimitMode           | No       | [RateLimitMode](/api-reference/compute/zec/datastructure.md#ratelimitmode)           | <p>Rate limit mode.</p><p>Default value: LOOSE</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> |
| eipIds         | Array of String | ID list of elastic IPs.                                                                                               |
| orderNumber    | String          | Order No.                                                                                                             |

## 4. Code Example

{% tabs %}
{% tab title="Example" %}
**Create one or more elastic IPs.**

<pre class="language-json"><code class="lang-json"><strong>POST /api/v2/zec HTTP/1.1
</strong>Host: console.zenlayer.com
Content-Type: application/json
X-ZC-Action: CreateEips


Request：
{
  "regionId": "asia-east-1",
  "amount": 1,
  "name": "xxx",
  "internetChargeType": "ByTrafficPackage",
  "eipV4Type": "BGPLine",
  "bandwidth": 50,
  "flowPackage": 2,
  "resourceGroupId": "xxxx"
}

Response:
{
  "requestId": "TBFC01FCF-6439-4530-ADBC-16809F0C3E8F",
  "response": {
    "requestId": "TBFC01FCF-6439-4530-ADBC-16809F0C3E8F",
    "eipIds": ["xxx","xxx"],
    "orderNumber": "xxx"
  }
}
</code></pre>

{% 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\_CIDR\_NOT\_FOUND                                       | CIDR block not found.                                                            |
| 400              | INVALID\_PARAMETER\_BANDWIDTH\_ERROR                            | Bandwidth size is below the minimum limit.                                       |
| 400              | INVALID\_RATE\_LIMIT\_MODE\_REQUIRES\_BANDWIDTH                 | Bandwidth must be specified when the rate limit mode is STRICT.                  |
| 400              | OPERATION\_DENIED\_CIDR\_CREATE\_SOURCE                         | This operation is not supported by the CIDR source.                              |
| 400              | INVALID\_PARAMETER\_BANDWIDTH\_EXCEED                           | Bandwidth size exceeds the upper limit.                                          |
| 404              | INVALID\_REGION\_NOT\_FOUND                                     | Specified availability zone does not exist.                                      |
| 400              | OPERATION\_DENIED\_CIDR\_IP\_INSUFFICIENT                       | Insufficient remaining IPs in the CIDR block.                                    |
| 400              | OPERATION\_DENIED\_CIDR\_STATUS                                 | The specified CIDR state does not support this operation.                        |
| 400              | OPERATION\_DENIED\_EIP\_UNSUPPORTED\_CUSTOMIZE                  | The manually specified IP address is invalid.                                    |
| 400              | OPERATION\_DENIED\_EIP\_UNSUPPORTED\_NETWORK\_TYPE              | The EIP network billing method is not supported.                                 |
| 400              | OPERATION\_DENIED\_EIP\_UNSUPPORTED\_REMOTE\_IPT                | This customer is temporarily not supported to configure Remote IPT.              |
| 400              | OPERATION\_DENIED\_INTERNET\_CHARGE\_TYPE\_NOT\_SUPPORT         | IP network billing type is not supported.                                        |
| 400              | OPERATION\_DENIED\_EIP\_NOT\_SUPPORT\_PASS\_THROUGH\_BIND\_TYPE | Elastic IP does not support the Bypass mode.                                     |
| 400              | INVALID\_REGION\_MISMATCH                                       | Region mismatch.                                                                 |
| 400              | OPERATION\_DENIED\_EIP\_INSTANCE\_NOT\_ADAPTER                  | Specified instance count does not match the number of elastic IPs to be created. |
| 404              | INVALID\_INSTANCE\_NOT\_FOUND                                   | Instance not found.                                                              |
| 400              | INVALID\_NIC\_STATUS                                            | Current vNIC state does not allow this operation.                                |
| 400              | OPERATION\_DENIED\_LAN\_EIP\_TYPE\_CONFLICTS                    | Public IPv4 type conflict on the private IP.                                     |
| 400              | OPERATION\_DENIED\_EIP\_ASSIGNED\_LIMIT\_EXCEEDED               | Elastic IP binding exceeds the allowed limit.                                    |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.console.zenlayer.com/api-reference/compute/zec/elastic-ip/createeips.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
