> 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.

# Get Add-on Price (v4)

POST https://api.megaport.com/v4/pricebook/addon
Content-Type: application/json

Returns the price for a Megaport product add-on based on the specified configuration parameters.

This endpoint allows you to fetch the pricing information for a given add-on configuration. This configuration can be for an entirely new add-on for an existing product.

The request will be rejected if the add-on type is not supported.

The parameters are defined in the Body of the request:

- `addOnType` - The type of add-on: CROSS_CONNECT. Cross Connects can only be added for Ports. (String).
    
- `productUid` - The unique identifier for the product. Either `productUid` or `locationId` must be provided (String).
    
- `locationId` - The location identifier where the Cross Connect will be configured. If productUid is provided, the location of the product will be used. Either productUid or locationId must be provided (Integer).
    
- `companyId` - The id of the company that will own the product. If not provided, will default to the authenticated user's company (Integer).
    
- `currency` - The ISO 4217 currency code to use for pricing. For example, the US dollar is USD. If not provided, defaults to the existing product's currency. If the product is not specified, currency must be provided. For more information, see [Country Currency Codes](https://www.iban.com/currency-codes). (String)
    
- `crossConnectRequested` - Whether a Cross Connect has been requested (Boolean).
    

**Note**: Only one of productUID or locationId should be provided for Cross Connect add-on pricing. Otherwise, the request will return a 400 error.

Reference: https://en.megaport.ferndocs.com/api-reference/pricing/get-add-on-price-v-4

## Servers

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

## Request

### Query parameters

- `companyId` (string, optional) — The Id of the company that will own the product. If not provided, it will default to the authenticated user's company. This can be supplied with productUid to fetch the pricing of an existing product, but in the context of another company. (Optional - integer \<int32> >= 1)

### Body (application/json)

This endpoint expects a Pricing_getAddOnPriceV4_Request.

- `addOnType` (string, optional)
- `companyId` (double, optional)
- `crossConnectRequested` (boolean, optional)
- `currency` (string, optional)
- `productUid` (string, optional)

## Response

### 200

Get Add-on Price (v4) - Cross Connect / Get Add-on Price (v4) - Cross Connect

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

## Errors

### 400 Bad Request Error

Get Add-on Price (v4) - 400 Error / Get Add-on Price (v4) - 400 Error

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

## Types

### V4PricebookAddonPostResponsesContentApplicationJsonSchemaData

- `currency` (string, optional)
- `discounts` (list of any, optional)
- `monthlyRackRate` (any, optional, nullable)
- `monthlyRate` (any, optional, nullable)
- `prices` (list of V4PricebookAddonPostResponsesContentApplicationJsonSchemaDataPricesItems, optional)
- `productType` (any, optional, nullable)

### V4PricebookAddonPostResponsesContentApplicationJsonSchemaDataPricesItems

- `addOnType` (string, optional)
- `amount` (double, optional)
- `chargeReason` (string, optional)
- `frequency` (string, optional)

## Examples

### Get Add-on Price (v4) - Cross Connect

**Response**

```json
{
  "data": {
    "currency": "AUD",
    "discounts": [],
    "monthlyRackRate": null,
    "monthlyRate": null,
    "prices": [
      {
        "addOnType": "CROSS_CONNECT",
        "amount": 350,
        "chargeReason": "ADD_ON_CHARGE",
        "frequency": "MONTHLY"
      },
      {
        "addOnType": "CROSS_CONNECT",
        "amount": 600,
        "chargeReason": "ADD_ON_CHARGE",
        "frequency": "ONCE"
      }
    ],
    "productType": null
  },
  "message": "AddOn price",
  "terms": "This data is subject to the Acceptable Use Policy https://www.megaport.com/legal/acceptable-use-policy"
}
```

**SDK Code**

```python Get Add-on Price (v4) - Cross Connect
import requests

url = "https://api.megaport.com/v4/pricebook/addon"

response = requests.post(url)

print(response.json())
```

```javascript Get Add-on Price (v4) - Cross Connect
const url = 'https://api.megaport.com/v4/pricebook/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 Get Add-on Price (v4) - Cross Connect
package main

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

func main() {

	url := "https://api.megaport.com/v4/pricebook/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 Get Add-on Price (v4) - Cross Connect
require 'uri'
require 'net/http'

url = URI("https://api.megaport.com/v4/pricebook/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 Get Add-on Price (v4) - Cross Connect
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

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

```php Get Add-on Price (v4) - Cross Connect
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

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

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

