Skip to content

Command Reference

Complete reference for all Megaport CLI commands, subcommands, and flags — generated from CLI source

Every command, subcommand, and flag in the Megaport CLI. For input modes (interactive, flags, JSON), see Input Modes. For output formats, see Output Formats.

Jump to: Global Flags | Authentication | Ports | VXC | MCR | MVE | IX | Locations | Partners | Service Keys | Config | Status


Global Flags

These flags are available on every command.

FlagShortDefaultDescription
--output-otableOutput format: table, json, csv, xml
--envEnvironment: production, staging, development
--profileUse a specific config profile for this command
--verbose-vfalseShow additional debug information
--quiet-qfalseSuppress informational output — show only data and errors
--no-colorfalseDisable colorful output
--timeout90sRequest timeout (e.g., 30s, 2m)
--fieldsComma-separated list of fields to include in output
--queryJMESPath query to filter JSON output (requires -o json)
--no-retryfalseDisable automatic retry on transient API failures
--max-retries3Maximum number of retries for transient failures

Authentication

Credentials are resolved in this order (highest priority first):

  1. CLI flags (--env + profile credentials)
  2. Environment variables: MEGAPORT_ACCESS_KEY, MEGAPORT_SECRET_KEY, MEGAPORT_ENVIRONMENT
  3. Active config profile
  4. Default values set via config set-default

See Config Profiles for profile management.


Apply

Provision multiple resources from a declarative YAML or JSON config file. Resources are provisioned sequentially in dependency order: ports and MCRs first, then MVEs, then VXCs. VXC endpoints can reference previously provisioned resources using template syntax like {{.port.MyPort}}.

apply

bash
megaport-cli apply -f infrastructure.yaml
megaport-cli apply -f infrastructure.yaml --dry-run
megaport-cli apply -f infrastructure.yaml --yes
FlagShortDefaultDescriptionRequired
--file-fPath to config file (YAML or JSON)Yes
--dry-runfalseValidate all orders without provisioningNo
--yes-yfalseSkip confirmation promptNo

Ports

Manage physical ports. Most subcommands take a portUID positional argument.

ports list

List all ports with optional filters. By default, only active ports are shown.

bash
megaport-cli ports list
megaport-cli ports list --location-id 1 --port-speed 10000
megaport-cli ports list --port-name "Data Center Primary"
megaport-cli ports list --include-inactive
FlagDefaultDescription
--location-id0Filter by location ID
--port-speed0Filter by port speed
--port-nameFilter by port name
--include-inactivefalseInclude CANCELLED/DECOMMISSIONED ports
--limit0Max results (0 = unlimited)

ports get <portUID>

Get full port details.

bash
megaport-cli ports get port-abc123
megaport-cli ports get port-abc123 --export
FlagDefaultDescription
--exportfalseOutput recreatable JSON config for use with buy --json
--watchfalseMonitor status in real-time (auto-refresh)
--interval5sRefresh interval when using --watch

ports status <portUID>

Lightweight status check — shows only provisioning status without all details.

bash
megaport-cli ports status port-abc123
megaport-cli ports status port-abc123 --watch
FlagDefaultDescription
--watchfalseMonitor status in real-time
--interval5sRefresh interval when using --watch

ports buy

Provision a new port.

bash
megaport-cli ports buy --interactive
megaport-cli ports buy --name "My Port" --term 12 --port-speed 10000 --location-id 123 --marketplace-visibility true
megaport-cli ports buy --json '{"name":"My Port","term":12,"portSpeed":10000,"locationId":123,"marketPlaceVisibility":true}'
megaport-cli ports buy --json-file ./port-config.json
FlagShortDefaultDescriptionRequired
--namePort name (1-64 chars)Yes
--term0Contract term: 1, 12, 24, or 36 monthsYes
--port-speed0Speed: 1000, 10000, or 100000 MbpsYes
--location-id0Location IDYes
--marketplace-visibilityfalseVisible in marketplaceYes
--cost-centreCost centre for billingNo
--diversity-zoneDiversity zoneNo
--promo-codePromotional codeNo
--resource-tagsTags as JSON stringNo
--resource-tags-filePath to tags JSON fileNo
--interactive-ifalseInteractive modeNo
--jsonJSON config stringNo
--json-filePath to JSON config fileNo
--no-waitfalseDon't wait for provisioningNo
--yes-yfalseSkip confirmationNo
JSON Formatjson
{
  "name": "My Port",
  "term": 12,
  "portSpeed": 10000,
  "locationId": 123,
  "marketPlaceVisibility": true,
  "diversityZone": "blue",
  "costCentre": "IT-2023",
  "resourceTags": {
    "environment": "production",
    "department": "networking"
  }
}

