Skip to content
Start here

Update interconnect

client.MagicTransit.CfInterconnects.Update(ctx, cfInterconnectID, params) (*CfInterconnectUpdateResponse, error)
PUT/accounts/{account_id}/magic/cf_interconnects/{cf_interconnect_id}

Updates a specific interconnect associated with an account. Use ?validate_only=true as an optional query parameter to only run validation without persisting changes.

Security
API Token

The preferred authorization scheme for interacting with the Cloudflare API. Create a token.

Example:Authorization: Bearer Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY
API Email + API Key

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

Example:X-Auth-Email: user@example.com

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

Example:X-Auth-Key: 144c9defac04969c7bfad8efaa8ea194
Accepted Permissions (at least one required)
Magic WAN WriteMagic Transit Write
ParametersExpand Collapse
cfInterconnectID string

Identifier

maxLength32
params CfInterconnectUpdateParams
AccountID param.Field[string]

Path param: Identifier

maxLength32
AutomaticReturnRouting param.Field[bool]Optional

Body param: True if automatic stateful return routing should be enabled for a tunnel, false otherwise. Requires the coupler_integration account flag to be enabled; requests setting this to true without that flag will be rejected.

BGP param.Field[CfInterconnectUpdateParamsBGP]Optional

Body param

DeprecatedAsNo int64Optional

Deprecated. Use customer_asn.

formatint32
DeprecatedCloudflareEndpoint stringOptional

Read-only for v1.5; derived from interface_address.

formatipv4
CustomerASN int64Optional

ASN used on the customer end of the BGP session.

formatint32
DeprecatedCustomerEndpoint stringOptional

Read-only for v1.5; derived from interface_address.

formatipv4
ExportFilterID stringOptional

ID of the BGP filter profile applied to routes advertised to the customer.

ExtraPrefixes []stringOptional

Prefixes in this list will be advertised to the customer device, in addition to the routes in the Magic routing table.

ImportFilterID stringOptional

ID of the BGP filter profile applied to routes received from the customer.

Md5Key stringOptional

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: [a-zA-Z0-9]
  • Special characters in the set '!@#$%^&*()+[]{}<>/.,;:_-~= |`

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

Description param.Field[string]Optional

Body param: An optional description of the interconnect.

GRE param.Field[CfInterconnectUpdateParamsGRE]Optional

Body param: The configuration specific to GRE interconnects.

CloudflareEndpoint stringOptional

The IP address assigned to the Cloudflare side of the GRE tunnel created as part of the Interconnect.

HealthCheck param.Field[HealthCheck]Optional

Body param

InterfaceAddress param.Field[string]Optional

Body param: The IPv4 interface address for the interconnect. For MPLS Interconnects, use a /30 or /31 prefix. For GRE Interconnects, a /29, /30, or /31 prefix may be used. A /29 prefix is only allowed for v1.5 interconnects, and the address must be the .3 host of the subnet (the fourth address overall; the network address is not usable). Select the subnet from RFC 1918 or the approved link-local ranges.

InterfaceAddress6 param.Field[string]Optional

Body param: A 127 bit IPV6 prefix from within the virtual_subnet6 prefix space with the address being the first IP of the subnet and not same as the address of virtual_subnet6. Eg if virtual_subnet6 is 2606:54c1:7:0:a9fe:12d2::/127 , interface_address6 could be 2606:54c1:7:0:a9fe:12d2:1:200/127

Mtu param.Field[int64]Optional

Body param: The Maximum Transmission Unit (MTU) in bytes for the interconnect. The minimum value is 576.

Name param.Field[string]Optional

Body param: The name of the interconnect. The name cannot share a name with other tunnels.

XMagicNewHcTarget param.Field[bool]Optional

Header param: If true, the health check target in the request and response bodies will be presented using the new object format. Defaults to false.

ReturnsExpand Collapse
type CfInterconnectUpdateResponse struct{…}
Modified boolOptional
ModifiedInterconnect CfInterconnectUpdateResponseModifiedInterconnectOptional
ID stringOptional

Identifier

maxLength32
AutomaticReturnRouting boolOptional

