Skip to content

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 ONE Portal username.
  3. Add another entry for password and enter your Megaport ONE Portal password.
  4. Click Update.
  5. Go to the Megaport collection and click Authentication > Log in with user details.
  6. Ensure your username and password variables are in the Params tab and click Send. Send login details
    The response JSON object includes a 32-digit hexadecimal token.
  7. Copy the token.
  8. 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.
  9. 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'

Tip

The dev.megaport.com site lets you see each API endpoint in multiple languages.


Last update: 2022-06-14