ports buy-lag

Provision a LAG (Link Aggregation Group) port. LAG ports only support 1, 12, or 24 month terms (not 36).

bash
megaport-cli ports buy-lag --interactive
megaport-cli ports buy-lag --name "My LAG" --term 12 --port-speed 10000 --location-id 123 --lag-count 2 --marketplace-visibility true
FlagShortDefaultDescriptionRequired
--namePort name (1-64 chars)Yes
--term0Contract term: 1, 12, or 24 monthsYes
--port-speed0Speed: 10000 or 100000 MbpsYes
--location-id0Location IDYes
--lag-count0Number of LAG members (1-8)Yes
--marketplace-visibilityfalseVisible in marketplaceYes
--cost-centreCost centreNo
--diversity-zoneDiversity zoneNo
--promo-codePromotional codeNo
--resource-tagsTags as JSON stringNo
--resource-tags-filePath to tags JSON fileNo
--interactive-ifalseInteractive modeNo
--jsonJSON config stringNo
--json-filePath to JSON config fileNo
--no-waitfalseDon't wait for provisioningNo
--yes-yfalseSkip confirmationNo

ports validate

Validate a port buy config without provisioning. Same flags as ports buy.

bash
megaport-cli ports validate --name "My Port" --term 12 --port-speed 10000 --location-id 123 --marketplace-visibility true
megaport-cli ports validate --json-file ./port-config.json

ports validate-lag

Validate a LAG port config without provisioning. Same flags as ports buy-lag.

ports update <portUID>

Update port settings.

bash
megaport-cli ports update port-xxx --interactive
megaport-cli ports update port-xxx --name "Updated Port" --marketplace-visibility true --cost-centre "Finance"
megaport-cli ports update port-xxx --json '{"name":"Updated Port","marketplaceVisibility":true}'
FlagShortDefaultDescription
--nameNew port name
--term0New term (1, 12, 24, or 36 months)
--marketplace-visibilityfalseMarketplace visibility
--cost-centreCost centre
--interactive-ifalseInteractive mode
--jsonJSON config string
--json-filePath to JSON config file

ports delete <portUID>

Delete a port. By default scheduled for end of billing period.

bash
megaport-cli ports delete port-xxx
megaport-cli ports delete port-xxx --now
megaport-cli ports delete port-xxx --now --force
FlagShortDefaultDescription
--force-ffalseSkip confirmation
--nowfalseDelete immediately instead of end of billing cycle
--safe-deletefalseFail if port has attached VXCs

Note: All VXCs must be deleted before the port can be deleted. You can restore a deleted port before it's fully decommissioned.

ports restore <portUID>

Restore a port in DECOMMISSIONING state. Once fully decommissioned, restoration is not possible.

bash
megaport-cli ports restore port-xxx

ports lock <portUID>

Lock a port to prevent accidental deletion.

ports unlock <portUID>

Unlock a locked port.

ports check-vlan <portUID> <vlan>

Check if a VLAN is available on a port.

bash
megaport-cli ports check-vlan port-xxx 100

ports list-tags <portUID>

List all resource tags on a port.

ports update-tags <portUID>

Add or update resource tags on a port.


VXC

Manage Virtual Cross Connects — point-to-point connections between two ports or devices on the Megaport network.

vxc list

List all VXCs with optional filters.

bash
megaport-cli vxc list
megaport-cli vxc list --name "My VXC"
megaport-cli vxc list --a-end-uid port-abc123
megaport-cli vxc list --status LIVE,CONFIGURED
megaport-cli vxc list --include-inactive
FlagDefaultDescription
--nameFilter by name (partial match)
--name-containsFilter by partial name (server-side)
--a-end-uidFilter by A-End UID
--b-end-uidFilter by B-End UID
--rate-limit0Filter by rate limit (Mbps)
--statusFilter by status (comma-separated, e.g. LIVE,CONFIGURED)
--include-inactivefalseInclude inactive VXCs
--limit0Max results (0 = unlimited)