True if automatic stateful return routing should be enabled for a tunnel, false otherwise. Requires the coupler_integration account flag to be enabled; requests setting this to true without that flag will be rejected.

BGP CfInterconnectUpdateResponseModifiedInterconnectBGPOptional
DeprecatedAsNo int64Optional

Deprecated. Use customer_asn.

formatint32
DeprecatedCloudflareEndpoint stringOptional

Read-only for v1.5; derived from interface_address.

formatipv4
CustomerASN int64Optional

ASN used on the customer end of the BGP session.

formatint32
DeprecatedCustomerEndpoint stringOptional

Read-only for v1.5; derived from interface_address.

formatipv4
ExportFilterID stringOptional

ID of the BGP filter profile applied to routes advertised to the customer.

ExtraPrefixes []stringOptional

Prefixes in this list will be advertised to the customer device, in addition to the routes in the Magic routing table.

ImportFilterID stringOptional

ID of the BGP filter profile applied to routes received from the customer.

Md5Key stringOptional

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: [a-zA-Z0-9]
  • Special characters in the set '!@#$%^&*()+[]{}<>/.,;:_-~= |`

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

ColoName stringOptional

The name of the interconnect. The name cannot share a name with other tunnels.

CreatedOn TimeOptional

The date and time the tunnel was created.

formatdate-time
Description stringOptional

An optional description of the interconnect.

GRE CfInterconnectUpdateResponseModifiedInterconnectGREOptional

The configuration specific to GRE interconnects.

CloudflareEndpoint stringOptional

The IP address assigned to the Cloudflare side of the GRE tunnel created as part of the Interconnect.

HealthCheck HealthCheckOptional
Enabled boolOptional

Determines whether to run healthchecks for a tunnel.

Rate HealthCheckRateOptional

How frequent the health check is run. The default value is mid.

One of the following:
const HealthCheckRateLow HealthCheckRate = "low"
const HealthCheckRateMid HealthCheckRate = "mid"
const HealthCheckRateHigh HealthCheckRate = "high"
Target HealthCheckTargetUnionOptional

The destination address in a request type health check. After the healthcheck is decapsulated at the customer end of the tunnel, the ICMP echo will be forwarded to this address. This field defaults to customer_gre_endpoint address. This field is ignored for bidirectional healthchecks as the interface_address (not assigned to the Cloudflare side of the tunnel) is used as the target. Must be in object form if the x-magic-new-hc-target header is set to true and string form if x-magic-new-hc-target is absent or set to false.

One of the following:
type HealthCheckTargetMagicHealthCheckTarget struct{…}

The destination address in a request type health check. After the healthcheck is decapsulated at the customer end of the tunnel, the ICMP echo will be forwarded to this address. This field defaults to customer_gre_endpoint address. This field is ignored for bidirectional healthchecks as the interface_address (not assigned to the Cloudflare side of the tunnel) is used as the target.

Effective stringOptional

The effective health check target. If ‘saved’ is empty, then this field will be populated with the calculated default value on GET requests. Ignored in POST, PUT, and PATCH requests.

Saved stringOptional

The saved health check target. Setting the value to the empty string indicates that the calculated default value will be used.

UnionString
Type HealthCheckTypeOptional

The type of healthcheck to run, reply or request. The default value is reply.

One of the following:
const HealthCheckTypeReply HealthCheckType = "reply"
const HealthCheckTypeRequest HealthCheckType = "request"
InterfaceAddress stringOptional

The IPv4 interface address for the interconnect. For MPLS Interconnects, use a /30 or /31 prefix. For GRE Interconnects, a /29, /30, or /31 prefix may be used. A /29 prefix is only allowed for v1.5 interconnects, and the address must be the .3 host of the subnet (the fourth address overall; the network address is not usable). Select the subnet from RFC 1918 or the approved link-local ranges.

InterfaceAddress6 stringOptional

A 127 bit IPV6 prefix from within the virtual_subnet6 prefix space with the address being the first IP of the subnet and not same as the address of virtual_subnet6. Eg if virtual_subnet6 is 2606:54c1:7:0:a9fe:12d2::/127 , interface_address6 could be 2606:54c1:7:0:a9fe:12d2:1:200/127

ModifiedOn TimeOptional

