Skip to content

Megaport API

Megaport offers a public API for access to all the services available through the Megaport Portal. You can use this API to automate your Megaport provisioning to save time and effort.

The Megaport API is based on REST. The API has predictable URLs, accepts form-encoded request bodies, returns json-encoded responses, and uses standard HTTP response codes.

The topics in this section step you through the API calls needed to perform common tasks such as logging in, creating a Port, and creating a VXC from the Port to a cloud provider.

Beyond these topics, you can view a complete API reference at https://dev.megaport.com.

Environments

There are two server environments for the APIs:

  • Production environment: https://api.megaport.com
    You are responsible for any services and associated costs ordered in this system.

    API changes through https://api.megaport.com are reflected in the Megaport Portal.

  • Staging (test) environment: https://api-staging.megaport.com
    You can test any action in this staging environment and the API calls and responses mirror the production system, but services will not be deployed and you will not be billed for any activity.

    Your staging portal account reflects the staging services created; however, these will be reset every 24 hours.

    You can use your production credentials to log in to the staging environment and order or edit services. (New user accounts take 24 hours before they are available for use in staging.)

    API changes through https://api-staging.megaport.com are reflected in the Staging Portal.

Note

The requests in the API topics use the {baseUrl} variable. You can replace this with the staging URL (https://api-staging.megaport.com) or the production URL (https://api.megaport.com) depending on whether you want to test configurations or work with your production deployment. If you use the Postman collection (described in the next section), you can define environment variables in the collection to automatically populate the baseUrl value in API requests and easily switch between staging and production environments.

Getting started with the API and Postman

When writing and deploying your client-side code to call the Megaport API, you can use any language you prefer from Java to Python.

To step through the tutorials in these API topics, we recommend the Postman client with the imported Megaport Collection.

Postman is a straightforward, powerful HTTP client that helps build, test, and modify APIs. You can use it to interact with any functionality on any API. Postman Collections are simply a set of pre-built requests organized into folders, and they can be easily exported and shared with others.

Before you can get started with the Megaport Collection in Postman, you need a Megaport Account and you need to install Postman.

To set up the Megaport Collection in Postman

  • Download the postman API collection from dev.megaport.com.
    Click the Run In Postman button in the top right corner of the linked page.

Last update: 2024-03-27