vxc get <vxcUID>

Get full VXC details.

bash
megaport-cli vxc get vxc-xxx
megaport-cli vxc get vxc-xxx --export
FlagDefaultDescription
--exportfalseOutput recreatable JSON config (partner configs not available from API)
--watchfalseMonitor status in real-time (auto-refresh)
--interval5sRefresh interval when using --watch

vxc status <vxcUID>

Lightweight status check for a VXC.

FlagDefaultDescription
--watchfalseMonitor status in real-time
--interval5sRefresh interval when using --watch

vxc buy

Provision a new VXC.

bash
megaport-cli vxc buy --interactive
megaport-cli vxc buy --name "My VXC" --rate-limit 1000 --term 12 --a-end-uid port-123 --b-end-uid port-456 --a-end-vlan 100 --b-end-vlan 200
megaport-cli vxc buy --json-file ./vxc-config.json
FlagShortDefaultDescriptionRequired
--nameVXC nameYes
--rate-limit0Bandwidth in MbpsYes
--term0Contract term: 1, 12, 24, or 36 monthsYes
--a-end-uidA-End product UIDYes
--a-end-vlan0A-End VLAN (0-4093, except 1)Yes
--b-end-uidB-End product UIDYes
--b-end-vlan0B-End VLAN (0-4093, except 1)Yes
--a-end-inner-vlan0A-End inner VLAN (QinQ)No
--b-end-inner-vlan0B-End inner VLAN (QinQ)No
--a-end-vnic-index0A-End vNIC index (MVE)No
--b-end-vnic-index0B-End vNIC index (MVE)No
--a-end-partner-configA-End partner config JSONNo
--b-end-partner-configB-End partner config JSONNo
--cost-centreCost centreNo
--service-keyService keyNo
--promo-codePromotional codeNo
--resource-tagsTags as JSON stringNo
--resource-tags-filePath to tags JSON fileNo
--interactive-ifalseInteractive modeNo
--jsonJSON config stringNo
--json-filePath to JSON config fileNo
--no-waitfalseDon't wait for provisioningNo
--yes-yfalseSkip confirmationNo
JSON Formatjson
{
  "vxcName": "My VXC",
  "rateLimit": 1000,
  "term": 12,
  "portUid": "port-123",
  "aEndConfiguration": { "vlan": 100 },
  "bEndConfiguration": { "productUID": "port-456", "vlan": 200 },
  "costCentre": "IT Department",
  "resourceTags": { "environment": "production" }
}

vxc validate

Validate a VXC order without purchasing. Same flags as vxc buy.

bash
megaport-cli vxc validate --name "My VXC" --rate-limit 1000 --term 12 --a-end-uid port-123 --b-end-uid port-456 --a-end-vlan 100 --b-end-vlan 200

vxc update <vxcUID>

Update an existing VXC.

bash
megaport-cli vxc update vxc-xxx --interactive
megaport-cli vxc update vxc-xxx --name "New Name" --rate-limit 2000
megaport-cli vxc update vxc-xxx --a-end-vlan 200 --b-end-vlan 300
megaport-cli vxc update vxc-xxx --shutdown
FlagDefaultDescription
--nameNew VXC name
--rate-limit0New bandwidth (Mbps)
--term0New term (1, 12, 24, or 36 months)
--a-end-vlan0New A-End VLAN
--b-end-vlan0New B-End VLAN
--a-end-inner-vlan0New A-End inner VLAN
--b-end-inner-vlan0New B-End inner VLAN
--a-end-uidNew A-End product UID
--b-end-uidNew B-End product UID
--a-end-partner-configA-End VRouter partner config JSON
--b-end-partner-configB-End VRouter partner config JSON
--a-vnic-index-1New A-End vNIC index (MVE move)
--b-vnic-index-1New B-End vNIC index (MVE move)
--cost-centreNew cost centre
--shutdownfalseShut down VXC
--is-approvedfalseApprove/reject via Marketplace
--interactivefalseInteractive mode
--jsonJSON config string
--json-filePath to JSON config file

