Logging In to the Megaport API

Megaport API calls require a token that you obtain following a successful login.

To set up your login and token details in Postman

  1. Click the Collections tab, click the three dots after the imported Megaport collection, and click Edit.
    Edit the Megaport collection
  2. Click the Variables tab and add a variable for username and define the value to be your Megaport Portal username.
  3. Add another entry for password and enter your Megaport Portal password.
  4. Click Update.
  5. Go to the Megaport collection and click Security > Login with User Details and click Send.
    Send login details
    The response JSON object includes a 32-digit hexadecimal token.
  6. Copy the token.
  7. In the variables for the collection, add another entry for token and paste the token into the current value field.
    Most API calls require the token generated from a successful login.
  8. Click Update.

Most API calls are now ready to use. All API calls are made over SSL/TLS, and every call is validated against the calling user account for appropriate permissions.

When you log in with a token, most requests include two important headers: Content-Type and X-Auth-Token. The X-Auth-Token points to the token variable.

Required headers

Curl Login

Another way to log in is using cURL from a command console in the following format:

curl -X POST -d username=myaccountid&password=mypassword’ ‘https://api-staging.megaport.com/v2/login’


Last update: