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

# List Service Keys

GET https://api.megaport.com/v2/service/key

Lists service keys associated with your account.

Add a service or a specific key to return details only for that value.

The response includes all of the information about a service key, including the creation date, description, VLAN, maximum speed, whether the key is single-use or multi-use, whether it is active, and the dates for which the key is valid.

The dates are returned in UNIX timestamp date format. You can use tools such as [https://www.epochconverter.com/](https://www.epochconverter.com/) or [https://it-tools.tech/date-converter](https://it-tools.tech/date-converter) to convert the date to a human-readable format.

Reference: https://en.megaport.ferndocs.com/api-reference/cloud-connectivity/list-service-keys

## Servers

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

## Request

### Query parameters

- `productIdOrUid` (string, optional) — List keys linked to the service specified by the product ID or UID. (Optional)
- `key` (string, optional) — Get details for the specified key. (Optional) You can use the first 8 digits of a key, or you can use the full value.

## Response

### 200

List Service Keys / List Service Keys - Specified Key / List Service Keys / List Service Keys - Specified Key / Look Up SAP Service Key / Look Up SAP Service Key

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

## Types

### V2ServiceKeyGetResponsesContentApplicationJsonSchemaData

### V2ServiceKeyGetResponsesContentApplicationJsonSchemaData1

- `active` (boolean, optional)
- `bEnd` (V2ServiceKeyGetResponsesContentApplicationJsonSchemaDataOneOf1BEnd, optional)
- `companyId` (double, optional)
- `companyName` (string, optional)
- `companyUid` (string, optional)
- `createDate` (double, optional)
- `description` (string, optional)
- `expired` (boolean, optional)
- `key` (string, optional)
- `lastUsed` (any, optional, nullable)
- `maxSpeed` (double, optional)
- `preApproved` (boolean, optional)
- `productDto` (V2ServiceKeyGetResponsesContentApplicationJsonSchemaDataOneOf1ProductDto, optional)
- `productId` (double, optional)
- `productName` (string, optional)
- `productUid` (string, optional)
- `singleUse` (boolean, optional)
- `valid` (boolean, optional)
- `validFor` (V2ServiceKeyGetResponsesContentApplicationJsonSchemaDataOneOf1ValidFor, optional)
- `vlan` (any, optional, nullable)

### V2ServiceKeyGetResponsesContentApplicationJsonSchemaData3

- `active` (boolean, optional)
- `bEnd` (V2ServiceKeyGetResponsesContentApplicationJsonSchemaDataOneOf3BEnd, optional)
- `companyId` (double, optional)
- `companyName` (string, optional)
- `companyUid` (string, optional)
- `createDate` (double, optional)
- `description` (string, optional)
- `expired` (boolean, optional)
- `key` (string, optional)
- `lastUsed` (any, optional, nullable)
- `maxSpeed` (double, optional)
- `preApproved` (boolean, optional)
- `productDto` (V2ServiceKeyGetResponsesContentApplicationJsonSchemaDataOneOf3ProductDto, optional)
- `productId` (double, optional)
- `productName` (string, optional)
- `productUid` (string, optional)
- `singleUse` (boolean, optional)
- `valid` (boolean, optional)
- `validFor` (V2ServiceKeyGetResponsesContentApplicationJsonSchemaDataOneOf3ValidFor, optional)
- `vlan` (any, optional, nullable)

### V2ServiceKeyGetResponsesContentApplicationJsonSchemaData4

- `active` (boolean, optional)
- `companyId` (double, optional)
- `companyName` (string, optional)
- `companyUid` (string, optional)
- `createDate` (double, optional)
- `description` (string, optional)
- `expired` (boolean, optional)
- `key` (string, optional)
- `lastUsed` (any, optional, nullable)
- `maxSpeed` (double, optional)
- `preApproved` (boolean, optional)
- `productDto` (V2ServiceKeyGetResponsesContentApplicationJsonSchemaDataOneOf4ProductDto, optional)
- `productId` (double, optional)
- `productName` (string, optional)
- `productUid` (string, optional)
- `promoCode` (any, optional, nullable)
- `singleUse` (boolean, optional)
- `valid` (boolean, optional)
- `validFor` (V2ServiceKeyGetResponsesContentApplicationJsonSchemaDataOneOf4ValidFor, optional)
- `vlan` (double, optional)

### V2ServiceKeyGetResponsesContentApplicationJsonSchemaData5

- `active` (boolean, optional)
- `companyId` (double, optional)
- `companyName` (string, optional)
- `companyUid` (string, optional)
- `createDate` (double, optional)
- `description` (string, optional)
- `expired` (boolean, optional)
- `key` (string, optional)
- `lastUsed` (any, optional, nullable)
- `maxSpeed` (double, optional)
- `preApproved` (boolean, optional)
- `productDto` (V2ServiceKeyGetResponsesContentApplicationJsonSchemaDataOneOf5ProductDto, optional)
- `productId` (double, optional)
- `productName` (string, optional)
- `productUid` (string, optional)
- `promoCode` (any, optional, nullable)
- `singleUse` (boolean, optional)
- `valid` (boolean, optional)
- `validFor` (V2ServiceKeyGetResponsesContentApplicationJsonSchemaDataOneOf5ValidFor, optional)
- `vlan` (double, optional)

### V2ServiceKeyGetResponsesContentApplicationJsonSchemaDataOneOf1BEnd

### V2ServiceKeyGetResponsesContentApplicationJsonSchemaDataOneOf1ProductDto

- `companyName` (string, optional)
- `companyUid` (string, optional)
- `connectType` (string, optional)
- `diversityZone` (string, optional)
- `locationId` (double, optional)
- `portSpeed` (double, optional)
- `productName` (string, optional)
- `productUid` (string, optional)
- `vxcPermitted` (boolean, optional)

### V2ServiceKeyGetResponsesContentApplicationJsonSchemaDataOneOf1ValidFor

- `end` (double, optional)
- `start` (double, optional)

### V2ServiceKeyGetResponsesContentApplicationJsonSchemaDataOneOf3BEnd

### V2ServiceKeyGetResponsesContentApplicationJsonSchemaDataOneOf3ProductDto

- `companyName` (string, optional)
- `companyUid` (string, optional)
- `connectType` (string, optional)
- `diversityZone` (string, optional)
- `locationId` (double, optional)
- `portSpeed` (double, optional)
- `productName` (string, optional)
- `productUid` (string, optional)
- `vxcPermitted` (boolean, optional)

### V2ServiceKeyGetResponsesContentApplicationJsonSchemaDataOneOf3ValidFor

- `end` (double, optional)
- `start` (double, optional)

### V2ServiceKeyGetResponsesContentApplicationJsonSchemaDataOneOf4ProductDto

- `adminLocked` (boolean, optional)
- `aggregationId` (any, optional, nullable)
- `associatedIxs` (list of any, optional)
- `associatedVxcs` (list of V2ServiceKeyGetResponsesContentApplicationJsonSchemaDataOneOf4ProductDtoAssociatedVxcsItems, optional)
- `attributeTags` (V2ServiceKeyGetResponsesContentApplicationJsonSchemaDataOneOf4ProductDtoAttributeTags, optional)
- `buyoutPort` (boolean, optional)
- `cancelable` (boolean, optional)
- `companyName` (string, optional)
- `companyUid` (string, optional)
- `contractEndDate` (double, optional)
- `contractStartDate` (double, optional)
- `contractTermMonths` (double, optional)
- `costCentre` (string, optional)
- `createDate` (double, optional)
- `createdBy` (string, optional)
- `lagId` (any, optional, nullable)
- `lagPrimary` (boolean, optional)
- `liveDate` (double, optional)
- `locationId` (double, optional)
- `locked` (boolean, optional)
- `market` (string, optional)
- `marketplaceVisibility` (boolean, optional)
- `portSpeed` (double, optional)
- `productId` (double, optional)
- `productName` (string, optional)
- `productType` (string, optional)
- `productUid` (string, optional)
- `provisioningStatus` (string, optional)
- `secondaryName` (any, optional, nullable)
- `terminateDate` (any, optional, nullable)
- `usageAlgorithm` (string, optional)
- `virtual` (boolean, optional)
- `vxcAutoApproval` (boolean, optional)
- `vxcpermitted` (boolean, optional)

### V2ServiceKeyGetResponsesContentApplicationJsonSchemaDataOneOf4ValidFor

- `end` (double, optional)
- `start` (double, optional)

### V2ServiceKeyGetResponsesContentApplicationJsonSchemaDataOneOf5ProductDto

- `adminLocked` (boolean, optional)
- `aggregationId` (any, optional, nullable)
- `associatedIxs` (list of any, optional)
- `associatedVxcs` (list of V2ServiceKeyGetResponsesContentApplicationJsonSchemaDataOneOf5ProductDtoAssociatedVxcsItems, optional)
- `attributeTags` (V2ServiceKeyGetResponsesContentApplicationJsonSchemaDataOneOf5ProductDtoAttributeTags, optional)
- `buyoutPort` (boolean, optional)
- `cancelable` (boolean, optional)
- `companyName` (string, optional)
- `companyUid` (string, optional)
- `contractEndDate` (double, optional)
- `contractStartDate` (double, optional)
- `contractTermMonths` (double, optional)
- `costCentre` (string, optional)
- `createDate` (double, optional)
- `createdBy` (string, optional)
- `lagId` (any, optional, nullable)
- `lagPrimary` (boolean, optional)
- `liveDate` (double, optional)
- `locationId` (double, optional)
- `locked` (boolean, optional)
- `market` (string, optional)
- `marketplaceVisibility` (boolean, optional)
- `portSpeed` (double, optional)
- `productId` (double, optional)
- `productName` (string, optional)
- `productType` (string, optional)
- `productUid` (string, optional)
- `provisioningStatus` (string, optional)
- `secondaryName` (any, optional, nullable)
- `terminateDate` (any, optional, nullable)
- `usageAlgorithm` (string, optional)
- `virtual` (boolean, optional)
- `vxcAutoApproval` (boolean, optional)
- `vxcpermitted` (boolean, optional)

### V2ServiceKeyGetResponsesContentApplicationJsonSchemaDataOneOf5ValidFor

- `end` (double, optional)
- `start` (double, optional)

### V2ServiceKeyGetResponsesContentApplicationJsonSchemaDataOneOf4ProductDtoAssociatedVxcsItems

- `aEnd` (V2ServiceKeyGetResponsesContentApplicationJsonSchemaDataOneOf4ProductDtoAssociatedVxcsItemsAEnd, optional)
- `adminLocked` (boolean, optional)
- `attributeTags` (V2ServiceKeyGetResponsesContentApplicationJsonSchemaDataOneOf4ProductDtoAssociatedVxcsItemsAttributeTags, optional)
- `bEnd` (V2ServiceKeyGetResponsesContentApplicationJsonSchemaDataOneOf4ProductDtoAssociatedVxcsItemsBEnd, optional)
- `cancelable` (boolean, optional)
- `contractEndDate` (any, optional, nullable)
- `contractStartDate` (any, optional, nullable)
- `contractTermMonths` (double, optional)
- `createDate` (double, optional)
- `createdBy` (any, optional, nullable)
- `distanceBand` (string, optional)
- `locked` (boolean, optional)
- `nServiceId` (any, optional, nullable)
- `productName` (string, optional)
- `productType` (string, optional)
- `productUid` (string, optional)
- `provisioningStatus` (string, optional)
- `rateLimit` (double, optional)
- `secondaryName` (string, optional, nullable)
- `terminateDate` (double, optional)
- `usageAlgorithm` (string, optional)
- `vxcApproval` (V2ServiceKeyGetResponsesContentApplicationJsonSchemaDataOneOf4ProductDtoAssociatedVxcsItemsVxcApproval, optional)

### V2ServiceKeyGetResponsesContentApplicationJsonSchemaDataOneOf4ProductDtoAttributeTags

### V2ServiceKeyGetResponsesContentApplicationJsonSchemaDataOneOf5ProductDtoAssociatedVxcsItems

- `aEnd` (V2ServiceKeyGetResponsesContentApplicationJsonSchemaDataOneOf5ProductDtoAssociatedVxcsItemsAEnd, optional)
- `adminLocked` (boolean, optional)
- `attributeTags` (V2ServiceKeyGetResponsesContentApplicationJsonSchemaDataOneOf5ProductDtoAssociatedVxcsItemsAttributeTags, optional)
- `bEnd` (V2ServiceKeyGetResponsesContentApplicationJsonSchemaDataOneOf5ProductDtoAssociatedVxcsItemsBEnd, optional)
- `cancelable` (boolean, optional)
- `contractEndDate` (any, optional, nullable)
- `contractStartDate` (any, optional, nullable)
- `contractTermMonths` (double, optional)
- `createDate` (double, optional)
- `createdBy` (any, optional, nullable)
- `distanceBand` (string, optional)
- `locked` (boolean, optional)
- `nServiceId` (any, optional, nullable)
- `productName` (string, optional)
- `productType` (string, optional)
- `productUid` (string, optional)
- `provisioningStatus` (string, optional)
- `rateLimit` (double, optional)
- `secondaryName` (string, optional, nullable)
- `terminateDate` (double, optional)
- `usageAlgorithm` (string, optional)
- `vxcApproval` (V2ServiceKeyGetResponsesContentApplicationJsonSchemaDataOneOf5ProductDtoAssociatedVxcsItemsVxcApproval, optional)

### V2ServiceKeyGetResponsesContentApplicationJsonSchemaDataOneOf5ProductDtoAttributeTags

### V2ServiceKeyGetResponsesContentApplicationJsonSchemaDataOneOf4ProductDtoAssociatedVxcsItemsAEnd

- `innerVlan` (any, optional, nullable)
- `location` (string, optional, nullable)
- `locationId` (double, optional, nullable)
- `ownerUid` (string, optional)
- `productName` (string, optional)
- `productUid` (string, optional)
- `secondaryName` (any, optional, nullable)
- `vlan` (double, optional, nullable)

### V2ServiceKeyGetResponsesContentApplicationJsonSchemaDataOneOf4ProductDtoAssociatedVxcsItemsAttributeTags

### V2ServiceKeyGetResponsesContentApplicationJsonSchemaDataOneOf4ProductDtoAssociatedVxcsItemsBEnd

- `innerVlan` (any, optional, nullable)
- `location` (string, optional, nullable)
- `locationId` (double, optional, nullable)
- `ownerUid` (string, optional)
- `productName` (string, optional)
- `productUid` (string, optional)
- `secondaryName` (any, optional, nullable)
- `vlan` (double, optional, nullable)

### V2ServiceKeyGetResponsesContentApplicationJsonSchemaDataOneOf4ProductDtoAssociatedVxcsItemsVxcApproval

- `message` (any, optional, nullable)
- `newSpeed` (any, optional, nullable)
- `status` (any, optional, nullable)
- `type` (any, optional, nullable)
- `uid` (any, optional, nullable)

### V2ServiceKeyGetResponsesContentApplicationJsonSchemaDataOneOf5ProductDtoAssociatedVxcsItemsAEnd

- `innerVlan` (any, optional, nullable)
- `location` (string, optional, nullable)
- `locationId` (double, optional, nullable)
- `ownerUid` (string, optional)
- `productName` (string, optional)
- `productUid` (string, optional)
- `secondaryName` (any, optional, nullable)
- `vlan` (double, optional, nullable)

### V2ServiceKeyGetResponsesContentApplicationJsonSchemaDataOneOf5ProductDtoAssociatedVxcsItemsAttributeTags

### V2ServiceKeyGetResponsesContentApplicationJsonSchemaDataOneOf5ProductDtoAssociatedVxcsItemsBEnd

- `innerVlan` (any, optional, nullable)
- `location` (string, optional, nullable)
- `locationId` (double, optional, nullable)
- `ownerUid` (string, optional)
- `productName` (string, optional)
- `productUid` (string, optional)
- `secondaryName` (any, optional, nullable)
- `vlan` (double, optional, nullable)

### V2ServiceKeyGetResponsesContentApplicationJsonSchemaDataOneOf5ProductDtoAssociatedVxcsItemsVxcApproval

- `message` (any, optional, nullable)
- `newSpeed` (any, optional, nullable)
- `status` (any, optional, nullable)
- `type` (any, optional, nullable)
- `uid` (any, optional, nullable)

## Examples

### List Service Keys

**Response**

```json
{
  "data": [
    {
      "active": true,
      "bEnd": {},
      "companyId": 1153,
      "companyName": "Megaport Lab",
      "companyUid": "160208ae-01e4-4cb9-8d57-03a197bd47a8",
      "createDate": 1738027647205,
      "description": "SK1",
      "expired": false,
      "key": "29ff7f32-c19a-4ced-b4e1-4f796b213b6f",
      "lastUsed": null,
      "maxSpeed": 10000,
      "preApproved": true,
      "productId": 226855,
      "productName": "Example Port",
      "productUid": "73b2a452-9f93-4c45-afa0-887cf7f17e89",
      "singleUse": false,
      "valid": true,
      "validFor": {
        "end": 1740619635209,
        "start": 1738027646696
      },
      "vlan": null
    },
    {
      "active": true,
      "bEnd": {},
      "companyId": 1153,
      "companyName": "Megaport Lab",
      "companyUid": "160208ae-01e4-4cb9-8d57-03a197bd47a8",
      "createDate": 1738027665841,
      "description": "SK2",
      "expired": false,
      "key": "63fcde5c-c87c-478d-bb11-63cbc9541c89",
      "lastUsed": null,
      "maxSpeed": 10000,
      "preApproved": true,
      "productId": 226855,
      "productName": "Example Port",
      "productUid": "73b2a452-9f93-4c45-afa0-887cf7f17e89",
      "singleUse": true,
      "valid": true,
      "validFor": {
        "end": 1740619649920,
        "start": 1738027665336
      },
      "vlan": 90
    },
    {
      "active": false,
      "bEnd": {},
      "companyId": 1153,
      "companyName": "Megaport Lab",
      "companyUid": "160208ae-01e4-4cb9-8d57-03a197bd47a8",
      "createDate": 1738027681118,
      "description": "SK3",
      "expired": false,
      "key": "593a32f0-42cc-419c-94a8-de2057937162",
      "lastUsed": null,
      "maxSpeed": 10000,
      "preApproved": true,
      "productId": 226855,
      "productName": "Example Port",
      "productUid": "73b2a452-9f93-4c45-afa0-887cf7f17e89",
      "singleUse": false,
      "valid": false,
      "validFor": {
        "end": 1740619668495,
        "start": 1738027680699
      },
      "vlan": null
    }
  ],
  "message": "Found [3] service keys for product [73b2a452-9f93-4c45-afa0-887cf7f17e89]",
  "terms": "This data is subject to the Acceptable Use Policy https://www.megaport.com/legal/acceptable-use-policy"
}
```

**SDK Code**

```python List Service Keys
import requests

url = "https://api.megaport.com/v2/service/key"

response = requests.get(url)

print(response.json())
```

```javascript List Service Keys
const url = 'https://api.megaport.com/v2/service/key';
const options = {method: 'GET'};

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

```go List Service Keys
package main

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

func main() {

	url := "https://api.megaport.com/v2/service/key"

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

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

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

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

}
```

```ruby List Service Keys
require 'uri'
require 'net/http'

url = URI("https://api.megaport.com/v2/service/key")

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

request = Net::HTTP::Get.new(url)

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

```java List Service Keys
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://api.megaport.com/v2/service/key")
  .asString();
```

```php List Service Keys
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.megaport.com/v2/service/key');

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

```csharp List Service Keys
using RestSharp;

var client = new RestClient("https://api.megaport.com/v2/service/key");
var request = new RestRequest(Method.GET);
IRestResponse response = client.Execute(request);
```

```swift List Service Keys
import Foundation

let request = NSMutableURLRequest(url: NSURL(string: "https://api.megaport.com/v2/service/key")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"

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

### List Service Keys - Specified Key

**Response**

```json
{
  "data": [
    {
      "active": true,
      "bEnd": {},
      "companyId": 1153,
      "companyName": "Megaport Lab",
      "companyUid": "160208ae-01e4-4cb9-8d57-03a197bd47a8",
      "createDate": 1738027647205,
      "description": "SK1",
      "expired": false,
      "key": "29ff7f32-c19a-4ced-b4e1-4f796b213b6f",
      "lastUsed": null,
      "maxSpeed": 10000,
      "preApproved": true,
      "productId": 226855,
      "productName": "Example Port",
      "productUid": "73b2a452-9f93-4c45-afa0-887cf7f17e89",
      "singleUse": false,
      "valid": true,
      "validFor": {
        "end": 1740619635209,
        "start": 1738027646696
      },
      "vlan": null,
      "productDto": {
        "companyName": "Megaport Lab",
        "companyUid": "160208ae-01e4-4cb9-8d57-03a197bd47a8",
        "connectType": "DEFAULT",
        "diversityZone": "blue",
        "locationId": 68,
        "portSpeed": 10000,
        "productName": "Example Port",
        "productUid": "73b2a452-9f93-4c45-afa0-887cf7f17e89",
        "vxcPermitted": true
      }
    }
  ],
  "message": "Found service key [29ff7f32-c19a-4ced-b4e1-4f796b213b6f]",
  "terms": "This data is subject to the Acceptable Use Policy https://www.megaport.com/legal/acceptable-use-policy"
}
```

**SDK Code**

```python List Service Keys - Specified Key
import requests

url = "https://api.megaport.com/v2/service/key"

response = requests.get(url)

print(response.json())
```

```javascript List Service Keys - Specified Key
const url = 'https://api.megaport.com/v2/service/key';
const options = {method: 'GET'};

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

```go List Service Keys - Specified Key
package main

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

func main() {

	url := "https://api.megaport.com/v2/service/key"

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

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

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

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

}
```

```ruby List Service Keys - Specified Key
require 'uri'
require 'net/http'

url = URI("https://api.megaport.com/v2/service/key")

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

request = Net::HTTP::Get.new(url)

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

```java List Service Keys - Specified Key
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://api.megaport.com/v2/service/key")
  .asString();
```

```php List Service Keys - Specified Key
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.megaport.com/v2/service/key');

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

```csharp List Service Keys - Specified Key
using RestSharp;

var client = new RestClient("https://api.megaport.com/v2/service/key");
var request = new RestRequest(Method.GET);
IRestResponse response = client.Execute(request);
```

```swift List Service Keys - Specified Key
import Foundation

let request = NSMutableURLRequest(url: NSURL(string: "https://api.megaport.com/v2/service/key")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"

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

### Look Up SAP Service Key

**Response**

```json
{
  "data": [
    {
      "active": true,
      "companyId": 9787,
      "companyName": "SAP SE",
      "companyUid": "7769fd21-9ac5-41ed-aed4-bb4615f1cbe0",
      "createDate": 1600672159914,
      "description": "1111067271-PEV-Sec",
      "expired": false,
      "key": "d2d7fd14-377e-4281-ad22-6b0dfdbae9e5",
      "lastUsed": null,
      "maxSpeed": 100,
      "preApproved": true,
      "productId": 39950,
      "productName": "SAP Cloud Peering for HEC - vXchnge Santa Clara (2/2)",
      "productUid": "9b5f94e9-1c3f-4398-804d-ab4939e53f37",
      "singleUse": true,
      "valid": true,
      "validFor": {
        "end": 1634754600000,
        "start": 1600672158181
      },
      "vlan": 373,
      "productDto": {
        "adminLocked": false,
        "aggregationId": null,
        "associatedIxs": [],
        "associatedVxcs": [
          {
            "aEnd": {
              "innerVlan": null,
              "location": null,
              "locationId": null,
              "ownerUid": "890cb60c-9962-45bb-8849-ba83da4a2a29",
              "productName": "KSF_TO_DIGITALREALITY_SRF2_CKT2-10G",
              "productUid": "e5a6f36c-17c0-4197-974b-1cff840e413c",
              "secondaryName": null,
              "vlan": null
            },
            "adminLocked": false,
            "attributeTags": {},
            "bEnd": {
              "innerVlan": null,
              "location": null,
              "locationId": null,
              "ownerUid": "7769fd21-9ac5-41ed-aed4-bb4615f1cbe0",
              "productName": "SAP Cloud Peering for HEC - vXchnge Santa Clara (2/2)",
              "productUid": "9b5f94e9-1c3f-4398-804d-ab4939e53f37",
              "secondaryName": null,
              "vlan": null
            },
            "cancelable": true,
            "contractEndDate": null,
            "contractStartDate": null,
            "contractTermMonths": 1,
            "createDate": 1570211510624,
            "createdBy": null,
            "distanceBand": "METRO",
            "locked": false,
            "nServiceId": null,
            "productName": "MP_KSF_TO_DIGITALREALITY_SRF2_CKT2-10G_TO_SAP_CLOUD_SAB_VIA_MA12",
            "productType": "VXC",
            "productUid": "44e8f7b2-7f81-46a2-b81a-e7cc143d61b6",
            "provisioningStatus": "DECOMMISSIONED",
            "rateLimit": 200,
            "secondaryName": null,
            "terminateDate": 1605262623926,
            "usageAlgorithm": "POST_PAID_HOURLY_SPEED_METRO_VXC",
            "vxcApproval": {
              "message": null,
              "newSpeed": null,
              "status": null,
              "type": null,
              "uid": null
            }
          },
          {
            "aEnd": {
              "innerVlan": null,
              "location": null,
              "locationId": null,
              "ownerUid": "160208ae-01e4-4cb9-8d57-03a197bd47a8",
              "productName": "PMG ServiceKey Port Keep",
              "productUid": "afc19261-c488-4aa6-9657-d398ffb2906d",
              "secondaryName": null,
              "vlan": null
            },
            "adminLocked": false,
            "attributeTags": {},
            "bEnd": {
              "innerVlan": null,
              "location": null,
              "locationId": null,
              "ownerUid": "7769fd21-9ac5-41ed-aed4-bb4615f1cbe0",
              "productName": "SAP Cloud Peering for HEC - vXchnge Santa Clara (2/2)",
              "productUid": "9b5f94e9-1c3f-4398-804d-ab4939e53f37",
              "secondaryName": null,
              "vlan": null
            },
            "cancelable": true,
            "contractEndDate": null,
            "contractStartDate": null,
            "contractTermMonths": 1,
            "createDate": 1567577309733,
            "createdBy": null,
            "distanceBand": "INTERZONE",
            "locked": false,
            "nServiceId": null,
            "productName": "Secondary SK 13b1a273",
            "productType": "VXC",
            "productUid": "17ab577e-926d-4ff5-ae68-cf8548358cde",
            "provisioningStatus": "DECOMMISSIONED",
            "rateLimit": 100,
            "secondaryName": "Secondary SK 13b1a273",
            "terminateDate": 1568042808649,
            "usageAlgorithm": "POST_PAID_HOURLY_SPEED_LONG_HAUL_VXC",
            "vxcApproval": {
              "message": null,
              "newSpeed": null,
              "status": null,
              "type": null,
              "uid": null
            }
          },
          {
            "aEnd": {
              "innerVlan": null,
              "location": null,
              "locationId": null,
              "ownerUid": "160208ae-01e4-4cb9-8d57-03a197bd47a8",
              "productName": "SAP test Port2",
              "productUid": "84264dbf-47c9-4780-8453-bee06149724e",
              "secondaryName": null,
              "vlan": null
            },
            "adminLocked": false,
            "attributeTags": {},
            "bEnd": {
              "innerVlan": null,
              "location": null,
              "locationId": null,
              "ownerUid": "7769fd21-9ac5-41ed-aed4-bb4615f1cbe0",
              "productName": "SAP Cloud Peering for HEC - vXchnge Santa Clara (2/2)",
              "productUid": "9b5f94e9-1c3f-4398-804d-ab4939e53f37",
              "secondaryName": null,
              "vlan": null
            },
            "cancelable": true,
            "contractEndDate": null,
            "contractStartDate": null,
            "contractTermMonths": 1,
            "createDate": 1567064730658,
            "createdBy": null,
            "distanceBand": "INTERZONE",
            "locked": false,
            "nServiceId": null,
            "productName": "Sec VXC 2",
            "productType": "VXC",
            "productUid": "f0451a35-baba-452a-ac19-f5b516a04449",
            "provisioningStatus": "DECOMMISSIONED",
            "rateLimit": 200,
            "secondaryName": null,
            "terminateDate": 1567067935268,
            "usageAlgorithm": "POST_PAID_HOURLY_SPEED_LONG_HAUL_VXC",
            "vxcApproval": {
              "message": null,
              "newSpeed": null,
              "status": null,
              "type": null,
              "uid": null
            }
          },
          {
            "aEnd": {
              "innerVlan": null,
              "location": null,
              "locationId": null,
              "ownerUid": "160208ae-01e4-4cb9-8d57-03a197bd47a8",
              "productName": "Austin",
              "productUid": "b3bc242d-c7aa-4a21-a64c-773d3db3f6b6",
              "secondaryName": null,
              "vlan": null
            },
            "adminLocked": false,
            "attributeTags": {},
            "bEnd": {
              "innerVlan": null,
              "location": null,
              "locationId": null,
              "ownerUid": "7769fd21-9ac5-41ed-aed4-bb4615f1cbe0",
              "productName": "SAP Cloud Peering for HEC - vXchnge Santa Clara (2/2)",
              "productUid": "9b5f94e9-1c3f-4398-804d-ab4939e53f37",
              "secondaryName": null,
              "vlan": null
            },
            "cancelable": true,
            "contractEndDate": null,
            "contractStartDate": null,
            "contractTermMonths": 1,
            "createDate": 1568155659053,
            "createdBy": null,
            "distanceBand": "INTERZONE",
            "locked": false,
            "nServiceId": null,
            "productName": "Test",
            "productType": "VXC",
            "productUid": "0edd4750-20c7-4d09-931c-aa1a3036f8eb",
            "provisioningStatus": "DECOMMISSIONED",
            "rateLimit": 100,
            "secondaryName": null,
            "terminateDate": 1568187172103,
            "usageAlgorithm": "POST_PAID_HOURLY_SPEED_LONG_HAUL_VXC",
            "vxcApproval": {
              "message": null,
              "newSpeed": null,
              "status": null,
              "type": null,
              "uid": null
            }
          },
          {
            "aEnd": {
              "innerVlan": null,
              "location": "Equinix SV1",
              "locationId": 66,
              "ownerUid": "890cb60c-9962-45bb-8849-ba83da4a2a29",
              "productName": "BDY_TO_EQUINIX_SV1_CKT2-10G",
              "productUid": "66cf7eb9-a4a9-4212-8fde-10b8d0119272",
              "secondaryName": null,
              "vlan": 452
            },
            "adminLocked": false,
            "attributeTags": {},
            "bEnd": {
              "innerVlan": null,
              "location": "vXchnge Santa Clara",
              "locationId": 354,
              "ownerUid": "7769fd21-9ac5-41ed-aed4-bb4615f1cbe0",
              "productName": "SAP Cloud Peering for HEC - vXchnge Santa Clara (2/2)",
              "productUid": "9b5f94e9-1c3f-4398-804d-ab4939e53f37",
              "secondaryName": null,
              "vlan": 375
            },
            "cancelable": true,
            "contractEndDate": null,
            "contractStartDate": null,
            "contractTermMonths": 1,
            "createDate": 1601917756466,
            "createdBy": null,
            "distanceBand": "METRO",
            "locked": false,
            "nServiceId": null,
            "productName": "BDY_TO_EQUINIX_SV1_CKT1-10G_TO_SAP_CLOUD_SAB_VIA_RBDY00CR02",
            "productType": "VXC",
            "productUid": "29d5d526-f1d3-4b5c-8fc1-3b89305ddfa1",
            "provisioningStatus": "LIVE",
            "rateLimit": 200,
            "secondaryName": null,
            "usageAlgorithm": "POST_PAID_HOURLY_SPEED_METRO_VXC",
            "vxcApproval": {
              "message": null,
              "newSpeed": null,
              "status": null,
              "type": null,
              "uid": null
            }
          }
        ],
        "attributeTags": {},
        "buyoutPort": false,
        "cancelable": false,
        "companyName": "SAP SE",
        "companyUid": "7769fd21-9ac5-41ed-aed4-bb4615f1cbe0",
        "contractEndDate": 1567785900635,
        "contractStartDate": 1565107500635,
        "contractTermMonths": 1,
        "costCentre": "PO 2300317225",
        "createDate": 1563847359519,
        "createdBy": "c7367724-182c-48ce-b808-9083e4ffdc31",
        "lagId": null,
        "lagPrimary": false,
        "liveDate": 1566227706969,
        "locationId": 354,
        "locked": true,
        "market": "US",
        "marketplaceVisibility": true,
        "portSpeed": 10000,
        "productId": 39950,
        "productName": "SAP Cloud Peering for HEC - vXchnge Santa Clara (2/2)",
        "productType": "MEGAPORT",
        "productUid": "9b5f94e9-1c3f-4398-804d-ab4939e53f37",
        "provisioningStatus": "LIVE",
        "secondaryName": null,
        "terminateDate": null,
        "usageAlgorithm": "NOT_POST_PAID",
        "virtual": false,
        "vxcAutoApproval": false,
        "vxcpermitted": true
      },
      "promoCode": {}
    }
  ],
  "message": "Found service key [d2d7fd14]",
  "terms": "This data is subject to the Acceptable Use Policy https://www.megaport.com/legal/acceptable-use-policy"
}
```

**SDK Code**

```python Look Up SAP Service Key
import requests

url = "https://api.megaport.com/v2/service/key"

response = requests.get(url)

print(response.json())
```

```javascript Look Up SAP Service Key
const url = 'https://api.megaport.com/v2/service/key';
const options = {method: 'GET'};

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

```go Look Up SAP Service Key
package main

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

func main() {

	url := "https://api.megaport.com/v2/service/key"

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

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

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

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

}
```

```ruby Look Up SAP Service Key
require 'uri'
require 'net/http'

url = URI("https://api.megaport.com/v2/service/key")

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

request = Net::HTTP::Get.new(url)

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

```java Look Up SAP Service Key
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://api.megaport.com/v2/service/key")
  .asString();
```

```php Look Up SAP Service Key
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.megaport.com/v2/service/key');

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

```csharp Look Up SAP Service Key
using RestSharp;

var client = new RestClient("https://api.megaport.com/v2/service/key");
var request = new RestRequest(Method.GET);
IRestResponse response = client.Execute(request);
```

```swift Look Up SAP Service Key
import Foundation

let request = NSMutableURLRequest(url: NSURL(string: "https://api.megaport.com/v2/service/key")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"

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