Note: Only VRouter partner configs can be updated after creation. CSP partner configs (AWS, Azure, etc.) cannot be changed.

vxc delete <vxcUID>

Delete a VXC. Deletion is final and cannot be undone.

bash
megaport-cli vxc delete vxc-xxx
megaport-cli vxc delete vxc-xxx --now --force
FlagShortDefaultDescription
--force-ffalseSkip confirmation
--nowfalseDelete immediately instead of end of billing cycle

vxc list-tags <vxcUID>

List resource tags on a VXC.

vxc update-tags <vxcUID>

Add or update resource tags on a VXC.


MCR

Manage Megaport Cloud Routers — virtual routing appliances that provide interconnection between cloud environments and the Megaport fabric.

mcr list

List all MCRs with optional filters.

bash
megaport-cli mcr list
megaport-cli mcr list --location-id 67 --port-speed 10000
megaport-cli mcr list --name "My MCR"
megaport-cli mcr list --include-inactive
FlagDefaultDescription
--location-id0Filter by location ID
--port-speed0Filter by speed
--nameFilter by name
--include-inactivefalseInclude inactive MCRs
--limit0Max results (0 = unlimited)

mcr get <mcrUID>

bash
megaport-cli mcr get mcr-abc123
megaport-cli mcr get mcr-abc123 --export
FlagDefaultDescription
--exportfalseOutput recreatable JSON config
--watchfalseMonitor status in real-time
--interval5sRefresh interval for --watch

mcr status <mcrUID>

Lightweight provisioning status check.

FlagDefaultDescription
--watchfalseMonitor status in real-time
--interval5sRefresh interval when using --watch

mcr buy

Provision a new MCR.

bash
megaport-cli mcr buy --interactive
megaport-cli mcr buy --name "My MCR" --term 12 --port-speed 5000 --location-id 123 --marketplace-visibility true --mcr-asn 65000
megaport-cli mcr buy --json-file ./mcr-config.json
FlagShortDefaultDescriptionRequired
--nameMCR name (1-64 chars)Yes
--term0Term: 1, 12, 24, or 36 monthsYes
--port-speed0Speed: 1000, 2500, 5000, 10000, 25000, 50000, or 100000 MbpsYes
--location-id0Location IDYes
--marketplace-visibilityMarketplace visibility (true/false)Yes
--mcr-asn0ASN (64512-65534 for private, or public ASN)No
--cost-centreCost centreNo
--diversity-zoneDiversity zoneNo
--promo-codePromotional codeNo
--resource-tagsTags as JSON stringNo
--resource-tags-filePath to tags JSON fileNo
--interactive-ifalseInteractive modeNo
--jsonJSON config stringNo
--json-filePath to JSON config fileNo
--no-waitfalseDon't wait for provisioningNo
--yes-yfalseSkip confirmationNo
JSON Formatjson
{
  "name": "My MCR",
  "term": 12,
  "portSpeed": 5000,
  "locationId": 123,
  "mcrAsn": 65000,
  "marketplaceVisibility": true,
  "diversityZone": "blue",
  "costCentre": "IT-Networking",
  "resourceTags": { "environment": "production" }
}

mcr validate

Validate an MCR order without purchasing. Same flags as mcr buy.

mcr update <mcrUID>

bash
megaport-cli mcr update mcr-xxx --name "Updated MCR" --marketplace-visibility true --cost-centre "Finance"
megaport-cli mcr update mcr-xxx --json '{"name":"Updated MCR","marketplaceVisibility":true}'
FlagShortDefaultDescription
--nameNew name
--marketplace-visibilityfalseMarketplace visibility
--cost-centreCost centre
--interactive-ifalseInteractive mode
--jsonJSON config string
--json-filePath to JSON config file

mcr delete <mcrUID>

bash
megaport-cli mcr delete mcr-xxx
megaport-cli mcr delete mcr-xxx --now --force
FlagShortDefaultDescription
--force-ffalseSkip confirmation
--nowfalseDelete immediately
--safe-deletefalseFail if resource has attached VXCs

mcr restore <mcrUID>

Restore a recently deleted MCR (must be in DECOMMISSIONING state).

