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

# Log in With Username and Password (v3)

POST https://api.megaport.com/v3/login
Content-Type: application/x-www-form-urlencoded

Logs a user in to the Megaport Portal when they supply a valid username and password.

This endpoint is called to log an existing user into the system. The endpoint can accept either an encoded password or a plain text password. If multi-factor authentication is enabled on the account, then a valid oneTimePassword value must be provided.

**Note:** If you receive error code 409 Conflict in a response when using this endpoint, it means that the user's email address has not yet been verified. The email address will need to be verified first using the instructions in the **Setting Up a Megaport Account** section of the Megaport documentation. For more information, see [Setting Up a Megaport Account](https://docs.megaport.com/setting-up/).

Reference: https://en.megaport.ferndocs.com/api-reference/user-authentication/log-in-with-username-and-password-v-3

## Servers

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

## Request

### Body (application/x-www-form-urlencoded)

This endpoint expects an object.

- `password` (string, optional)
- `username` (string, optional)

## Response

### 200

Log in With Username and Password - Success Response / Log in With Username and Password - Success Response

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

## Errors

### 400 Bad Request Error

Log in With Username and Password - If the Required Fields are not Present or any Field is Incorrect / Log in With Username and Password - If the Required Fields are not Present or any Field is Incorrect

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

### 401 Unauthorized Error

Log in With Username and Password - Token Issue / Log in With Username and Password - Token Issue

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

### 409 Conflict Error

Log in With Username and Password - Email Must be Confirmed Before Logging in / Log in With Username and Password - Email Must be Confirmed Before Logging in

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

## Types

### V3LoginPostResponsesContentApplicationJsonSchemaData

- `accountManager` (V3LoginPostResponsesContentApplicationJsonSchemaDataAccountManager, optional)
- `accountType` (string, optional)
- `apiKey` (boolean, optional)
- `authorities` (V3LoginPostResponsesContentApplicationJsonSchemaDataAuthorities, optional)
- `channelPartner` (boolean, optional)
- `companyConfiguration` (V3LoginPostResponsesContentApplicationJsonSchemaDataCompanyConfiguration, optional)
- `companyId` (double, optional)
- `companyName` (string, optional)
- `companyType` (string, optional)
- `companyUid` (string, optional)
- `email` (string, optional)
- `expiryDate` (string, optional)
- `featureFlags` (list of string, optional)
- `firstName` (string, optional)
- `forcePassword` (boolean, optional)
- `fullName` (string, optional)
- `idpId` (string, optional)
- `language` (string, optional)
- `lastName` (string, optional)
- `locale` (string, optional)
- `loginDate` (double, optional)
- `name` (string, optional)
- `nearestCountry` (string, optional)
- `new` (boolean, optional)
- `oAuthToken` (V3LoginPostResponsesContentApplicationJsonSchemaDataOAuthToken, optional)
- `parentCompanyUid` (string, optional)
- `permissions` (V3LoginPostResponsesContentApplicationJsonSchemaDataPermissions, optional)
- `personId` (double, optional)
- `personUid` (string, optional)
- `phone` (string, optional)
- `region` (string, optional)
- `requireTotp` (boolean, optional)
- `rootAccountType` (string, optional)
- `sourceIp` (string, optional)
- `supportOverride` (boolean, optional)
- `supportOverrideId` (string, optional)
- `t` (double, optional)
- `userAgent` (string, optional)
- `username` (string, optional)

### V3LoginPostResponsesContentApplicationJsonSchemaDataAccountManager

- `active` (boolean, optional)
- `email` (string, optional)
- `featureFlags` (list of any, optional)
- `firstName` (string, optional)
- `lastName` (string, optional)
- `name` (string, optional)
- `newsletter` (boolean, optional)
- `promotions` (boolean, optional)
- `uid` (string, optional)

### V3LoginPostResponsesContentApplicationJsonSchemaDataAuthorities

- `bec27ded-29fb-43dd-8df8-894eb5ca1e98` (V3LoginPostResponsesContentApplicationJsonSchemaDataAuthoritiesBec27Ded29Fb43Dd8Df8894Eb5Ca1E98, optional)

### V3LoginPostResponsesContentApplicationJsonSchemaDataCompanyConfiguration

- `consolidatedSettings` (list of V3LoginPostResponsesContentApplicationJsonSchemaDataCompanyConfigurationConsolidatedSettingsItems, optional)

### V3LoginPostResponsesContentApplicationJsonSchemaDataOAuthToken

