Managing Connectivity with Megaport’s APIs as a Service Provider

Service providers can seamlessly integrate Megaport’s functionality into their platform. They can control customer access to their on-ramps, such as Ports.

Service providers can use a service key to manage customer access and secure connectivity to their on-ramps. They can set specific rate limits and segment customer traffic using VLANs.

Before allowing their customers to connect to an on-ramp using a service key, a service provider must first connect to the Megaport network. Once connected they must:

  • decide which of their connections should be used as on-ramps
  • map those on-ramp location to their user-defined regions or zones
  • consider the capacity and diversity zones for redundancy management

This topic describes how you, as a service provider, can use Megaport APIs to reduce manual effort and enable faster provisioning of services. This will make it easier to sell private connectivity to your customers.


QuantumGPU is a small service provider company, headquartered in Los Angeles, California, serving as a self-service, on-demand GPU-as-a-Service (GPUaaS) platform. Empowering businesses with GPU-accelerated computing across diverse geographic locations, QuantumGPU operates the following Ports:

  • 2 Ports in Los Angeles, USA (Equinix LA1 and CoreSite LA1)
  • 1 Port in New York, United States (Telehouse)
  • 1 Port in London, United Kingdom (Telehouse North)
  • 1 Port in Osaka, Japan (Equinix OS1)
  • 1 Port in Sydney, Australia (Global Switch Sydney West)

Scenario showing the active ports the service provider owns

QuantumGPU needs to control how their customers connect to the Ports and automate the process with APIs.

QuantumGPU (service provider) plans to implement the following scenario:

Scenario and workflow: A step-by-step process for connecting to a service provider's platform: Customer requests a connection to an on-ramp on the service provider’s platform. Service provider lists regions where Ports are available: USA, UK, Japan, Australia. Customer selects a region (USA). Service provider lists cities with live Ports in the USA: Los Angeles, New York. Service provider maps available Ports in Los Angeles to a region called US-West, allowing customers to connect to one of the available Ports in US-West. Service provider decides which on-ramp to offer to the customer, considering capacity/usage and diversity. Customer selects US-West and adds diversity. Service provider creates service keys to the selected Ports: Los Angeles 1 (blue zone) Los Angeles 2 (red zone) Customer creates connections using the service keys.

Ensure that you are familiar with the following terminology used in this topic:


An on-ramp is a direct, private connection to a service provider’s available resources, for example, via a Megaport connection. To ensure fast and reliable connections, the service provider maps these resources to their regions or zones, sets rate limits, manages per-customer VLAN capacity, and so on.


A Port is the high-speed Ethernet interface that connects to Megaport’s global software-defined network (SDN). Ports are available in 1 Gbps, 10 Gbps and 100 Gbps speed options.

Port diversity

Port diversity improves the robustness of your network by providing Port services on different physical devices at a single Megaport location. Ports are assigned to diversity zones. A diversity zone groups devices at the same location to ensure that services are provisioned on physically separate devices that always remain diverse.

Service key

A service key is a code that is given by one Megaport account holder to another to connect two separate businesses together. Customers who have separate Megaport accounts can connect their Ports to each other across the Megaport network, enabling business-to-business VXCs.

Virtual Cross Connect (VXC)

VXCs are direct Layer 2 Ethernet circuits providing private, flexible, and on-demand connections between any of the locations on the Megaport network, offering capacities ranging from 1 Mbps to 10 Gbps. In many locations, connections of up to 25 Gbps are supported, while select regions in the US can benefit from connections up to 100 Gbps.

Authenticating as an API user

Before you can use the Megaport APIs, you must authenticate with an access token. Before you can generate the access token, you must create an API key in the Megaport Portal. For more information, see Creating an API Key.

The API key consist of a client ID and a client secret. You can use it to generate the access token that is used to authenticate as an API user.

Access tokens are valid for 24 hours and must be regenerated after that time. Your integration with Megaport’s API will need to take this into account. For more information, see Generating an access token.

Managing on-ramps

When your customer requests a connection to you, you will need to map the region or zone of the connection to a physical on-ramp to generate the service key.

This section describes the API calls to map your users’ service region or zone to your Megaport on-ramp. Megaport location and product identifiers are constant so this can be cached or stored safely without needing to refresh every time.

These instructions describe how to do this using Postman and the Megaport API collection. For more information on the Postman setup, see Megaport API.


This section assumes that you:

Listing on-ramp locations

This task describes how you can look up and list your available on-ramp locations (Port locations in our scenario) using the location identifiers.

