---
title: Modify stored information about a CNI object
---

[Skip to content](#_top)

[API Reference](https://developers.cloudflare.com/api/python)

[Network Interconnects](https://developers.cloudflare.com/api/python/resources/network_interconnects)

[CNIs](https://developers.cloudflare.com/api/python/resources/network_interconnects/subresources/cnis)

Copy Markdown

Open in **Claude**Open in **ChatGPT**Open in **Cursor**

---

**Copy Markdown****View as Markdown**

# Modify stored information about a CNI object

network\_interconnects.cnis.update(strcni, CNIUpdateParams\*\*kwargs) -> [CNIUpdateResponse](<https://developers.cloudflare.com/api/python/resources/network_interconnects#(resource)%20network_interconnects.cnis%20%3E%20(model)%20cni_update_response%20%3E%20(schema)>)

PUT/accounts/{account\_id}/cni/cnis/{cni}

Updates the configuration of an existing Cloud Network Interconnect (CNI), including connection parameters and routing settings.

##### Security

<details>

<summary>API Token</summary>



The preferred authorization scheme for interacting with the Cloudflare API. <a href="https://developers.cloudflare.com/fundamentals/api/get-started/create-token/">Create a token</a>.

**Example:**<code>Authorization: Bearer Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY</code>

</details>

<details>

<summary>API Email + API Key</summary>



The previous authorization scheme for interacting with the Cloudflare API, used in conjunction with a Global API key.

**Example:**<code>X-Auth-Email: user@example.com</code>

The previous authorization scheme for interacting with the Cloudflare API. When possible, use API tokens instead of Global API keys.

**Example:**<code>X-Auth-Key: 144c9defac04969c7bfad8efaa8ea194</code>

</details>

##### Accepted Permissions (at least one required)

`Magic WAN Write``Magic Transit Write`

##### ParametersExpand Collapse

account\_id: str

Customer account tag

[Link to this property](<#(resource)%20network_interconnects.cnis%20%3E%20(method)%20update%20%3E%20(params)%20default%20%3E%20(param)%20account_id%20%3E%20(schema)>)

cni: str

formatuuid

[Link to this property](<#(resource)%20network_interconnects.cnis%20%3E%20(method)%20update%20%3E%20(params)%20default%20%3E%20(param)%20cni%20%3E%20(schema)>)

id: str

formatuuid

[Link to this property](<#(resource)%20network_interconnects.cnis%20%3E%20(method)%20update%20%3E%20(params)%20default%20%3E%20(param)%20id%20%3E%20(schema)>)

account: str

Customer account tag

[Link to this property](<#(resource)%20network_interconnects.cnis%20%3E%20(method)%20update%20%3E%20(params)%20default%20%3E%20(param)%20account%20%3E%20(schema)>)

cust\_ip: str

Customer end of the point-to-point link

This should always be inside the same prefix as `p2p_ip`.

formatA.B.C.D/N

[Link to this property](<#(resource)%20network_interconnects.cnis%20%3E%20(method)%20update%20%3E%20(params)%20default%20%3E%20(param)%20cust_ip%20%3E%20(schema)>)

interconnect: str

Interconnect identifier hosting this CNI

[Link to this property](<#(resource)%20network_interconnects.cnis%20%3E%20(method)%20update%20%3E%20(params)%20default%20%3E%20(param)%20interconnect%20%3E%20(schema)>)

<details>

<summary>

magic: <a href="https://developers.cloudflare.com/api/python/resources/network_interconnects/subresources/cnis/methods/update#(resource)%20network_interconnects.cnis%20%3E%20(method)%20update%20%3E%20(params)%20default%20%3E%20(param)%20magic%20%3E%20(schema)">Magic</a>

</summary>

conduit\_name: str

<a href="#(resource)%20network_interconnects.cnis%20%3E%20(method)%20update%20%3E%20(params)%20default%20%3E%20(param)%20magic%20%3E%20(schema)%20%3E%20(property)%20conduit_name">Link to this property</a>

description: str

<a href="#(resource)%20network_interconnects.cnis%20%3E%20(method)%20update%20%3E%20(params)%20default%20%3E%20(param)%20magic%20%3E%20(schema)%20%3E%20(property)%20description">Link to this property</a>

mtu: int

formatint32

minimum0

<a href="#(resource)%20network_interconnects.cnis%20%3E%20(method)%20update%20%3E%20(params)%20default%20%3E%20(param)%20magic%20%3E%20(schema)%20%3E%20(property)%20mtu">Link to this property</a>

</details>

[Link to this property](<#(resource)%20network_interconnects.cnis%20%3E%20(method)%20update%20%3E%20(params)%20default%20%3E%20(param)%20magic%20%3E%20(schema)>)

p2p\_ip: str

Cloudflare end of the point-to-point link

formatA.B.C.D/N

[Link to this property](<#(resource)%20network_interconnects.cnis%20%3E%20(method)%20update%20%3E%20(params)%20default%20%3E%20(param)%20p2p_ip%20%3E%20(schema)>)

<details>

<summary>

bgp: Optional\[<a href="https://developers.cloudflare.com/api/python/resources/network_interconnects/subresources/cnis/methods/update#(resource)%20network_interconnects.cnis%20%3E%20(method)%20update%20%3E%20(params)%20default%20%3E%20(param)%20bgp%20%3E%20(schema)">BGP</a>]

</summary>

customer\_asn: int

ASN used on the customer end of the BGP session

formatint32

minimum0

<a href="#(resource)%20network_interconnects.cnis%20%3E%20(method)%20update%20%3E%20(params)%20default%20%3E%20(param)%20bgp%20%3E%20(schema)%20%3E%20(property)%20customer_asn">Link to this property</a>

extra\_prefixes: Sequence\[str]

Extra set of static prefixes to advertise to the customer’s end of the session

<a href="#(resource)%20network_interconnects.cnis%20%3E%20(method)%20update%20%3E%20(params)%20default%20%3E%20(param)%20bgp%20%3E%20(schema)%20%3E%20(property)%20extra_prefixes">Link to this property</a>

md5\_key: Optional\[str]

MD5 key to use for session authentication.

Note that *this is not a security measure*. MD5 is not a valid security mechanism, and the key is not treated as a secret value. This is *only* supported for preventing misconfiguration, not for defending against malicious attacks.

The MD5 key, if set, must be of non-zero length and consist only of the following types of character:

- ASCII alphanumerics: <code>[a-zA-Z0-9]</code>
- Special characters in the set <code>'!@#$%^&amp;*()+[]{}&lt;&gt;/.,;:_-~</code>= |\`

In other words, MD5 keys may contain any printable ASCII character aside from newline (0x0A), quotation mark (<code>"</code>), vertical tab (0x0B), carriage return (0x0D), tab (0x09), form feed (0x0C), and the question mark (<code>?</code>). Requests specifying an MD5 key with one or more of these disallowed characters will be rejected.

<a href="#(resource)%20network_interconnects.cnis%20%3E%20(method)%20update%20%3E%20(params)%20default%20%3E%20(param)%20bgp%20%3E%20(schema)%20%3E%20(property)%20md5_key">Link to this property</a>

</details>

[Link to this property](<#(resource)%20network_interconnects.cnis%20%3E%20(method)%20update%20%3E%20(params)%20default%20%3E%20(param)%20bgp%20%3E%20(schema)>)

<details>

<summary>

bgp\_mode: Optional\[Literal\["dynamic\_route\_exchange", "advertise\_only"]]

The BGP mode for a CNI. One of the following:

- <code>dynamic_route_exchange</code>
- <code>advertise_only</code>

</summary>

One of the following:

"dynamic\_route\_exchange"

<a href="#(resource)%20network_interconnects.cnis%20%3E%20(method)%20update%20%3E%20(params)%20default%20%3E%20(param)%20bgp_mode%20%3E%20(schema)%20%3E%20(member)%200">Link to this property</a>

"advertise\_only"

<a href="#(resource)%20network_interconnects.cnis%20%3E%20(method)%20update%20%3E%20(params)%20default%20%3E%20(param)%20bgp_mode%20%3E%20(schema)%20%3E%20(member)%201">Link to this property</a>

</details>

[Link to this property](<#(resource)%20network_interconnects.cnis%20%3E%20(method)%20update%20%3E%20(params)%20default%20%3E%20(param)%20bgp_mode%20%3E%20(schema)>)

##### ReturnsExpand Collapse

<details>

<summary>

class CNIUpdateResponse: …

</summary>

id: str

formatuuid

<a href="#(resource)%20network_interconnects.cnis%20%3E%20(model)%20cni_update_response%20%3E%20(schema)%20%3E%20(property)%20id">Link to this property</a>

account: str

Customer account tag

<a href="#(resource)%20network_interconnects.cnis%20%3E%20(model)%20cni_update_response%20%3E%20(schema)%20%3E%20(property)%20account">Link to this property</a>

cust\_ip: str

Customer end of the point-to-point link

This should always be inside the same prefix as <code>p2p_ip</code>.

formatA.B.C.D/N

<a href="#(resource)%20network_interconnects.cnis%20%3E%20(model)%20cni_update_response%20%3E%20(schema)%20%3E%20(property)%20cust_ip">Link to this property</a>

interconnect: str

Interconnect identifier hosting this CNI

<a href="#(resource)%20network_interconnects.cnis%20%3E%20(model)%20cni_update_response%20%3E%20(schema)%20%3E%20(property)%20interconnect">Link to this property</a>

<details>

<summary>

magic: Magic

</summary>

conduit\_name: str

<a href="#(resource)%20network_interconnects.cnis%20%3E%20(model)%20cni_update_response%20%3E%20(schema)%20%3E%20(property)%20magic%20%3E%20(property)%20conduit_name">Link to this property</a>

description: str

<a href="#(resource)%20network_interconnects.cnis%20%3E%20(model)%20cni_update_response%20%3E%20(schema)%20%3E%20(property)%20magic%20%3E%20(property)%20description">Link to this property</a>

mtu: int

formatint32

minimum0

<a href="#(resource)%20network_interconnects.cnis%20%3E%20(model)%20cni_update_response%20%3E%20(schema)%20%3E%20(property)%20magic%20%3E%20(property)%20mtu">Link to this property</a>

</details>

<a href="#(resource)%20network_interconnects.cnis%20%3E%20(model)%20cni_update_response%20%3E%20(schema)%20%3E%20(property)%20magic">Link to this property</a>

p2p\_ip: str

Cloudflare end of the point-to-point link

formatA.B.C.D/N

<a href="#(resource)%20network_interconnects.cnis%20%3E%20(model)%20cni_update_response%20%3E%20(schema)%20%3E%20(property)%20p2p_ip">Link to this property</a>

<details>

<summary>

bgp: Optional\[BGP]

</summary>

customer\_asn: int

ASN used on the customer end of the BGP session

formatint32

minimum0

<a href="#(resource)%20network_interconnects.cnis%20%3E%20(model)%20cni_update_response%20%3E%20(schema)%20%3E%20(property)%20bgp%20%3E%20(property)%20customer_asn">Link to this property</a>

extra\_prefixes: List\[str]

Extra set of static prefixes to advertise to the customer’s end of the session

<a href="#(resource)%20network_interconnects.cnis%20%3E%20(model)%20cni_update_response%20%3E%20(schema)%20%3E%20(property)%20bgp%20%3E%20(property)%20extra_prefixes">Link to this property</a>

md5\_key: Optional\[str]

MD5 key to use for session authentication.

Note that *this is not a security measure*. MD5 is not a valid security mechanism, and the key is not treated as a secret value. This is *only* supported for preventing misconfiguration, not for defending against malicious attacks.

The MD5 key, if set, must be of non-zero length and consist only of the following types of character:

- ASCII alphanumerics: <code>[a-zA-Z0-9]</code>
- Special characters in the set <code>'!@#$%^&amp;*()+[]{}&lt;&gt;/.,;:_-~</code>= |\`

In other words, MD5 keys may contain any printable ASCII character aside from newline (0x0A), quotation mark (<code>"</code>), vertical tab (0x0B), carriage return (0x0D), tab (0x09), form feed (0x0C), and the question mark (<code>?</code>). Requests specifying an MD5 key with one or more of these disallowed characters will be rejected.

<a href="#(resource)%20network_interconnects.cnis%20%3E%20(model)%20cni_update_response%20%3E%20(schema)%20%3E%20(property)%20bgp%20%3E%20(property)%20md5_key">Link to this property</a>

</details>

<a href="#(resource)%20network_interconnects.cnis%20%3E%20(model)%20cni_update_response%20%3E%20(schema)%20%3E%20(property)%20bgp">Link to this property</a>

<details>

<summary>

bgp\_mode: Optional\[Literal\["dynamic\_route\_exchange", "advertise\_only"]]

The BGP mode for a CNI. One of the following:

- <code>dynamic_route_exchange</code>
- <code>advertise_only</code>

</summary>

One of the following:

"dynamic\_route\_exchange"

<a href="#(resource)%20network_interconnects.cnis%20%3E%20(model)%20cni_update_response%20%3E%20(schema)%20%3E%20(property)%20bgp_mode%20%3E%20(member)%200">Link to this property</a>

"advertise\_only"

<a href="#(resource)%20network_interconnects.cnis%20%3E%20(model)%20cni_update_response%20%3E%20(schema)%20%3E%20(property)%20bgp_mode%20%3E%20(member)%201">Link to this property</a>

</details>

<a href="#(resource)%20network_interconnects.cnis%20%3E%20(model)%20cni_update_response%20%3E%20(schema)%20%3E%20(property)%20bgp_mode">Link to this property</a>

</details>

[Link to this property](<#(resource)%20network_interconnects.cnis%20%3E%20(model)%20cni_update_response%20%3E%20(schema)>)

### Modify stored information about a CNI object

Python

HTTPTypeScriptPythonGoTerraform

```
import os
from cloudflare import Cloudflare

client = Cloudflare(
    api_token=os.environ.get("CLOUDFLARE_API_TOKEN"),  # This is the default and can be omitted
)
cni = client.network_interconnects.cnis.update(
    cni="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
    account_id="account_id",
    id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
    account="account",
    cust_ip="192.168.3.4/31",
    interconnect="interconnect",
    magic={
        "conduit_name": "conduit_name",
        "description": "description",
        "mtu": 0,
    },
    p2p_ip="192.168.3.4/31",
)
print(cni.id)
```

200 example

```
{
  "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
  "account": "account",
  "cust_ip": "192.168.3.4/31",
  "interconnect": "interconnect",
  "magic": {
    "conduit_name": "conduit_name",
    "description": "description",
    "mtu": 0
  },
  "p2p_ip": "192.168.3.4/31",
  "bgp": {
    "customer_asn": 0,
    "extra_prefixes": [
      "192.168.3.4/31"
    ],
    "md5_key": "md5_key"
  },
  "bgp_mode": "dynamic_route_exchange"
}
```

##### Returns Examples

200 example

```
{
  "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
  "account": "account",
  "cust_ip": "192.168.3.4/31",
  "interconnect": "interconnect",
  "magic": {
    "conduit_name": "conduit_name",
    "description": "description",
    "mtu": 0
  },
  "p2p_ip": "192.168.3.4/31",
  "bgp": {
    "customer_asn": 0,
    "extra_prefixes": [
      "192.168.3.4/31"
    ],
    "md5_key": "md5_key"
  },
  "bgp_mode": "dynamic_route_exchange"
}
```