- `accessToken` (string, optional)
- `expiresIn` (double, optional)
- `idToken` (string, optional)
- `tokenType` (string, optional)

### V3LoginPostResponsesContentApplicationJsonSchemaDataPermissions

- `bec27ded-29fb-43dd-8df8-894eb5ca1e98` (list of string, optional)

### V3LoginPostResponsesContentApplicationJsonSchemaDataAuthoritiesBec27Ded29Fb43Dd8Df8894Eb5Ca1E98

- `end_user` (boolean, optional)

### V3LoginPostResponsesContentApplicationJsonSchemaDataCompanyConfigurationConsolidatedSettingsItems

- `key` (string, optional)
- `value` (boolean, optional)

## Examples

### Log in With Username and Password - Success Response

**Response**

```json
{
  "data": {
    "accountManager": {
      "active": true,
      "email": "luke.richardson@megaport.com",
      "featureFlags": [],
      "firstName": "Luke",
      "lastName": "Richardson",
      "name": "Luke Richardson",
      "newsletter": true,
      "promotions": true,
      "uid": "1a9cdeaf-549b-4d8a-9f5d-9819f92c4e45"
    },
    "accountType": "ADMIN",
    "apiKey": false,
    "authorities": {
      "bec27ded-29fb-43dd-8df8-894eb5ca1e98": {
        "end_user": true
      }
    },
    "channelPartner": false,
    "companyConfiguration": {
      "consolidatedSettings": [
        {
          "key": "NOTIFICATIONS_ENABLED",
          "value": true
        },
        {
          "key": "INTERCOM_ENABLED",
          "value": true
        },
        {
          "key": "JIRA_CHAT_ENABLED",
          "value": true
        },
        {
          "key": "MARKET_AUSTRALIA",
          "value": true
        },
        {
          "key": "MARKET_HONG_KONG",
          "value": true
        },
        {
          "key": "MARKET_SINGAPORE",
          "value": true
        },
        {
          "key": "MARKET_SWITZERLAND",
          "value": true
        },
        {
          "key": "MARKET_NEW_ZEALAND",
          "value": true
        },
        {
          "key": "MARKET_US",
          "value": true
        },
        {
          "key": "MARKET_CANADA",
          "value": true
        },
        {
          "key": "MARKET_IRELAND",
          "value": true
        },
        {
          "key": "MARKET_SWEDEN",
          "value": true
        },
        {
          "key": "MARKET_NETHERLANDS",
          "value": true
        },
        {
          "key": "MARKET_GERMANY",
          "value": true
        },
        {
          "key": "MARKET_GERMANY_ECIX",
          "value": true
        },
        {
          "key": "MARKET_BULGARIA",
          "value": true
        },
        {
          "key": "MARKET_UK",
          "value": true
        },
        {
          "key": "MARKET_NORWAY",
          "value": true
        },
        {
          "key": "MARKET_FINLAND",
          "value": true
        },
        {
          "key": "MARKET_AUSTRIA",
          "value": true
        },
        {
          "key": "MARKET_POLAND",
          "value": true
        },
        {
          "key": "MARKET_DENMARK",
          "value": true
        },
        {
          "key": "MARKET_BELGIUM",
          "value": true
        },
        {
          "key": "MARKET_FRANCE",
          "value": true
        },
        {
          "key": "MARKET_JAPAN",
          "value": true
        },
        {
          "key": "MARKET_BRAZIL",
          "value": true
        },
        {
          "key": "MARKET_ITALY",
          "value": true
        },
        {
          "key": "MARKET_SPAIN",
          "value": true
        },
        {
          "key": "MARKET_LUXEMBOURG",
          "value": true
        },
        {
          "key": "REGISTRATION_TYPE_EMAIL_LINK",
          "value": true
        },
        {
          "key": "REGISTRATION_TYPE_USER_PROVIDES_CREDENTIALS",
          "value": false
        },
        {
          "key": "VANTAGE_PREFERRED",
          "value": false
        },
        {
          "key": "VANTAGE_PRESTIGE",
          "value": false
        },
        {
          "key": "DASHBOARD_ENABLED",
          "value": true
        },
        {
          "key": "COMPANY_PROFILE_ENABLED",
          "value": true
        },
        {
          "key": "MARKETPLACE_PROFILE_ENABLED",
          "value": true
        },
        {
          "key": "PRICING_VISIBLE",
          "value": true
        },
        {
          "key": "PAYS_BILL",
          "value": true
        },
        {
          "key": "PRODUCT_TYPE_MEGAPORT",
          "value": true
        },
        {
          "key": "PRODUCT_TYPE_IX",
          "value": true
        },
        {
          "key": "PRODUCT_TYPE_MVE",
          "value": true
        },
        {
          "key": "PRODUCT_TYPE_MCR2",
          "value": true
        },
        {
          "key": "PRODUCT_TYPE_VXC",
          "value": true
        },
        {
          "key": "MVE_BETA_VMWARE",
          "value": false
        },
        {
          "key": "MVE_BETA_FORTINET",
          "value": false
        },
        {
          "key": "MVE_BETA_CISCO",
          "value": false
        },
        {
          "key": "MVE_BETA_VERSA",
          "value": false
        },
        {
          "key": "MVE_BETA_ARUBA",
          "value": false
        },
        {
          "key": "MVE_VENDOR_VMWARE",
          "value": true
        },
        {
          "key": "MVE_VENDOR_FORTINET",
          "value": true
        },
        {
          "key": "MVE_VENDOR_CISCO",
          "value": true
        },
        {
          "key": "MVE_VENDOR_VERSA",
          "value": true
        },
        {
          "key": "MVE_VENDOR_ARUBA",
          "value": true
        },
        {
          "key": "VANTAGE_PARTNER",
          "value": false
        },
        {
          "key": "PORTAL_ACCESS_TYPE_STANDARD",
          "value": true
        },
        {
          "key": "PORTAL_ACCESS_TYPE_WHITELABEL",
          "value": false
        },
        {
          "key": "PORTAL_ACCESS_TYPE_NONE",
          "value": false
        }
      ]
    },
    "companyId": 1269,
    "companyName": "Public Access",
    "companyType": "DEFAULT",
    "companyUid": "bec27ded-29fb-43dd-8df8-894eb5ca1e98",
    "email": "megaport.newuser@abcd.com",
    "expiryDate": "",
    "featureFlags": [
      "pv_manual_mvp",
      "distributor_support",
      "vxc_20g",
      "term_mcr",
      "partner_portal",
      "validation"
    ],
    "firstName": "p",
    "forcePassword": false,
    "fullName": "p k",
    "idpId": "ec81f4d2-5902-4dba-9df6-ad212a1b2295",
    "language": "English",
    "lastName": "k",
    "locale": "United Kingdom",
    "loginDate": 1644820229860,
    "name": "p k",
    "nearestCountry": "",
    "new": false,
    "oAuthToken": {
      "accessToken": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJzdWIiOiIwMGNmMGQ3YS1iODM1LTQ3ODItOGM1MC0wZGY5ZjdlNjAxNjUiLCJ0b2tlbl91c2UiOiJhY2Nlc3MiLCJpc3MiOiJodHRwczovL2FwaS5tZWdhcG9ydC5jb20vdjIvbG9naW4iLCJncm91cHMiOlsicm9sZTphZG1pbiIsImNvbXBhbnk6YzEzNWQ3M2EtZjU0MC00ZGMxLWE0NzUtNGMxZjU1OTlhOWY0IiwicGVybWlzc2lvbjpoZWxsbyIsInBlcm1pc3Npb246d29ybGQiXSwiZXhwIjoxNjQ0ODIzNzAwLCJ1c2VybmFtZSI6ImpvZXkudHJpYmJpYW5pQGZyaWVuZHMuY29tIn0.cjcG-0kNpUu51BnrhI9D7R_7x2qFnE_Vu8iTUhDWGZwNYlpd8EsltwOnpT3A3HVs76-SK4MLyiP3-4sPcI4IhQ",
      "expiresIn": 1000,
      "idToken": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJzdWIiOiIwMGNmMGQ3YS1iODM1LTQ3ODItOGM1MC0wZGY5ZjdlNjAxNjUiLCJ0b2tlbl91c2UiOiJpZCIsImlzcyI6Imh0dHBzOi8vYXBpLm1lZ2Fwb3J0LmNvbS92Mi9sb2dpbiIsImdyb3VwcyI6WyJyb2xlOmFkbWluIiwiY29tcGFueTpjMTM1ZDczYS1mNTQwLTRkYzEtYTQ3NS00YzFmNTU5OWE5ZjQiLCJwZXJtaXNzaW9uOmhlbGxvIiwicGVybWlzc2lvbjp3b3JsZCJdLCJleHAiOjE2NDQ4MjM3MDAsImdpdmVuX25hbWUiOiJKb2V5IiwiZmFtaWx5X25hbWUiOiJUcmliYmlhbmkiLCJlbWFpbCI6ImpvZXkudHJpYmJpYW5pQGZyaWVuZHMuY29tIiwidXNlcm5hbWUiOiJqb2V5LnRyaWJiaWFuaUBmcmllbmRzLmNvbSJ9.JTPDc45yWhOlA6Wjm1t-rOkS8cZcA2UypLFlYfFvAQ3PyPFeOfhzWU290Ae14__ercZ3cOa812vgNveCb8WRgQ",
      "tokenType": "Bearer"
    },
    "parentCompanyUid": "",
    "permissions": {
      "bec27ded-29fb-43dd-8df8-894eb5ca1e98": [
        "end_user"
      ]
    },
    "personId": 47501,
    "personUid": "379473d7-ebc8-455e-bffa-370f9378240c",
    "phone": "",
    "region": "",
    "requireTotp": false,
    "rootAccountType": "ADMIN",
    "sourceIp": "192.168.1.1",
    "supportOverride": false,
    "supportOverrideId": "",
    "t": 1,
    "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.80 Safari/537.36",
    "username": "megaport.newuser@abcd.com"
  },
  "message": "Login successfully",
  "terms": "This data is subject to the Acceptable Use Policy https://www.megaport.com/legal/acceptable-use-policy"
}
```

