> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://en.megaport.ferndocs.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://en.megaport.ferndocs.com/_mcp/server.

# Add Add-on to Existing MCR

POST https://api.megaport.com/v3/product/{productUid}/addon
Content-Type: application/json

Use this endpoint to add an **add-on** to an existing MCR.

These add-ons are available:

* BGP Config

* IP Address

* IPsec

## BGP Config

The payload for BGP Config is as follows:

| Field          | Format            | Required | Value                                                                                                                |
| -------------- | ----------------- | -------- | -------------------------------------------------------------------------------------------------------------------- |
| `addOnType`    | string, non-empty | Yes      | BGP\_CONFIG                                                                                                          |
| `customer_asn` | integer           | Yes      | Customer's BGP Autonomous System Number                                                                              |
| `password`     | string            |          | BGP authentication password                                                                                          |
| `as_set`       | string            |          | AS-SET identifier for BGP configuration                                                                              |
| `route_table`  | string, non-empty | Yes      | Type of route table for BGP configuration. Valid values are: "DEFAULT\_ONLY" "CUSTOMER\_AND\_PEER" "CUSTOMER" "FULL" |
| `prefixes`     | string            |          | BGP route prefixes                                                                                                   |
| `remark`       | string            |          | Addition notes or comments about the BGP configuration                                                               |

Example:

`{`

`"addOnType": "BGP_CONFIG",`

`"customer_asn": 65000,`

`"password": "SecureBgpPassword12345",`

`"as_set": "AS-EXAMPLE",`

`"route_table": "DEFAULT_ONLY",`

`"prefixes": "192.168.0.0/24,10.0.0.0/16",`

`"remark": "Primary BGP session for production services"`

`}`

## IP Address

The payload for IP address is as follows:

| Field                        | Format               | Required | Value                                                                                       |
| ---------------------------- | -------------------- | -------- | ------------------------------------------------------------------------------------------- |
| `addOnType`                  | string, non-empty    | Yes      | IP\_ADDRESS                                                                                 |
| `subnetSize`                 | string, 3 characters | Yes      | Size of the subnet to allocate. Valid values are: "/24" "/25" "/26" "/27" "/28" "/29" "/30" |
| `purpose`                    | string, non-empty    | Yes      | Purpose for which the IP address will be used                                               |
| `projectedUtilizationMonths` | requiredinteger      | Yes      |                                                                                             |
| `remark`                     | string               |          | Add                                                                                         |

Example:

`{`

`"addOnType": "IP_ADDRESS",`

`"subnetSize": "/29",`

`"purpose": "Customer-facing services",`

`"projectedUtilizationMonths": 12,`

`"remark": "Required for our new web service deployment"`

`}`

## IPsec

The payload for IPsec is as follows:

| Field         | Format            | Required | Value                                    |
| ------------- | ----------------- | -------- | ---------------------------------------- |
| `addOnType`   | string, non-empty | Yes      | IP\_SEC                                  |
| `tunnelCount` | integer           |          | Number of IPSec tunnels to be configured |

Example:

`{`

`"addOnType": "IP_SEC",`

`"tunnelCount": 30`

`}`

Reference: https://en.megaport.ferndocs.com/api-reference/product-details/add-add-on-to-existing-mcr

## Servers

- `https://api.megaport.com` (Production environment, default)
- `https://api-staging.megaport.com` (Staging environment (test only, reset every 24 hours))

## Request

### Path parameters

- `productUid` (string, required)

### Body (application/json)

This endpoint expects an object.

- `addOnType` (string, optional)
- `tunnelCount` (double, optional)

## Response

### 201

Add IPsec Tunnels / Add IPsec Tunnels / Add IPsec Tunnels / Add IPsec Tunnels

- `data` (V3ProductProductUidAddonPostResponsesContentApplicationJsonSchemaData, optional)
- `message` (string, optional)
- `terms` (string, optional)

## Types

### V3ProductProductUidAddonPostResponsesContentApplicationJsonSchemaData

- `addOnType` (string, optional)
- `addOnUid` (string, optional)
- `tunnelCount` (double, optional)

## Examples

### Add IPsec Tunnels

**Response**

```json
{
  "data": {
    "addOnType": "IP_SEC",
    "addOnUid": "4016a82f-0079-4d4e-aba6-eca7670a135a",
    "tunnelCount": 30
  },
  "message": "Add-On IP_SEC has been successfully created/requested.",
  "terms": "This data is subject to the Acceptable Use Policy https://www.megaport.com/legal/acceptable-use-policy"
}
```

**SDK Code**

```python Add IPsec Tunnels
import requests

url = "https://api.megaport.com/v3/product/productUid/addon"

response = requests.post(url)

print(response.json())
```

```javascript Add IPsec Tunnels
const url = 'https://api.megaport.com/v3/product/productUid/addon';
const options = {method: 'POST'};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Add IPsec Tunnels
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://api.megaport.com/v3/product/productUid/addon"

	req, _ := http.NewRequest("POST", url, nil)

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Add IPsec Tunnels
require 'uri'
require 'net/http'

url = URI("https://api.megaport.com/v3/product/productUid/addon")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)

response = http.request(request)
puts response.read_body
```

```java Add IPsec Tunnels
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.megaport.com/v3/product/productUid/addon")
  .asString();
```

