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

# Creating a VXC Between Two Ports with the API

> This help topic describes how to use the Megaport API to create a VXC Between two configured Megaports.

export const Image = ({src, alt = '', caption, width, height, shadow}) => {
  const errorPrefix = '\x1b[31;1;4mERROR\x1b[0m: Image -';
  if (typeof src !== 'string') {
    src = String(src);
  }
  if (!src || src === 'undefined') {
    console.error(`${errorPrefix} \`src\` is required — rendering an empty string instead`);
    return <></>;
  }
  const img = <img className={['mega-image-style', shadow ? 'shadow' : ''].join(' ')} src={src} alt={alt} width={width} height={height} style={{
    display: 'block'
  }} />;
  return caption ? <figure>
      {img}
      <figcaption style={{
    textAlign: 'center',
    width
  }}>{caption}</figcaption>
    </figure> : img;
};

This topic describes the API procedure to create a VXC between two Ports that you own, including how to get the Port IDs, validate the VXC, and order the VXC.

The example in this topic creates a VXC between a Port in Digital Realty, London, UK and another Port in Iron Mountain, Ashburn, US.

To create the VXC, we need the `productUid` for each Port.

Before you begin, obtain a valid access token. For more information, see [Creating an API Key](/api/api-key).

**To get the productUid for the Ports to connect**

1. In Postman, click **Product Details** in the left navigation and click **GET Product List**.

2. Click **Send**.

3. From the returned product details, locate the `productUid` values for the two Ports you want to connect.\
   This example uses these Ports:

   ```text theme={"theme":{"light":"github-light-high-contrast","dark":"github-dark-high-contrast"}}
   "productName": "API Port London" with "productUid": "7f5f9574-315e-4527-af44-122605a411de"
   "productName": "API Port2 Ashburn" with "productUid": "1f751b96-87c5-4bbf-8a7a-a93a04f71a70",
   ```

**To review pricing details and validate the configuration for the point-to-point VXC**

1. In Postman, expand **Connections > Virtual Cross Connects** in the left navigation and click **POST Validate VXC Order (v3)**.

2. Update the Body with the `productUids` for each end of the connection.\
   You can also change additional values, such as name, rate limit, contract term, whether the connection is enabled or shut down, and VLAN ID.

3. Click **Send** to make a POST request.

   ```http theme={"theme":{"light":"github-light-high-contrast","dark":"github-dark-high-contrast"}}
   POST {baseUrl}/v3/networkdesign/validate
   ```

```json theme={"theme":{"light":"github-light-high-contrast","dark":"github-dark-high-contrast"}}
[
  {
    "productUid": "7f5f9574-315e-4527-af44-122605a411de",
    "associatedVxcs": [
      {
        "productName": "My API created VXC",
        "rateLimit": 500,
        "term":12,
        "shutdown": false,
        "promoCode": "promox3mnthfree2",
        "aEnd": {
          "vlan": 102
        },
        "bEnd": {
          "productUid": "1f751b96-87c5-4bbf-8a7a-a93a04f71a70",
          "vlan": 101
        }
      }
    ]
  }
]
```

After you validate the request and review the pricing details in the response, create the VXC.

**To create the VXC between the Ports**

1. Copy the validated Body from **POST Validate VXC Order (v3)** and paste it into the Body of **POST Buy VXC (v3)**.

2. Click **Send** to post the request.

   ```http theme={"theme":{"light":"github-light-high-contrast","dark":"github-dark-high-contrast"}}
   POST {baseUrl}/v3/networkdesign/buy
   ```

   The resulting point-to point VXC appears in the Megaport Portal.

<Image src="/images/api/api-vxc-port-2-port.png" alt="Portal view of API Port and VXC" shadow={true} width={800} />
