> 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/elastic-ip/modifyeipsblockthreshold.md).

# ModifyEipsBlockThreshold

## 1. API Description

This API (ModifyEipsBlockThreshold) is used to modify the custom blocking thresholds of multiple elastic IPs (EIPs) in batches. All EIPs use the same set of thresholds.

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

* The interface first validates the whole batch of EIPs (EIP existence, threshold range, and quota). If any validation fails, none of the EIPs are modified. After validation passes, the EIPs are modified one by one. EIPs that fail to be modified are returned in `failedEips` with their error codes and error messages, without affecting other EIPs.
* When custom thresholds are enabled, each EIP in the batch that has not yet enabled custom thresholds consumes 1 `ZEC_EIP_Block_threshold_Configuration_changed_per_team` quota, while EIPs that have already enabled them do not consume it again. If the remaining quota is not enough to cover the number of newly enabled EIPs in the batch, the whole batch is rejected. Disabling custom thresholds releases the quota.
* The modified thresholds can be queried through the `blockInfoList` returned by [DescribeEips](https://docs.console.zenlayer.com/api-reference/zec/elastic-ip/describeeips.md). Note that the units in the query result are bps, pps, and count, which are different from the units of the request parameters of this interface.
  {% endhint %}

## 2. Input Parameters

The following request parameter list only provides API request parameters.

| Parameter Name | Required | Type            | Description                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| -------------- | -------- | --------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| eipIds         | Yes      | Array of String | <p>List of IDs of the EIPs whose blocking thresholds are to be modified. All EIPs use the same set of thresholds.</p><p>The EIP status must be bound (<code>BINDED</code>) or unbound (<code>UNBIND</code>).</p><p>For a CIDR block (IP block) EIP, the threshold applies to each IP in the block.</p><p>It can be obtained by calling <a href="https://docs.console.zenlayer.com/api-reference/zec/elastic-ip/describeeips.md">DescribeEips</a>.</p> |
| enable         | Yes      | Boolean         | <p>Whether to enable custom blocking thresholds.</p><p>When <code>false</code> is passed, the existing custom thresholds are removed and the system default thresholds are restored. The four thresholds do not need to be passed in this case.</p>                                                                                                                                                                                                   |
| bps            | No       | Integer         | <p>Bandwidth blocking threshold. Unit: Mbps.</p><p>The upper limit is controlled by the quota <code>ZEC\_EIP\_Block\_threshold\_bps\_cap</code>.</p><p>When custom thresholds are enabled, at least one of the four thresholds must be passed. Thresholds that are not passed keep their current values.</p><p>Value range: \[10, +)</p>                                                                                                              |
| pps            | No       | Integer         | <p>Packet rate blocking threshold. Unit: kpps.</p><p>The upper limit is controlled by the quota <code>ZEC\_EIP\_Block\_threshold\_pps\_cap</code>.</p><p>When custom thresholds are enabled, at least one of the four thresholds must be passed. Thresholds that are not passed keep their current values.</p><p>Value range: \[500, +)</p>                                                                                                           |
| inCps          | No       | Integer         | <p>Inbound connection rate blocking threshold. Unit: kcps.</p><p>The upper limit is controlled by the quota <code>ZEC\_EIP\_Block\_threshold\_cps\_in\_cap</code>.</p><p>When custom thresholds are enabled, at least one of the four thresholds must be passed. Thresholds that are not passed keep their current values.</p><p>Value range: \[1, +)</p>                                                                                             |
| outCps         | No       | Integer         | <p>Outbound connection rate blocking threshold. Unit: kcps.</p><p>The upper limit is controlled by the quota <code>ZEC\_EIP\_Block\_threshold\_cps\_out\_cap</code>.</p><p>When custom thresholds are enabled, at least one of the four thresholds must be passed. Thresholds that are not passed keep their current values.</p><p>Value range: \[1, +)</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> |
| failedEips     | Array of [ModifyEipsBlockThresholdFailedItem](https://docs.console.zenlayer.com/api-reference/zec/datastructure.md#modifyeipsblockthresholdfaileditem) | <p>List of details of the EIPs that failed to be modified.</p><p>Empty if all modifications succeed.</p>              |

## 4. Code Example

{% tabs %}
{% tab title="Example" %}
**1. Enable custom blocking thresholds in batches and set all four thresholds.**

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

Request:
{
    "eipIds": ["eipId1", "eipId2"],
    "enable": true,
    "bps": 20000,
    "pps": 2000,
    "inCps": 100,
    "outCps": 100
}

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

**2. Disable custom blocking thresholds in batches and restore the system defaults.**

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

Request:
{
    "eipIds": ["eipId1", "eipId2"],
    "enable": false
}

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

{% endtab %}
{% endtabs %}

## 5. Developer Resources

Zenlayer Cloud API 2.0 integrates [SDKs](https://docs.console.zenlayer.com/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](https://docs.console.zenlayer.com/api-reference/api-introduction/instruction/commonerrorcode.md).

| HTTP Status Code | Error Code                                   | Description                                                  |
| ---------------- | -------------------------------------------- | ------------------------------------------------------------ |
| 404              | INVALID\_EIP\_NOT\_FOUND                     | Elastic IP does not exist.                                   |
| 500              | OPERATION\_DENIED\_EIP\_STATUS\_NOT\_SUPPORT | Operations on the EIP with current status are not supported. |