```php Add IPsec Tunnels
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.megaport.com/v3/product/productUid/addon');

echo $response->getBody();
```

```csharp Add IPsec Tunnels
using RestSharp;

var client = new RestClient("https://api.megaport.com/v3/product/productUid/addon");
var request = new RestRequest(Method.POST);
IRestResponse response = client.Execute(request);
```

```swift Add IPsec Tunnels
import Foundation

let request = NSMutableURLRequest(url: NSURL(string: "https://api.megaport.com/v3/product/productUid/addon")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Add Add-on to Existing MCR

**Request**

```json
{
  "addOnType": "IP_SEC",
  "tunnelCount": 10
}
```

**Response**

```json
{
  "data": {
    "addOnType": "IP_SEC",
    "addOnUid": "4016a82f-0079-4d4e-aba6-eca7670a135a",
    "tunnelCount": 30
  },
  "message": "Add-On IP_SEC has been successfully created/requested.",
  "terms": "This data is subject to the Acceptable Use Policy https://www.megaport.com/legal/acceptable-use-policy"
}
```

**SDK Code**

```python Add Add-on to Existing MCR
import requests

url = "https://api.megaport.com/v3/product/productUid/addon"

payload = {
    "addOnType": "IP_SEC",
    "tunnelCount": 10
}
headers = {"Content-Type": "application/json"}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Add Add-on to Existing MCR
const url = 'https://api.megaport.com/v3/product/productUid/addon';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: '{"addOnType":"IP_SEC","tunnelCount":10}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Add Add-on to Existing MCR
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.megaport.com/v3/product/productUid/addon"

	payload := strings.NewReader("{\n  \"addOnType\": \"IP_SEC\",\n  \"tunnelCount\": 10\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Add Add-on to Existing MCR
require 'uri'
require 'net/http'

url = URI("https://api.megaport.com/v3/product/productUid/addon")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n  \"addOnType\": \"IP_SEC\",\n  \"tunnelCount\": 10\n}"

response = http.request(request)
puts response.read_body
```

```java Add Add-on to Existing MCR
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.megaport.com/v3/product/productUid/addon")
  .header("Content-Type", "application/json")
  .body("{\n  \"addOnType\": \"IP_SEC\",\n  \"tunnelCount\": 10\n}")
  .asString();
```

```php Add Add-on to Existing MCR
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.megaport.com/v3/product/productUid/addon', [
  'body' => '{
  "addOnType": "IP_SEC",
  "tunnelCount": 10
}',
  'headers' => [
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp Add Add-on to Existing MCR
using RestSharp;

var client = new RestClient("https://api.megaport.com/v3/product/productUid/addon");
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"addOnType\": \"IP_SEC\",\n  \"tunnelCount\": 10\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Add Add-on to Existing MCR
import Foundation

let headers = ["Content-Type": "application/json"]
let parameters = [
  "addOnType": "IP_SEC",
  "tunnelCount": 10
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.megaport.com/v3/product/productUid/addon")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Add Add-on to Existing Product

**Request**

```json
{
  "addOnType": "IP_SEC",
  "tunnelCount": 30
}
```

**Response**

```json
{
  "data": {
    "addOnType": "IP_SEC",
    "addOnUid": "4016a82f-0079-4d4e-aba6-eca7670a135a",
    "tunnelCount": 30
  },
  "message": "Add-On IP_SEC has been successfully created/requested.",
  "terms": "This data is subject to the Acceptable Use Policy https://www.megaport.com/legal/acceptable-use-policy"
}
```

**SDK Code**

```python Add Add-on to Existing Product
import requests

url = "https://api.megaport.com/v3/product/productUid/addon"

payload = {
    "addOnType": "IP_SEC",
    "tunnelCount": 30
}
headers = {"Content-Type": "application/json"}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Add Add-on to Existing Product
const url = 'https://api.megaport.com/v3/product/productUid/addon';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: '{"addOnType":"IP_SEC","tunnelCount":30}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Add Add-on to Existing Product
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.megaport.com/v3/product/productUid/addon"

	payload := strings.NewReader("{\n  \"addOnType\": \"IP_SEC\",\n  \"tunnelCount\": 30\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Add Add-on to Existing Product
require 'uri'
require 'net/http'

url = URI("https://api.megaport.com/v3/product/productUid/addon")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n  \"addOnType\": \"IP_SEC\",\n  \"tunnelCount\": 30\n}"

response = http.request(request)
puts response.read_body
```

```java Add Add-on to Existing Product
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.megaport.com/v3/product/productUid/addon")
  .header("Content-Type", "application/json")
  .body("{\n  \"addOnType\": \"IP_SEC\",\n  \"tunnelCount\": 30\n}")
  .asString();
```

```php Add Add-on to Existing Product
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.megaport.com/v3/product/productUid/addon', [
  'body' => '{
  "addOnType": "IP_SEC",
  "tunnelCount": 30
}',
  'headers' => [
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp Add Add-on to Existing Product
using RestSharp;

var client = new RestClient("https://api.megaport.com/v3/product/productUid/addon");
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"addOnType\": \"IP_SEC\",\n  \"tunnelCount\": 30\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Add Add-on to Existing Product
import Foundation

let headers = ["Content-Type": "application/json"]
let parameters = [
  "addOnType": "IP_SEC",
  "tunnelCount": 30
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.megaport.com/v3/product/productUid/addon")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```