mcr lock <mcrUID> / mcr unlock <mcrUID>

Lock or unlock an MCR to prevent accidental deletion.

mcr list-prefix-filter-lists <mcrUID>

List all BGP prefix filter lists on an MCR.

mcr get-prefix-filter-list <mcrUID> <listID>

Get a specific prefix filter list.

mcr create-prefix-filter-list <mcrUID>

Create a new BGP prefix filter list.

bash
megaport-cli mcr create-prefix-filter-list mcr-xxx --interactive
megaport-cli mcr create-prefix-filter-list mcr-xxx --json-file ./prefix-list.json

mcr update-prefix-filter-list <mcrUID> <listID>

Update an existing prefix filter list.

mcr delete-prefix-filter-list <mcrUID> <listID>

Delete a prefix filter list.

mcr add-ipsec-addon <mcrUID>

Add an IPSec tunnel add-on to an MCR.

bash
megaport-cli mcr add-ipsec-addon mcr-xxx --tunnel-count 10
megaport-cli mcr add-ipsec-addon mcr-xxx --interactive
FlagDefaultDescription
--tunnel-countNumber of tunnels: 10, 20, or 30
--interactivefalseInteractive mode

mcr update-ipsec-addon <mcrUID> <addOnUID>

Update the tunnel count on an existing IPSec add-on.

bash
megaport-cli mcr update-ipsec-addon mcr-xxx addon-xxx --tunnel-count 20
FlagDefaultDescription
--tunnel-countNew tunnel count: 10, 20, or 30

mcr list-tags <mcrUID> / mcr update-tags <mcrUID>

List or update resource tags on an MCR.


MVE

Manage Megaport Virtual Edge appliances — virtual network devices running on the Megaport fabric.

mve list

List all MVEs. Same filter flags as ports (--include-inactive, --limit).

mve get <mveUID>

bash
megaport-cli mve get mve-xxx
megaport-cli mve get mve-xxx --export
FlagDefaultDescription
--exportfalseOutput recreatable JSON config
--watchfalseMonitor status in real-time
--interval5sRefresh interval for --watch

mve status <mveUID>

Lightweight provisioning status check.

FlagDefaultDescription
--watchfalseMonitor status in real-time
--interval5sRefresh interval when using --watch

mve buy

Provision a new MVE.

bash
megaport-cli mve buy --interactive
megaport-cli mve buy --name "My MVE" --term 12 --location-id 123 \
  --vendor-config '{"vendor":"cisco","imageId":123,"productSize":"MEDIUM"}' \
  --vnics '[{"description":"Data Plane","vlan":100}]'
megaport-cli mve buy --json-file ./mve-config.json
FlagShortDefaultDescriptionRequired
--nameMVE nameYes
--term0Term: 1, 12, 24, or 36 monthsYes
--location-id0Location IDYes
--vendor-configVendor-specific config JSONYes
--vnicsNetwork interfaces JSON arrayYes
--cost-centreCost centreNo
--diversity-zoneDiversity zoneNo
--promo-codePromotional codeNo
--resource-tagsTags as JSON stringNo
--resource-tags-filePath to tags JSON fileNo
--interactive-ifalseInteractive modeNo
--jsonJSON config stringNo
--json-filePath to JSON config fileNo
--no-waitfalseDon't wait for provisioningNo
--yes-yfalseSkip confirmationNo
JSON Formatjson
{
  "name": "My MVE",
  "term": 12,
  "locationId": 123,
  "vendorConfig": {
    "vendor": "cisco",
    "imageId": 123,
    "productSize": "MEDIUM",
    "adminSshPublicKey": "ssh-rsa AAAA..."
  },
  "vnics": [
    { "description": "Data Plane", "vlan": 100 },
    { "description": "Management", "vlan": 200 }
  ],
  "resourceTags": { "environment": "production" }
}

Tip: Use mve list-images and mve list-sizes to discover available options before buying.

mve validate

Validate an MVE order without purchasing. Same flags as mve buy.

mve update <mveUID>

bash
megaport-cli mve update mve-xxx --name "Edge Router West" --cost-centre "IT-Network" --term 24
FlagShortDefaultDescription
--nameNew name
--cost-centreNew cost centre
--term0New term (1, 12, 24, or 36 months)
--interactive-ifalseInteractive mode
--jsonJSON config string
--json-filePath to JSON config file