**SDK Code**

```python Log in With Username and Password - Success Response
import requests

url = "https://api.megaport.com/v3/login"

response = requests.post(url)

print(response.json())
```

```javascript Log in With Username and Password - Success Response
const url = 'https://api.megaport.com/v3/login';
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 Log in With Username and Password - Success Response
package main

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

func main() {

	url := "https://api.megaport.com/v3/login"

	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 Log in With Username and Password - Success Response
require 'uri'
require 'net/http'

url = URI("https://api.megaport.com/v3/login")

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 Log in With Username and Password - Success Response
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

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

```php Log in With Username and Password - Success Response
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

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

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

```csharp Log in With Username and Password - Success Response
using RestSharp;

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

```swift Log in With Username and Password - Success Response
import Foundation

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

### Log in With Username and Password (v3)

**Request**

```json
{
  "password": "Dfjhgedcifk@!23",
  "username": "megaport.newuser@abcd.com"
}
```

**Response**

```json
{
  "data": {
    "accountManager": {
      "active": true,
      "email": "luke.richardson@megaport.com",
      "featureFlags": [],
      "firstName": "Luke",
      "lastName": "Richardson",
      "name": "Luke Richardson",
      "newsletter": true,
      "promotions": true,
      "uid": "1a9cdeaf-549b-4d8a-9f5d-9819f92c4e45"
    },
    "accountType": "ADMIN",
    "apiKey": false,
    "authorities": {
      "bec27ded-29fb-43dd-8df8-894eb5ca1e98": {
        "end_user": true
      }
    },
    "channelPartner": false,
    "companyConfiguration": {
      "consolidatedSettings": [
        {
          "key": "NOTIFICATIONS_ENABLED",
          "value": true
        },
        {
          "key": "INTERCOM_ENABLED",
          "value": true
        },
        {
          "key": "JIRA_CHAT_ENABLED",
          "value": true
        },
        {
          "key": "MARKET_AUSTRALIA",
          "value": true
        },
        {
          "key": "MARKET_HONG_KONG",
          "value": true
        },
        {
          "key": "MARKET_SINGAPORE",
          "value": true
        },
        {
          "key": "MARKET_SWITZERLAND",
          "value": true
        },
        {
          "key": "MARKET_NEW_ZEALAND",
          "value": true
        },
        {
          "key": "MARKET_US",
          "value": true
        },
        {
          "key": "MARKET_CANADA",
          "value": true
        },
        {
          "key": "MARKET_IRELAND",
          "value": true
        },
        {
          "key": "MARKET_SWEDEN",
          "value": true
        },
        {
          "key": "MARKET_NETHERLANDS",
          "value": true
        },
        {
          "key": "MARKET_GERMANY",
          "value": true
        },
        {
          "key": "MARKET_GERMANY_ECIX",
          "value": true
        },
        {
          "key": "MARKET_BULGARIA",
          "value": true
        },
        {
          "key": "MARKET_UK",
          "value": true
        },
        {
          "key": "MARKET_NORWAY",
          "value": true
        },
        {
          "key": "MARKET_FINLAND",
          "value": true
        },
        {
          "key": "MARKET_AUSTRIA",
          "value": true
        },
        {
          "key": "MARKET_POLAND",
          "value": true
        },
        {
          "key": "MARKET_DENMARK",
          "value": true
        },
        {
          "key": "MARKET_BELGIUM",
          "value": true
        },
        {
          "key": "MARKET_FRANCE",
          "value": true
        },
        {
          "key": "MARKET_JAPAN",
          "value": true
        },
        {
          "key": "MARKET_BRAZIL",
          "value": true
        },
        {
          "key": "MARKET_ITALY",
          "value": true
        },
        {
          "key": "MARKET_SPAIN",
          "value": true
        },
        {
          "key": "MARKET_LUXEMBOURG",
          "value": true
        },
        {
          "key": "REGISTRATION_TYPE_EMAIL_LINK",
          "value": true
        },
        {
          "key": "REGISTRATION_TYPE_USER_PROVIDES_CREDENTIALS",
          "value": false
        },
        {
          "key": "VANTAGE_PREFERRED",
          "value": false
        },
        {
          "key": "VANTAGE_PRESTIGE",
          "value": false
        },
        {
          "key": "DASHBOARD_ENABLED",
          "value": true
        },
        {
          "key": "COMPANY_PROFILE_ENABLED",
          "value": true
        },
        {
          "key": "MARKETPLACE_PROFILE_ENABLED",
          "value": true
        },
        {
          "key": "PRICING_VISIBLE",
          "value": true
        },
        {
          "key": "PAYS_BILL",
          "value": true
        },
        {
          "key": "PRODUCT_TYPE_MEGAPORT",
          "value": true
        },
        {
          "key": "PRODUCT_TYPE_IX",
          "value": true
        },
        {
          "key": "PRODUCT_TYPE_MVE",
          "value": true
        },
        {
          "key": "PRODUCT_TYPE_MCR2",
          "value": true
        },
        {
          "key": "PRODUCT_TYPE_VXC",
          "value": true
        },
        {
          "key": "MVE_BETA_VMWARE",
          "value": false
        },
        {
          "key": "MVE_BETA_FORTINET",
          "value": false
        },
        {
          "key": "MVE_BETA_CISCO",
          "value": false
        },
        {
          "key": "MVE_BETA_VERSA",
          "value": false
        },
        {
          "key": "MVE_BETA_ARUBA",
          "value": false
        },
        {
          "key": "MVE_VENDOR_VMWARE",
          "value": true
        },
        {
          "key": "MVE_VENDOR_FORTINET",
          "value": true
        },
        {
          "key": "MVE_VENDOR_CISCO",
          "value": true
        },
        {
          "key": "MVE_VENDOR_VERSA",
          "value": true
        },
        {
          "key": "MVE_VENDOR_ARUBA",
          "value": true
        },
        {
          "key": "VANTAGE_PARTNER",
          "value": false
        },
        {
          "key": "PORTAL_ACCESS_TYPE_STANDARD",
          "value": true
        },
        {
          "key": "PORTAL_ACCESS_TYPE_WHITELABEL",
          "value": false
        },
        {
          "key": "PORTAL_ACCESS_TYPE_NONE",
          "value": false
        }
      ]
    },
    "companyId": 1269,
    "companyName": "Public Access",
    "companyType": "DEFAULT",
    "companyUid": "bec27ded-29fb-43dd-8df8-894eb5ca1e98",
    "email": "megaport.newuser@abcd.com",
    "expiryDate": "",
    "featureFlags": [
      "pv_manual_mvp",
      "distributor_support",
      "vxc_20g",
      "term_mcr",
      "partner_portal",
      "validation"
    ],
    "firstName": "p",
    "forcePassword": false,
    "fullName": "p k",
    "idpId": "ec81f4d2-5902-4dba-9df6-ad212a1b2295",
    "language": "English",
    "lastName": "k",
    "locale": "United Kingdom",
    "loginDate": 1644820229860,
    "name": "p k",
    "nearestCountry": "",
    "new": false,
    "oAuthToken": {
      "accessToken": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJzdWIiOiIwMGNmMGQ3YS1iODM1LTQ3ODItOGM1MC0wZGY5ZjdlNjAxNjUiLCJ0b2tlbl91c2UiOiJhY2Nlc3MiLCJpc3MiOiJodHRwczovL2FwaS5tZWdhcG9ydC5jb20vdjIvbG9naW4iLCJncm91cHMiOlsicm9sZTphZG1pbiIsImNvbXBhbnk6YzEzNWQ3M2EtZjU0MC00ZGMxLWE0NzUtNGMxZjU1OTlhOWY0IiwicGVybWlzc2lvbjpoZWxsbyIsInBlcm1pc3Npb246d29ybGQiXSwiZXhwIjoxNjQ0ODIzNzAwLCJ1c2VybmFtZSI6ImpvZXkudHJpYmJpYW5pQGZyaWVuZHMuY29tIn0.cjcG-0kNpUu51BnrhI9D7R_7x2qFnE_Vu8iTUhDWGZwNYlpd8EsltwOnpT3A3HVs76-SK4MLyiP3-4sPcI4IhQ",
      "expiresIn": 1000,
      "idToken": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJzdWIiOiIwMGNmMGQ3YS1iODM1LTQ3ODItOGM1MC0wZGY5ZjdlNjAxNjUiLCJ0b2tlbl91c2UiOiJpZCIsImlzcyI6Imh0dHBzOi8vYXBpLm1lZ2Fwb3J0LmNvbS92Mi9sb2dpbiIsImdyb3VwcyI6WyJyb2xlOmFkbWluIiwiY29tcGFueTpjMTM1ZDczYS1mNTQwLTRkYzEtYTQ3NS00YzFmNTU5OWE5ZjQiLCJwZXJtaXNzaW9uOmhlbGxvIiwicGVybWlzc2lvbjp3b3JsZCJdLCJleHAiOjE2NDQ4MjM3MDAsImdpdmVuX25hbWUiOiJKb2V5IiwiZmFtaWx5X25hbWUiOiJUcmliYmlhbmkiLCJlbWFpbCI6ImpvZXkudHJpYmJpYW5pQGZyaWVuZHMuY29tIiwidXNlcm5hbWUiOiJqb2V5LnRyaWJiaWFuaUBmcmllbmRzLmNvbSJ9.JTPDc45yWhOlA6Wjm1t-rOkS8cZcA2UypLFlYfFvAQ3PyPFeOfhzWU290Ae14__ercZ3cOa812vgNveCb8WRgQ",
      "tokenType": "Bearer"
    },
    "parentCompanyUid": "",
    "permissions": {
      "bec27ded-29fb-43dd-8df8-894eb5ca1e98": [
        "end_user"
      ]
    },
    "personId": 47501,
    "personUid": "379473d7-ebc8-455e-bffa-370f9378240c",
    "phone": "",
    "region": "",
    "requireTotp": false,
    "rootAccountType": "ADMIN",
    "sourceIp": "192.168.1.1",
    "supportOverride": false,
    "supportOverrideId": "",
    "t": 1,
    "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.80 Safari/537.36",
    "username": "megaport.newuser@abcd.com"
  },
  "message": "Login successfully",
  "terms": "This data is subject to the Acceptable Use Policy https://www.megaport.com/legal/acceptable-use-policy"
}
```

