> ## Documentation Index
> Fetch the complete documentation index at: https://developers.telnyx.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create a Virtual Cross Connect

> Create a new Virtual Cross Connect.<br /><br />For AWS and GCE, you have the option of creating the primary connection first and the secondary connection later. You also have the option of disabling the primary and/or secondary connections at any time and later re-enabling them. With Azure, you do not have this option. Azure requires both the primary and secondary connections to be created at the same time and they can not be independantly disabled.



## OpenAPI

````yaml https://telnyx-openapi-ng.s3.us-east-1.amazonaws.com/networking/networking.yml post /virtual_cross_connects
openapi: 3.1.0
info:
  title: Telnyx Networking API
  version: 2.0.0
  description: API for Networking.
  contact:
    email: support@telnyx.com
servers:
  - url: https://api.telnyx.com/v2
security:
  - bearerAuth: []
paths:
  /virtual_cross_connects:
    post:
      tags:
        - Virtual Cross Connects
      summary: Create a Virtual Cross Connect
      description: >-
        Create a new Virtual Cross Connect.<br /><br />For AWS and GCE, you have
        the option of creating the primary connection first and the secondary
        connection later. You also have the option of disabling the primary
        and/or secondary connections at any time and later re-enabling them.
        With Azure, you do not have this option. Azure requires both the primary
        and secondary connections to be created at the same time and they can
        not be independantly disabled.
      operationId: CreateVirtualCrossConnect
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/VirtualCrossConnectCreate'
        required: true
      responses:
        '200':
          $ref: '#/components/responses/VirtualCrossConnectResponse'
        '422':
          $ref: '#/components/responses/netapps_UnprocessableEntity'
        default:
          $ref: '#/components/responses/netapps_GenericErrorResponse'
      x-codeSamples:
        - lang: JavaScript
          source: >-
            import Telnyx from 'telnyx';


            const client = new Telnyx({
              apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
            });


            const virtualCrossConnect = await
            client.virtualCrossConnects.create({ region_code: 'ashburn-va' });


            console.log(virtualCrossConnect.data);
        - lang: Python
          source: |-
            import os
            from telnyx import Telnyx

            client = Telnyx(
                api_key=os.environ.get("TELNYX_API_KEY"),  # This is the default and can be omitted
            )
            virtual_cross_connect = client.virtual_cross_connects.create(
                region_code="ashburn-va",
            )
            print(virtual_cross_connect.data)
        - lang: Go
          source: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/team-telnyx/telnyx-go\"\n\t\"github.com/team-telnyx/telnyx-go/option\"\n)\n\nfunc main() {\n\tclient := telnyx.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tvirtualCrossConnect, err := client.VirtualCrossConnects.New(context.TODO(), telnyx.VirtualCrossConnectNewParams{\n\t\tRegionCode: \"ashburn-va\",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", virtualCrossConnect.Data)\n}\n"
        - lang: Java
          source: >-
            package com.telnyx.sdk.example;


            import com.telnyx.sdk.client.TelnyxClient;

            import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;

            import
            com.telnyx.sdk.models.virtualcrossconnects.VirtualCrossConnectCreateParams;

            import
            com.telnyx.sdk.models.virtualcrossconnects.VirtualCrossConnectCreateResponse;


            public final class Main {
                private Main() {}

                public static void main(String[] args) {
                    TelnyxClient client = TelnyxOkHttpClient.fromEnv();

                    VirtualCrossConnectCreateParams params = VirtualCrossConnectCreateParams.builder()
                        .regionCode("ashburn-va")
                        .build();
                    VirtualCrossConnectCreateResponse virtualCrossConnect = client.virtualCrossConnects().create(params);
                }
            }
        - lang: Ruby
          source: >-
            require "telnyx"


            telnyx = Telnyx::Client.new(api_key: "My API Key")


            virtual_cross_connect =
            telnyx.virtual_cross_connects.create(region_code: "ashburn-va")


            puts(virtual_cross_connect)
        - lang: PHP
          source: >-
            <?php


            require_once dirname(__DIR__) . '/vendor/autoload.php';


            use Telnyx\Client;

            use Telnyx\Core\Exceptions\APIException;


            $client = new Client(apiKey: getenv('TELNYX_API_KEY') ?: 'My API
            Key');


            try {
              $virtualCrossConnect = $client->virtualCrossConnects->create(
                regionCode: 'ashburn-va',
                bandwidthMbps: 50,
                bgpAsn: 1234,
                cloudProvider: 'aws',
                cloudProviderRegion: 'us-east-1',
                name: 'test interface',
                networkID: '6a09cdc3-8948-47f0-aa62-74ac943d6c58',
                primaryBgpKey: 'yFV4wEPtPVPfDUGLWiyQzwga',
                primaryCloudAccountID: '123456789012',
                primaryCloudIP: '169.254.0.2',
                primaryTelnyxIP: '169.254.0.1',
                secondaryBgpKey: 'ge1lONeK9RcA83uuWaw9DvZy',
                secondaryCloudAccountID: '',
                secondaryCloudIP: '169.254.0.4',
                secondaryTelnyxIP: '169.254.0.3',
              );

              var_dump($virtualCrossConnect);
            } catch (APIException $e) {
              echo $e->getMessage();
            }
        - lang: CLI
          source: |-
            telnyx virtual-cross-connects create \
              --api-key 'My API Key' \
              --region-code ashburn-va
components:
  schemas:
    VirtualCrossConnectCreate:
      allOf:
        - $ref: '#/components/schemas/VirtualCrossConnect'
        - $ref: '#/components/schemas/RegionIn'
        - type: object
          title: VirtualCrossConnectCreate
          required:
            - network_id
            - region_code
            - cloud_provider
            - cloud_provider_region
            - bgp_asn
            - primary_cloud_account_id
    VirtualCrossConnect:
      allOf:
        - $ref: '#/components/schemas/Record'
        - $ref: '#/components/schemas/Interface'
        - type: object
          title: VirtualCrossConnect
          properties:
            record_type:
              type: string
              description: Identifies the type of the resource.
              readOnly: true
              example: virtual_cross_connect
            cloud_provider:
              type: string
              enum:
                - aws
                - azure
                - gce
              description: >-
                The Virtual Private Cloud with which you would like to establish
                a cross connect.
              example: aws
            cloud_provider_region:
              type: string
              description: >-
                The region where your Virtual Private Cloud hosts are
                located.<br /><br />The available regions can be found using the
                /virtual_cross_connect_regions endpoint.
              example: us-east-1
            bgp_asn:
              type: number
              description: >-
                The Border Gateway Protocol (BGP) Autonomous System Number
                (ASN). If null, value will be assigned by Telnyx.
              example: 1234
            bandwidth_mbps:
              type: number
              description: >-
                The desired throughput in Megabits per Second (Mbps) for your
                Virtual Cross Connect.<br /><br />The available bandwidths can
                be found using the /virtual_cross_connect_regions endpoint.
              example: 50
            primary_enabled:
              type: boolean
              description: >-
                Indicates whether the primary circuit is enabled. Setting this
                to `false` will disable the circuit.
              example: true
              readOnly: true
            primary_cloud_account_id:
              type: string
              description: >-
                The identifier for your Virtual Private Cloud. The number will
                be different based upon your Cloud provider.
              example: '123456789012'
            primary_telnyx_ip:
              type: string
              description: >-
                The IP address assigned to the Telnyx side of the Virtual Cross
                Connect.<br /><br />If none is provided, one will be generated
                for you.<br /><br />This value should be null for GCE as Google
                will only inform you of your assigned IP once the connection has
                been accepted.
              example: 169.254.0.1
            primary_cloud_ip:
              type: string
              description: >-
                The IP address assigned for your side of the Virtual Cross
                Connect.<br /><br />If none is provided, one will be generated
                for you.<br /><br />This value should be null for GCE as Google
                will only inform you of your assigned IP once the connection has
                been accepted.
              example: 169.254.0.2
            primary_bgp_key:
              type: string
              description: The authentication key for BGP peer configuration.
              example: yFV4wEPtPVPfDUGLWiyQzwga
            secondary_enabled:
              type: boolean
              description: >-
                Indicates whether the secondary circuit is enabled. Setting this
                to `false` will disable the circuit.
              example: true
              readOnly: true
            secondary_cloud_account_id:
              type: string
              description: >-
                The identifier for your Virtual Private Cloud. The number will
                be different based upon your Cloud provider.<br /><br />This
                attribute is only necessary for GCE.
              example: ''
            secondary_telnyx_ip:
              type: string
              description: >-
                The IP address assigned to the Telnyx side of the Virtual Cross
                Connect.<br /><br />If none is provided, one will be generated
                for you.<br /><br />This value should be null for GCE as Google
                will only inform you of your assigned IP once the connection has
                been accepted.
              example: 169.254.0.3
            secondary_cloud_ip:
              type: string
              description: >-
                The IP address assigned for your side of the Virtual Cross
                Connect.<br /><br />If none is provided, one will be generated
                for you.<br /><br />This value should be null for GCE as Google
                will only inform you of your assigned IP once the connection has
                been accepted.
              example: 169.254.0.4
            secondary_bgp_key:
              type: string
              description: The authentication key for BGP peer configuration.
              example: ge1lONeK9RcA83uuWaw9DvZy
    RegionIn:
      type: object
      properties:
        region_code:
          description: The region the interface should be deployed to.
          type: string
          example: ashburn-va
    VirtualCrossConnectCombined:
      allOf:
        - $ref: '#/components/schemas/VirtualCrossConnectCreate'
        - $ref: '#/components/schemas/VirtualCrossConnectPatch'
        - $ref: '#/components/schemas/RegionOut'
    netapps_Errors:
      properties:
        errors:
          type: array
          items:
            $ref: '#/components/schemas/netapps_Error'
      type: object
    Record:
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: Identifies the resource.
          readOnly: true
          example: 6a09cdc3-8948-47f0-aa62-74ac943d6c58
        record_type:
          type: string
          description: Identifies the type of the resource.
          readOnly: true
          example: sample_record_type
        created_at:
          type: string
          description: >-
            ISO 8601 formatted date-time indicating when the resource was
            created.
          readOnly: true
          example: '2018-02-02T22:25:27.521Z'
        updated_at:
          type: string
          description: >-
            ISO 8601 formatted date-time indicating when the resource was
            updated.
          readOnly: true
          example: '2018-02-02T22:25:27.521Z'
    Interface:
      type: object
      properties:
        network_id:
          description: The id of the network associated with the interface.
          type: string
          format: uuid
          example: 6a09cdc3-8948-47f0-aa62-74ac943d6c58
        name:
          type: string
          description: A user specified name for the interface.
          example: test interface
        status:
          $ref: '#/components/schemas/InterfaceStatus'
    VirtualCrossConnectPatch:
      allOf:
        - type: object
          title: VirtualCrossConnectPatch
          properties:
            primary_enabled:
              type: boolean
              description: >-
                Indicates whether the primary circuit is enabled. Setting this
                to `false` will disable the circuit.
              example: true
            primary_routing_announcement:
              description: Whether the primary BGP route is being announced.
              type: boolean
              example: false
            primary_cloud_ip:
              type: string
              description: >-
                The IP address assigned for your side of the Virtual Cross
                Connect.<br /><br />If none is provided, one will be generated
                for you.<br /><br />This value can not be patched once the VXC
                has bene provisioned.
              example: 169.254.0.2
            secondary_enabled:
              type: boolean
              description: >-
                Indicates whether the secondary circuit is enabled. Setting this
                to `false` will disable the circuit.
              example: true
            secondary_routing_announcement:
              description: Whether the secondary BGP route is being announced.
              type: boolean
              example: false
            secondary_cloud_ip:
              type: string
              description: >-
                The IP address assigned for your side of the Virtual Cross
                Connect.<br /><br />If none is provided, one will be generated
                for you.<br /><br />This value can not be patched once the VXC
                has bene provisioned.
              example: 169.254.0.4
    RegionOut:
      type: object
      properties:
        region_code:
          description: The region interface is deployed to.
          type: string
          example: ashburn-va
        region:
          type: object
          properties:
            code:
              description: Region code of the interface.
              type: string
              example: ashburn-va
            name:
              description: Region name of the interface.
              type: string
              example: Ashburn
            record_type:
              type: string
              description: Identifies the type of the resource.
              readOnly: true
              example: region
    netapps_Error:
      required:
        - code
        - title
      properties:
        code:
          type: string
        title:
          type: string
        detail:
          type: string
        source:
          type: object
          properties:
            pointer:
              description: JSON pointer (RFC6901) to the offending entity.
              type: string
            parameter:
              description: Indicates which query parameter caused the error.
              type: string
        meta:
          type: object
          additionalProperties: true
      type: object
    InterfaceStatus:
      type: string
      enum:
        - created
        - provisioning
        - provisioned
        - deleting
      description: The current status of the interface deployment.
      readOnly: true
      example: provisioned
  responses:
    VirtualCrossConnectResponse:
      description: Successful response
      content:
        application/json:
          schema:
            type: object
            properties:
              data:
                $ref: '#/components/schemas/VirtualCrossConnectCombined'
    netapps_UnprocessableEntity:
      description: Unprocessable entity. Check the 'detail' field in response for details.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/netapps_Errors'
    netapps_GenericErrorResponse:
      description: Unexpected error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/netapps_Errors'
  securitySchemes:
    bearerAuth:
      scheme: bearer
      type: http

````