To list on-ramp locations

  1. After your customer requests to connect to an on-ramp, for example, a Port, use the Get Product List API with "provisioningStatus": "LIVE"to look up all the live Ports that you own.

    GET /v2/products?provisioningStatus=LIVE
  2. Filter and list the response using the country value.

         "locationId": 60,
         "location": "CoreSite LA1",
         "locationDetail": {
             "name": "CoreSite LA1",
             "city": "Los Angeles",
             "metro": "Los Angeles",
             "country": "USA"

    In our scenario, the list is as follows:

    • USA
    • UK
    • Japan
    • Australia
  3. After your customer selects a region (USA), filter and list the response on the metro value.

         "locationId": 60,
         "location": "CoreSite LA1",
         "locationDetail": {
             "name": "CoreSite LA1",
             "city": "Los Angeles",
             "metro": "Los Angeles",
             "country": "USA"

    In our scenario, the list is as follows:

    • Los Angeles
    • New York
  4. After your customer selects a region (US-West), filter and list the response on the locationId value.

         "locationId": 60,
         "location": "CoreSite LA1",
         "locationDetail": {
             "name": "CoreSite LA1",
             "city": "Los Angeles",
             "metro": "Los Angeles",
             "country": "USA"

    In our scenario, the list is as follows:

    • “locationId”: 59
    • “locationId”: 60

Mapping an on-ramp location to a user-defined region or zone

You can use the listed location identifiers, such as locationId, metro, or country and map them to your predefined custom region or zone names.

By mapping the available on-ramps, like Los Angeles 1 (“locationId”: 59) and Los Angeles 2 (“locationId”: 60), to the predefined US-West region, your customers can select US-West on your platform and connect to an available on-ramp.

Selecting an on-ramp

You can use APIs to identify which on-ramp to connect to, for example, to connect to the Port with the least usage. You can consider factors such as the number of connections, capacity, or utilization. Additionally, you can consider factors like diversity zones to manage redundancy.

Use the response of the filtered Ports to consider the Port attributes as follows:

Attribute Consider
diversityZone Check if the current location supports diversity.
For more information, see Port Diversity.
portSpeed Check the available speed of the Port.
rateLimit The VXC rate limit cannot exceed the speed of the lowest speed Port.
For more information, see Connections Overview.
associatedVxcs Check if VXCs are associated with the Port and the allocated capacity.
maxVxcSpeed Check the maximum VXC speed available for the Port.
vxcPermitted Ensure that the vxcPermitted is true. If the vxcPermitted value is false, you cannot create a VXC to that Port.

After considering the selected Ports, you can display a Port that meets the required criteria, for example, a Port with the least usage. For more information, see Megaport API.

Managing connections

By following best practices in managing the service keys and VLAN IDs, you can maintain organized and secure connections.

Managing service keys

Service keys allow your customers to establish connections to your specific on-ramps.

Managing service keys involves creating, sharing, and monitoring the service keys.

This process is shown and explained in more detail below:

Process showing the service key workflow explained in more detail below

After you select the on-ramp service, you can create a service key to the on-ramp. Creating the service key has no extra cost to you, regardless of whether your customer uses the key or not.

Share the service key with your customer. Optionally, create a workflow for your customer, outlining the necessary steps and an indicative timeframe to use the received service key.

As a prerequisite, your customer must have an account with Megaport and have an available Port.

Using the service key, your customer can create a VXC and connect to the on-ramp based on the parameters you specified. Your customer is responsible for the VXC charges associated with the selected on-ramp location.

Use the GET List Service Keys API to continually monitor and keep track of the status of your service keys. For example, check if a service key you created and sent to a customer has been used. After your customer uses the service key, it becomes obsolete, and the service key ID is not kept. This means that there is no connection between the service key and the service it activated.

The service key is service-specific. To ensure redundancy and resilience in the event of failures or disruptions, we recommend that you create on-ramps located in different diversity zones. In this case, you must also create separate service keys for each on-ramp, for example:

  • 1 key for Los Angeles 1 in the blue diversity zone
  • 1 key for Los Angeles 2 in the red diversity zone

You can create either a single-use or a multi-use service key. With a single-use service key, the customer you share the key with can request a single connection to a specific on-ramp. With a multi-use key, the customer with whom you share the key can request multiple connections. In such instances, the system automatically allocates the next available VLAN ID.

Managing VLAN IDs

For single-use service keys, specify a VLAN ID, which you can use to link customers to their respective VXCs. When you assign a VLAN ID to the service key, it indicates that the assigned VXC is dedicated to a specific customer. Each VXC is delivered as a separate VLAN on your on-ramp. This must be a unique VLAN ID on this on-ramp and can range from 2 to 4093.

The figure below shows that you assigned different VLAN IDs for each customer as follows:

  • VLAN ID 100 assigned to Customer 1
  • VLAN ID 200 assigned to Customer 2

The VLAN IDs (100 and 200) assigned by you can differ from the VLAN IDs assigned by your customers (123 and 10), or the VLAN IDs assigned to other Port connections they have, such as those to cloud service providers like AWS, Oracle, or Azure (124, 125 and 20).

Scenario showing that the VLAN IDs assigned by the service provider can differ from the VLAN IDs assigned by the customers

For more information, see Setting Up Service Keys and Creating a Service Key with the API.


This topic described how you can efficiently manage customer connections to your on-ramps.

Using Megaport APIs, to look up Ports, select Ports based on capacity, diversity, and so on, you can automate the process, reducing manual effort and enabling rapid service provisioning.

Summary of APIs used

This table shows the process and the APIs used in this scenario:

Action by the service provider’s customer Action by the service provider API requests and values used for filtering Result
On the service provider’s platform, request a connection to an on-ramp. List regions with live Ports. GET /v2/products?

List "country" values.
  • USA
  • UK
  • Japan
  • Australia
Select a region (USA). List cities with live Ports in the USA. GET /v2/products?

List “metro" values.
  • Los Angeles
  • New York
List Ports in Los Angeles.

Map the available Ports, for example, Los Angeles 1 (“locationId”: 59) and Los Angeles 2 (“locationId”: 60) to a region called US-West. Then, in your platform, your customers can connect to one of the available Ports in US-West.

Decide which on-ramp to offer to the customer. Consider capacity/usage and diversity.
GET /v2/products?
&country=USA&metro=Los Angeles

List "locationId" values.
  • Equinix LA1 (“locationId”: 59)
  • CoreSite LA1 (“locationId”: 60)
Select US-West and add diversity. Create service keys to the selected Ports.

Send the service keys back to your customer.
POST /v2/service/key

Required value: "productUid"
2 separate keys are created for:
  • Los Angeles 1 (blue zone)
  • Los Angeles 2 (red zone)
Example key:
“key”: “106e38ae-eb59-415f-ac81-526a5299851d”,
Create connections with the service keys.

Integrating Megaport into your platform

For an example on how to integrate Megaport into your platform, see the demo project at