> 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/traffic/bandwidth-cluster/migratebandwidthclusterresources.md).

# MigrateBandwidthClusterResources

## 1. API Description

This API (MigrateBandwidthClusterResources) is used to migrate resources between bandwidth clusters.

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

* <mark style="color:blue;">Resources already in the target bandwidth cluster ill be ignored.</mark>
* <mark style="color:blue;">If any resource is not eligible for the target bandwidth cluster, the entire migration will fail. No resources will be migrated.</mark>
* <mark style="color:blue;">Traffic before the change will be counted under the original bandwidth cluster; traffic after the change will be counted under the new cluster.</mark>
  {% endhint %}

## 2. Input Parameters

The following request parameter list only provides API request parameters.

| Parameter Name           | Required | Type            | Description                                                                                                                                                                                              |
| ------------------------ | -------- | --------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| targetBandwidthClusterId | Yes      | String          | Target bandwidth cluster ID.                                                                                                                                                                             |
| resourceIdList           | Yes      | Array of String | <p>IDs of resources to migrate.</p><p>Resources must belong to a different bandwidth cluster, and networkType and areaCode of the original bandwidth cluster must match those of the target cluster.</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" %}
**Migrate resources to a specified target bandwidth cluster.**

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

Request：
{
    "resourceIdList": ["<id1>","<id2>"],
    "targetBandwidthClusterId": "<targetBandwidthClusterId>"
}

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                                                                                        |
| ---------------- | -------------------------------------- | -------------------------------------------------------------------------------------------------- |
| 404              | INVALID\_CLUSTER\_NOT\_FOUND           | Bandwidth cluster does not exist.                                                                  |
| 404              | INVALID\_CLUSTER\_RESOURCE\_NOT\_FOUND | Resources must belong to a bandwidth cluster.                                                      |
| 409              | INVALID\_CLUSTER\_MISMATCH\_RESOURCE   | networkType and areaCode of the original bandwidth cluster must match those of the target cluster. |
