> 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/compute/bmc/elastic-ip/describeinstanceavailableeipresources.md).

# DescribeInstanceAvailableEipResources

## 1. API Description

This API (DescribeInstanceAvailableEipResources) is used to query list of elastic IPs that can be bound to an instance.

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

* <mark style="color:blue;">Only elastic IPs that can actually be assigned to the instance under the business rules are returned. The following are filtered out: elastic IPs of the same type already bound to the instance have reached the quota limit; the instance is in gateway mode and the elastic IP is an IPv4 address with netmask greater than 29; when querying the IPv6 type, the instance has no primary IPv6 address.</mark>
* <mark style="color:blue;">If</mark> <mark style="color:blue;">`ipType`</mark> <mark style="color:blue;">is not specified, available IPv4 elastic IPs are queried by default.</mark>
  {% endhint %}

## 2. Input Parameters

The following request parameter list only provides API request parameters.

| Parameter Name | Required | Type                                                               | Description                                                                                                                   |
| -------------- | -------- | ------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------- |
| instanceId     | Yes      | String                                                             | <p>Instance ID.</p><p>To obtain the instance ID, you can call DescribeInstances and look for instanceId in the response.</p>  |
| ipType         | No       | [EipIpType](/api-reference/compute/bmc/datastructure.md#eipiptype) | <p>Type of the elastic IP. Valid values: IPv4, IPv6. If not specified, IPv4 is used by default.</p><p>Default value: IPv4</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> |
| instanceEipResources | Array of [InstanceAvailableEip](/api-reference/compute/bmc/datastructure.md#instanceavailableeip) | List of available elastic IPs that can be bound to an instance.                                                       |

## 4. Code Example

{% tabs %}
{% tab title="Example" %}
**Query list of elastic IPs that can be bound to an instance**

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

Request：
{
    "instanceId": "instanceId1",
    "ipType": "IPv4"
}

Response：
{
  "requestId": "T05992D0C-7E8B-4047-B0C0-780F2CD549D3",
  "response": {
    "requestId": "T05992D0C-7E8B-4047-B0C0-780F2CD549D3",
    "instanceEipResources": [
        {
             "eipId": "eipId1",
             "ipAddress": "xx.x.x.x",
             "netmask": 32
        }
    ]
  }
}
```

{% 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\_INSTANCE\_NOT\_FOUND | Instance does not exist. |