The date and time the tunnel was last modified.

formatdate-time
Mtu int64Optional

The Maximum Transmission Unit (MTU) in bytes for the interconnect. The minimum value is 576.

Name stringOptional

The name of the interconnect. The name cannot share a name with other tunnels.

Version stringOptional

Immutable interconnect version configured at creation time. One of:

  • “1”
  • “1.5”
  • “2”
VirtualPortReservationID stringOptional

An identifier that correlates this interconnect with the corresponding V2 CNI interconnect resource.

maxLength32

Update interconnect

package main

import (
  "context"
  "fmt"

  "github.com/cloudflare/cloudflare-go"
  "github.com/cloudflare/cloudflare-go/magic_transit"
  "github.com/cloudflare/cloudflare-go/option"
)

func main() {
  client := cloudflare.NewClient(
    option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
  )
  cfInterconnect, err := client.MagicTransit.CfInterconnects.Update(
    context.TODO(),
    "023e105f4ecef8ad9ca31a8372d0c353",
    magic_transit.CfInterconnectUpdateParams{
      AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
    },
  )
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", cfInterconnect.Modified)
}
{
  "errors": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "messages": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "result": {
    "modified": true,
    "modified_interconnect": {
      "id": "c4a7362d577a6c3019a474fd6f485821",
      "automatic_return_routing": true,
      "bgp": {
        "as_no": 0,
        "cloudflare_endpoint": "192.168.1.1",
        "customer_asn": 0,
        "customer_endpoint": "192.168.1.1",
        "export_filter_id": "a1b2c3d4e5f647890a1b2c3d4e5f6789",
        "extra_prefixes": [
          "string"
        ],
        "import_filter_id": "a1b2c3d4e5f647890a1b2c3d4e5f6789",
        "md5_key": "md5_key"
      },
      "colo_name": "pni_ord",
      "created_on": "2017-06-14T00:00:00Z",
      "description": "Tunnel for Interconnect to ORD",
      "gre": {
        "cloudflare_endpoint": "203.0.113.1"
      },
      "health_check": {
        "enabled": true,
        "rate": "low",
        "target": {
          "effective": "203.0.113.1",
          "saved": "203.0.113.1"
        },
        "type": "request"
      },
      "interface_address": "192.0.2.3/29",
      "interface_address6": "2606:54c1:7:0:a9fe:12d2:1:200/127",
      "modified_on": "2017-06-14T05:20:00Z",
      "mtu": 0,
      "name": "pni_ord",
      "version": "1.5",
      "virtual_port_reservation_id": "c4a7362d577a6c3019a474fd6f485821"
    }
  },
  "success": true
}
Returns Examples
{
  "errors": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "messages": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "result": {
    "modified": true,
    "modified_interconnect": {
      "id": "c4a7362d577a6c3019a474fd6f485821",
      "automatic_return_routing": true,
      "bgp": {
        "as_no": 0,
        "cloudflare_endpoint": "192.168.1.1",
        "customer_asn": 0,
        "customer_endpoint": "192.168.1.1",
        "export_filter_id": "a1b2c3d4e5f647890a1b2c3d4e5f6789",
        "extra_prefixes": [
          "string"
        ],
        "import_filter_id": "a1b2c3d4e5f647890a1b2c3d4e5f6789",
        "md5_key": "md5_key"
      },
      "colo_name": "pni_ord",
      "created_on": "2017-06-14T00:00:00Z",
      "description": "Tunnel for Interconnect to ORD",
      "gre": {
        "cloudflare_endpoint": "203.0.113.1"
      },
      "health_check": {
        "enabled": true,
        "rate": "low",
        "target": {
          "effective": "203.0.113.1",
          "saved": "203.0.113.1"
        },
        "type": "request"
      },
      "interface_address": "192.0.2.3/29",
      "interface_address6": "2606:54c1:7:0:a9fe:12d2:1:200/127",
      "modified_on": "2017-06-14T05:20:00Z",
      "mtu": 0,
      "name": "pni_ord",
      "version": "1.5",
      "virtual_port_reservation_id": "c4a7362d577a6c3019a474fd6f485821"
    }
  },
  "success": true
}