> 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/zlb/load-balancer-instance/addloadbalancersprivateips.md).

# AddLoadBalancersPrivateIps

## 1. API Description

This API (AddLoadBalancersPrivateIps) is used to add private IPs to a load balancer.

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

* This operation adds private IPv4 addresses and **applies only to the load balancer instances whose `ipStackType` is `IPv4`**. An IPv6 load balancer does not support binding private IPv4 addresses.
  {% endhint %}

## 2. Input Parameters

The following request parameter list only provides API request parameters.

| Parameter Name | Required | Type            | Description                                                                                                                                                                                                                                                                     |
| -------------- | -------- | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| privateIps     | Yes      | Array of String | <p>Private IPs to be added.</p><p>Up to 20 private IPs can be added at a time.</p><p>They must be within the CIDR range of the subnet specified by <code>subnetId</code> and must not be occupied by other resources.</p>                                                       |
| loadBalancerId | Yes      | String          | <p>Load balancer ID.</p><p>It can be obtained by calling <a href="/api-reference/zlb/load-balancer-instance/describeloadbalancers.md">DescribeLoadBalancers</a>.</p>                                                                                                            |
| subnetId       | Yes      | String          | <p>ID of the subnet where the private IPs are located.</p><p>It can be obtained by calling <a href="/api-reference/zec/vpc-network/describesubnets.md">DescribeSubnets</a>.</p><p>The region and VPC of the subnet must be the same as those of the load balancer instance.</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> |

## 4. Code Example

{% tabs %}
{% tab title="Example" %}
**1. Add private IPs to a load balancer instance.**

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

Request:
{
  "privateIps": [
    "10.0.0.0"
  ],
  "loadBalancerId": "<your lb id>",
  "subnetId": "<your subnet id>"
}

Response:
{
  "requestId": "T05992D0C-7E8B-4047-B0C0-780F2CD549D3",
  "response": {
    "requestId": "T05992D0C-7E8B-4047-B0C0-780F2CD549D3"
  }
}
```

{% 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\_IP\_BROADCAST\_ADDRESS                        | Invalid IP address: broadcast addresses are not allowed.      |
| 400              | INVALID\_IP\_FIRST\_ADDRESS                            | Invalid IP address: gateway addresses are not allowed.        |
| 400              | INVALID\_IP\_NETWORK\_ADDRESS                          | Invalid IP address: network addresses are not allowed.        |
| 400              | INVALID\_IP\_OUT\_OF\_RANGE                            | Invalid IP address: not within the CIDR range.                |
| 404              | INVALID\_LB\_NOT\_FOUND                                | Load balancer does not exist.                                 |
| 400              | INVALID\_SUBNET\_NOT\_BELONG\_TO\_VPC                  | Specified subnet is not within the global VPC.                |
| 404              | INVALID\_SUBNET\_NOT\_FOUND                            | Subnet does not exist.                                        |
| 409              | INVALID\_SUBNET\_PRIVATE\_IPV4\_IN\_USED               | Preset private IP is already be used.                         |
| 400              | OPERATION\_DENIED\_INSTANCE\_STATUS\_NOT\_SUPPORT      | Operation is not supported for current instance state.        |
| 400              | OPERATION\_DENIED\_INSTANCE\_SUBNET\_REGION\_NOT\_SAME | Regions of the subnet and the load balancer are not the same. |
| 400              | OPERATION\_DENIED\_SUBNET\_TYPE\_NOT\_SUPPORT          | Subnet stack type is not supported.                           |
| 400              | OPERATION\_DENIED\_SUBNET\_TYPE\_NOT\_SUPPORT\_IPV4    | IPv4 subnet stack type is not supported.                      |
