> ## 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 Megaport Internet Connection from a Port with the API

> This help topic describes how to use the Megaport API to create a Megaport Internet connection from a Port.

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 Megaport Internet connection from a Port.

This process includes these steps:

* Look up the A-End `productUid` using GET Product List to identify the Port in your Megaport location.
* Look up the B-End `productUid` using GET Partner Megaports to identify the internet router (Port). Use vxcPermitted *True* and connectType *TRANSIT*.
* Validate the configuration with the required request Body.
* Buy the Megaport Internet connection with the validated request Body.

<Note>
  For more information about creating a Megaport Internet connection for an MVE to provide connectivity, and to register and communicate with the SD-WAN overlay network, see [Megaport Virtual Edge (MVE)](https://dev.megaport.com/#e44a2c7c-a066-4d31-80b9-1a17db837c39) in the API developer portal.
</Note>

For more information about Megaport Internet connections, see [Megaport Internet Overview](/megaport-internet).

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

**To get the productUid of the Port**

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` value for the Port you want to connect from.\
   This example uses this Port:

   ```json theme={"theme":{"light":"github-light-high-contrast","dark":"github-dark-high-contrast"}}
   "productName": "GB Megaport Internet Port"
   "productUid": "ecdc7ee9-a197-4686-8b16-046cfc07797a"
   ```

**To get the productUid of the internet router (B-End Port)**

1. In Postman, click **Locations** in the left navigation and click **GET Partner Megaports**.

2. Update the Query Parameters so that connectType is set to *TRANSIT* and vxcPermitted is set to *True*.\
   This will return Ports that support a Megaport Internet connection and where new connections are accepted.

3. Click **Send**.

4. From the returned Partner Megaport details, locate the `productUid` value for the internet router or Port you want to connect to.\
   This example uses this Port:

   ```json theme={"theme":{"light":"github-light-high-contrast","dark":"github-dark-high-contrast"}}
   "productUid": "874dbcff-a1f9-4328-9c08-112cd87c20f6"
   ```

**To review pricing details and validate the Megaport Internet connection configuration**

1. In Postman, expand **Connections > Megaport Internet** in the left navigation and click **POST Validate Megaport Internet Order (v3)**.

2. Update the Body with the `productUid` for each end of the connection.\
   You can also change additional values, such as name, rate limit, and contract terms.

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": "ecdc7ee9-a197-4686-8b16-046cfc07797a",
   "associatedVxcs": [
     {    
      "rateLimit": 10000,
      "term": 12,
      "productName": "Example Megaport Internet Connection",
      "aEnd": {
        "productName": "GB Megaport Internet Port"
      },  
      "bEnd": {
        "productUid": "874dbcff-a1f9-4328-9c08-112cd87c20f6"
      },
      "productType": "VXC",
      "connectType": "TRANSIT",
      "shutdown": false,
      "promoCode": "promox3mnthfree2"
     }
 ]
 }
]
```

After you validate the request and review the pricing details in the response, order the Megaport Internet connection.

**To order the Megaport Internet connection**

1. Copy the validated Body from **POST Validate Megaport Internet Order (v3)** and paste it into the Body of **POST Buy Megaport Internet (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 Megaport Internet connection appears in the Megaport Portal.

<Image src="/images/api/api-mic-port-portal.png" alt="Portal view of API Created Megaport Internet Connection" shadow={true} width={800} />