Note: Vendor configuration, size, and location cannot be changed after provisioning.

mve delete <mveUID>

bash
megaport-cli mve delete mve-xxx
megaport-cli mve delete mve-xxx --now --force
FlagShortDefaultDescription
--force-ffalseSkip confirmation
--nowfalseDelete immediately
--safe-deletefalseFail if resource has attached VXCs

mve restore <mveUID>

Restore a recently deleted MVE.

mve lock <mveUID> / mve unlock <mveUID>

Lock or unlock an MVE to prevent accidental deletion.

mve list-images

List available MVE images (by vendor/version).

bash
megaport-cli mve list-images
megaport-cli mve list-images --vendor "Cisco"
megaport-cli mve list-images --vendor "Fortinet" --release-image
FlagDefaultDescription
--vendorFilter by vendor name
--versionFilter by version
--id0Filter by image ID
--product-codeFilter by product code
--release-imagefalseOnly show release images

mve list-sizes

List all available MVE instance sizes.

bash
megaport-cli mve list-sizes

Standard sizes: SMALL (2 vCPU, 8GB), MEDIUM (4 vCPU, 16GB), LARGE (8 vCPU, 32GB), X_LARGE_12 (12 vCPU, 48GB). Not all sizes are available for all vendors.

mve list-tags <mveUID> / mve update-tags <mveUID>

List or update resource tags on an MVE.


IX

Manage Internet Exchange connections. IX connections attach to an existing port.

ix list

List all IX connections.

ix get <ixUID>

Get full IX details.

ix status <ixUID>

Lightweight provisioning status check.

ix buy

Provision a new IX connection.

bash
megaport-cli ix buy --interactive
megaport-cli ix buy --product-uid port-uid --name "My IX" --network-service-type "Los Angeles IX" \
  --asn 65000 --mac-address "00:11:22:33:44:55" --rate-limit 1000 --vlan 100
megaport-cli ix buy --json-file ./ix-config.json
FlagShortDefaultDescriptionRequired
--product-uidPort UID to attach IX toYes
--nameIX nameYes
--network-service-typeIX type/network serviceYes
--asn0ASN for BGP peeringYes
--mac-addressMAC address for IX interfaceYes
--rate-limit0Rate limit (Mbps)Yes
--vlan0VLAN IDYes
--shutdownfalseStart in shutdown stateNo
--promo-codePromotional codeNo
--interactive-ifalseInteractive modeNo
--jsonJSON config stringNo
--json-filePath to JSON config fileNo
--no-waitfalseDon't wait for provisioningNo
--yes-yfalseSkip confirmationNo
JSON Formatjson
{
  "productUid": "port-uid-here",
  "productName": "My IX",
  "networkServiceType": "Los Angeles IX",
  "asn": 65000,
  "macAddress": "00:11:22:33:44:55",
  "rateLimit": 1000,
  "vlan": 100
}

ix validate

Validate an IX order without purchasing. Same flags as ix buy.

ix update <ixUID>

bash
megaport-cli ix update ix-xxx --name "Updated IX" --rate-limit 2000
megaport-cli ix update ix-xxx --json '{"name":"Updated IX","rateLimit":2000}'
FlagDefaultDescription
--nameNew name
--rate-limit0New rate limit (Mbps)
--vlan0New VLAN ID
--asn0New ASN
--mac-addressNew MAC address
--cost-centreCost centre
--passwordBGP password
--reverse-dnsReverse DNS
--shutdownfalseShut down/re-enable
--public-graphfalsePublic usage stats
--a-end-product-uidMove IX to different port
--interactivefalseInteractive mode
--jsonJSON config string
--json-filePath to JSON config file

ix delete <ixUID>

Delete an IX connection.


Product

Query products by UID, regardless of type. Useful when you have a UID and don't know its resource type.

product list

List all products across all types with optional filters.

bash
megaport-cli product list
megaport-cli product list --include-inactive
megaport-cli product list --limit 10
FlagDefaultDescription
--include-inactivefalseInclude CANCELLED, DECOMMISSIONED, or DECOMMISSIONING products
--limit0Max results (0 = unlimited)

