> 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/instance/changenicnetworktype.md).

# ChangeNicNetworkType

## 1. API Description

This API (ChangeNicNetworkType) is used to modify the network interface mode of the instance.

#### Preparations

* Query the network interface mode: you can call [DescribeNetworkInterfaces](/api-reference/zec/vnic/describenetworkinterfaces.md) to query the network interface mode.

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

* This interface can be called only when the instance is in the `STOPPED` status.
* Modification is allowed only when the instance has only one primary network interface.
  {% endhint %}

## 2. Input Parameters

The following request parameter list only provides API request parameters.

| Parameter Name | Required | Type                                                                 | Description                                                                                                                                                        |
| -------------- | -------- | -------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| instanceId     | Yes      | String                                                               | <p>ID of the instance to be operated on.</p><p>It can be obtained by calling <a href="/api-reference/zec/instance/describeinstances.md">DescribeInstances</a>.</p> |
| nicNetworkType | Yes      | [NicNetworkType](/api-reference/zec/datastructure.md#nicnetworktype) | Network interface mode.                                                                                                                                            |

## 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" %}
**Modify the network interface mode of the instance.**

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

Request:
{
  "instanceId": "instanceId1",
  "nicNetworkType": "FailOver"
}

Response:
{
  "requestId": "TEEFDCA5B-76FB-4E91-A18E-DF7F5D2CE41F"
}
```

{% 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              | OPERATION\_DENIED\_INSTANCE\_EXIST\_EXTRA\_NIC                | The instance has multiple vNICs, operation not allowed. |
| 400              | OPERATION\_DENIED\_INSTANCE\_NIC\_NETWORK\_TYPE\_NOT\_SUPPORT | Unsupported vNIC mode.                                  |
| 400              | OPERATION\_DENIED\_INSTANCE\_STATUS\_NOT\_SUPPORT             | Current instance state does not allow this operation.   |