```csharp Get Add-on Price (v4) - Cross Connect
using RestSharp;

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

```swift Get Add-on Price (v4) - Cross Connect
import Foundation

let request = NSMutableURLRequest(url: NSURL(string: "https://api.megaport.com/v4/pricebook/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()
```

### Get Add-on Price (v4)

**Request**

```json
{
  "addOnType": "CROSS_CONNECT",
  "companyId": 789,
  "crossConnectRequested": true,
  "currency": "AUD",
  "productUid": "ad6837e3-2e4d-4024-b5b6-ee5b968c8f85"
}
```

**Response**

```json
{
  "data": {
    "currency": "AUD",
    "discounts": [],
    "monthlyRackRate": null,
    "monthlyRate": null,
    "prices": [
      {
        "addOnType": "CROSS_CONNECT",
        "amount": 350,
        "chargeReason": "ADD_ON_CHARGE",
        "frequency": "MONTHLY"
      },
      {
        "addOnType": "CROSS_CONNECT",
        "amount": 600,
        "chargeReason": "ADD_ON_CHARGE",
        "frequency": "ONCE"
      }
    ],
    "productType": null
  },
  "message": "AddOn price",
  "terms": "This data is subject to the Acceptable Use Policy https://www.megaport.com/legal/acceptable-use-policy"
}
```

**SDK Code**

```python Get Add-on Price (v4)
import requests

url = "https://api.megaport.com/v4/pricebook/addon"

payload = {
    "addOnType": "CROSS_CONNECT",
    "companyId": 789,
    "crossConnectRequested": True,
    "currency": "AUD",
    "productUid": "ad6837e3-2e4d-4024-b5b6-ee5b968c8f85"
}
headers = {"Content-Type": "application/json"}

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

print(response.json())
```

```javascript Get Add-on Price (v4)
const url = 'https://api.megaport.com/v4/pricebook/addon';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: '{"addOnType":"CROSS_CONNECT","companyId":789,"crossConnectRequested":true,"currency":"AUD","productUid":"ad6837e3-2e4d-4024-b5b6-ee5b968c8f85"}'
};

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

```go Get Add-on Price (v4)
package main

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

func main() {

	url := "https://api.megaport.com/v4/pricebook/addon"

	payload := strings.NewReader("{\n  \"addOnType\": \"CROSS_CONNECT\",\n  \"companyId\": 789,\n  \"crossConnectRequested\": true,\n  \"currency\": \"AUD\",\n  \"productUid\": \"ad6837e3-2e4d-4024-b5b6-ee5b968c8f85\"\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 Get Add-on Price (v4)
require 'uri'
require 'net/http'

url = URI("https://api.megaport.com/v4/pricebook/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\": \"CROSS_CONNECT\",\n  \"companyId\": 789,\n  \"crossConnectRequested\": true,\n  \"currency\": \"AUD\",\n  \"productUid\": \"ad6837e3-2e4d-4024-b5b6-ee5b968c8f85\"\n}"

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

```java Get Add-on Price (v4)
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.megaport.com/v4/pricebook/addon")
  .header("Content-Type", "application/json")
  .body("{\n  \"addOnType\": \"CROSS_CONNECT\",\n  \"companyId\": 789,\n  \"crossConnectRequested\": true,\n  \"currency\": \"AUD\",\n  \"productUid\": \"ad6837e3-2e4d-4024-b5b6-ee5b968c8f85\"\n}")
  .asString();
```

```php Get Add-on Price (v4)
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.megaport.com/v4/pricebook/addon', [
  'body' => '{
  "addOnType": "CROSS_CONNECT",
  "companyId": 789,
  "crossConnectRequested": true,
  "currency": "AUD",
  "productUid": "ad6837e3-2e4d-4024-b5b6-ee5b968c8f85"
}',
  'headers' => [
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp Get Add-on Price (v4)
using RestSharp;

var client = new RestClient("https://api.megaport.com/v4/pricebook/addon");
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"addOnType\": \"CROSS_CONNECT\",\n  \"companyId\": 789,\n  \"crossConnectRequested\": true,\n  \"currency\": \"AUD\",\n  \"productUid\": \"ad6837e3-2e4d-4024-b5b6-ee5b968c8f85\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Get Add-on Price (v4)
import Foundation

let headers = ["Content-Type": "application/json"]
let parameters = [
  "addOnType": "CROSS_CONNECT",
  "companyId": 789,
  "crossConnectRequested": true,
  "currency": "AUD",
  "productUid": "ad6837e3-2e4d-4024-b5b6-ee5b968c8f85"
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.megaport.com/v4/pricebook/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()
```