product get-type <productUID>

Return the resource type (port, MCR, MVE, VXC, IX) for any product UID.

bash
megaport-cli product get-type <productUID>

Locations

Browse data centre locations on the Megaport fabric. Read-only — no UIDs required.

locations list

bash
megaport-cli locations list
megaport-cli locations list --metro "Sydney" --country "AU"
megaport-cli locations list --mcr-available
megaport-cli locations list --name "Equinix SY1"
FlagDefaultDescription
--countryFilter by country code
--metroFilter by metro area
--nameFilter by name
--market-codeFilter by market code
--mcr-availablefalseOnly locations that support MCR
--limit0Max results (0 = unlimited)

locations get <locationID>

Get details for a specific location.

bash
megaport-cli locations get 3 --output json

locations search <query>

Fuzzy search locations by name.

bash
megaport-cli locations search "Equinix"
megaport-cli locations search "Sydney"

locations list-countries

List all countries with Megaport presence.

locations list-market-codes

List all market codes.


Partners

Discover partner ports available on the Megaport fabric. Read-only.

partners list

bash
megaport-cli partners list
megaport-cli partners list --company-name "Amazon Web Services" --location-id 3
megaport-cli partners list --connect-type "Dedicated Cloud Connection"
megaport-cli partners list --diversity-zone "blue"
FlagDefaultDescription
--company-nameFilter by provider name
--product-nameFilter by product/service name
--connect-typeFilter by connect type
--location-id0Filter by location ID
--diversity-zoneFilter by diversity zone
--limit0Max results (0 = unlimited)

partners find

Interactive partner port discovery. Prompts for search criteria — press Enter to skip any filter.

bash
megaport-cli partners find

Service Keys

Manage API service keys for sharing port access.

servicekeys list

List all service keys.

servicekeys get <key>

Get details for a service key.

servicekeys create

bash
megaport-cli servicekeys create --product-uid abc123 --description "Partner access"
megaport-cli servicekeys create --product-uid abc123 --start-date "2025-01-01" --end-date "2025-12-31" --max-speed 1000 --single-use
FlagDefaultDescription
--product-uidProduct UID for the key
--product-id0Product ID for the key
--descriptionKey description
--start-dateStart date (YYYY-MM-DD)
--end-dateEnd date (YYYY-MM-DD)
--max-speed0Maximum speed
--vlan0VLAN ID (required for single-use keys)
--single-usefalseSingle-use key
--activefalseMake available immediately
--pre-approvedfalsePre-approve for use

servicekeys update <key>

bash
megaport-cli servicekeys update key-xxx --description "Updated description" --active
FlagDefaultDescription
--descriptionNew description
--product-uidNew product UID
--product-id0New product ID
--activefalseActivate key
--single-usefalseSingle-use

Users

Manage user accounts (requires admin privileges). Users are identified by numeric ID.

users list

List all users.

users get <userID>

Get details for a user.

users create

bash
megaport-cli users create --interactive
megaport-cli users create --first-name "John" --last-name "Doe" --email "john@example.com" --position "Technical Admin"
FlagShortDefaultDescriptionRequired
--first-nameFirst nameYes
--last-nameLast nameYes
--emailEmail addressYes
--positionRole (see below)Yes
--phonePhone (international format)No
--interactive-ifalseInteractive modeNo
--jsonJSON config stringNo
--json-filePath to JSON config fileNo

Valid positions: Company Admin, Technical Admin, Technical Contact, Finance, Financial Contact, Read Only

users update <userID>

bash
megaport-cli users update 12345 --first-name "Jane" --last-name "Smith"
megaport-cli users update 12345 --notification-enabled
FlagDefaultDescription
--first-nameNew first name
--last-nameNew last name
--emailNew email
--phoneNew phone
--positionNew role
--activefalseSet active status
--notification-enabledfalseEnable/disable notifications

users deactivate <userID>

Deactivate a user account.

users delete <userID>

Delete a user.

users activity

View account activity log.


Managed Account

Manage partner sub-accounts.

managed-account list

List all managed accounts.

managed-account get <uid>

Get managed account details.

managed-account create