**SDK Code**

```python Log in With Username and Password (v3)
import requests

url = "https://api.megaport.com/v3/login"

payload = ""
headers = {"Content-Type": "application/x-www-form-urlencoded"}

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

print(response.json())
```

```javascript Log in With Username and Password (v3)
const url = 'https://api.megaport.com/v3/login';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/x-www-form-urlencoded'},
  body: new URLSearchParams('')
};

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

```go Log in With Username and Password (v3)
package main

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

func main() {

	url := "https://api.megaport.com/v3/login"

	req, _ := http.NewRequest("POST", url, nil)

	req.Header.Add("Content-Type", "application/x-www-form-urlencoded")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Log in With Username and Password (v3)
require 'uri'
require 'net/http'

url = URI("https://api.megaport.com/v3/login")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/x-www-form-urlencoded'

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

```java Log in With Username and Password (v3)
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.megaport.com/v3/login")
  .header("Content-Type", "application/x-www-form-urlencoded")
  .asString();
```

```php Log in With Username and Password (v3)
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.megaport.com/v3/login', [
  'form_params' => null,
  'headers' => [
    'Content-Type' => 'application/x-www-form-urlencoded',
  ],
]);

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

```csharp Log in With Username and Password (v3)
using RestSharp;

var client = new RestClient("https://api.megaport.com/v3/login");
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/x-www-form-urlencoded");
IRestResponse response = client.Execute(request);
```

```swift Log in With Username and Password (v3)
import Foundation

let headers = ["Content-Type": "application/x-www-form-urlencoded"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.megaport.com/v3/login")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers

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()
```