bash
megaport-cli managed-account create --account-name "Acme Corp" --account-ref "REF-001"
megaport-cli managed-account create --interactive
FlagShortDefaultDescriptionRequired
--account-nameAccount nameYes
--account-refReference IDYes
--interactive-ifalseInteractive modeNo
--jsonJSON config stringNo
--json-filePath to JSON config fileNo

managed-account update <uid>

bash
megaport-cli managed-account update uid-xxx --account-name "New Name" --account-ref "REF-002"
FlagShortDefaultDescription
--account-nameNew name
--account-refNew reference
--interactive-ifalseInteractive mode
--jsonJSON config string
--json-filePath to JSON config file

Config

Manage CLI configuration, profiles, and defaults. Credentials are stored in ~/.megaport/config.json with secure 0600 permissions. See Config Profiles.

config view

Display current config and active profile.

bash
megaport-cli config view

config create-profile <name>

bash
megaport-cli config create-profile production \
  --access-key $KEY --secret-key $SECRET \
  --environment production --description "Prod credentials"
FlagDefaultDescriptionRequired
--access-keyAPI access keyYes
--secret-keyAPI secret keyYes
--environmentproductionEnvironment: production, staging, or developmentNo
--descriptionProfile descriptionNo

config update-profile <name>

Update an existing profile. Same flags as create-profile.

config delete-profile <name>

Delete a profile.

config list-profiles

List all profiles.

config use-profile <name>

Set the active profile.

config set-default <key> <value>

bash
megaport-cli config set-default output json

config get-default <key>

Get a default value.

config remove-default <key>

Remove a default value.

config clear-defaults

Remove all default values.

config export

Export config to JSON. Credentials are redacted for security.

bash
megaport-cli config export --file myconfig.json

config import

Import config from JSON. Merges with existing config — adds new profiles, updates existing ones.

bash
megaport-cli config import --file myconfig.json

Note: Replace [REDACTED] values with actual credentials before importing.


Topology

Show a tree view of Megaport resources and their VXC connections.

bash
megaport-cli topology
megaport-cli topology --output json
megaport-cli topology --type mcr
megaport-cli topology --include-inactive
FlagDefaultDescription
--typeFilter by resource type: port, mcr, or mve
--include-inactivefalseInclude deprovisioned resources

Each VXC is shown once under its A-End parent. CSV and XML output are not supported for topology data.


Billing Market

billing-market get

Get current billing market configuration.

billing-market set

Create or update billing market configuration.

bash
megaport-cli billing-market set --currency USD --language en \
  --billing-contact-name "John Doe" --billing-contact-phone "+1234567890" \
  --billing-contact-email "john@example.com" --address1 "123 Main St" \
  --city "New York" --state "NY" --postcode "10001" --country US --first-party-id 1558
FlagDefaultDescriptionRequired
--currencyBilling currency code (e.g. USD, AUD, EUR)Yes
--languageTwo-letter language code (e.g. en)Yes
--billing-contact-nameName of the billing contactYes
--billing-contact-phonePhone number of the billing contactYes
--billing-contact-emailEmail address of the billing contactYes
--address1Physical address line 1Yes
--cityCityYes
--stateState or regionYes
--postcodePostal codeYes
--countryCountry code (e.g. AU, US)Yes
--first-party-id0Billing market region ID (e.g. 1558 for US, 808 for AU)Yes
--address2Physical address line 2No
--po-numberPurchase order numberNo
--tax-numberTax or VAT registration numberNo

Status

Dashboard view of all Megaport resources and their current state.

bash
megaport-cli status
megaport-cli status --output json
megaport-cli status --include-inactive
FlagDefaultDescription
--include-inactivefalseInclude inactive/decommissioned resources

Completion

Generate shell completion scripts.

bash
# Bash
megaport-cli completion bash > ~/.bash_completion.d/megaport-cli

# Zsh (requires: autoload -U compinit; compinit)
megaport-cli completion zsh > "${fpath[1]}/_megaport-cli"

# Fish
megaport-cli completion fish > ~/.config/fish/completions/megaport-cli.fish

# PowerShell
megaport-cli completion powershell > megaport-cli.ps1

Version

bash
megaport-cli version

Prints the CLI version. Useful for confirming the installed binary or the WASM build loaded in the browser terminal.