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 | Auth & Whoami | Apply | Ports | VXC | MCR | MCR Looking Glass | MVE | IX | NAT Gateway | Product | Locations | Partners | Service Keys | Users | Managed Account | Config | Topology | Billing Market | Status | Completion | Version


Global Flags

These flags are available on every command.

FlagShortDefaultDescription
--output-otableOutput format: table, json, csv, xml, go-template
--templateGo template string when --output go-template
--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
--no-headerfalseSuppress table/CSV header row
--no-pagerfalseDisable the pager for long 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
--log-httpfalseLog raw HTTP requests and responses to stderr (may include auth tokens)
--base-urlOverride the API base URL — e.g. for a staging or dev endpoint
--token-urlOverride the OAuth token endpoint when used with --base-url
ℹ️

`--base-url` and `--token-url`

Both flags were added in v0.11. --base-url targets a different Megaport API endpoint without switching --env. Set --token-url alongside it when the OAuth token endpoint sits on a different host. The CLI warns if either URL is not HTTPS.


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.


Auth

auth status

Verify credentials and show the currently authenticated identity (user, company, environment, active profile).

bash
megaport-cli auth status
megaport-cli auth status --output json

whoami

Alias for auth status — same output and flags.

bash
megaport-cli whoami
megaport-cli whoami --output json

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
--rollback-on-failurefalseIf any resource fails to provision, delete every resource created in this run before exiting (orphans are reported in the error output)No

Apply schema

Top-level keys: ports, mcrs, mves, vxcs. Each entry supports the fields below (YAML keys shown; JSON uses the same snake_case keys).

Port (ports[])

FieldTypeRequiredNotes
namestringYes
location_idintYes
speedintYes1000, 10000, or 100000
termintYes1, 12, 24, or 36
marketplace_visibilityboolYestrue or false
diversity_zonestringNo
cost_centrestringNo
resource_tagsmapstringstringNo

MCR (mcrs[])

FieldTypeRequiredNotes
namestringYes
location_idintYes
speedintYes1000, 2500, 5000, 10000, 25000, 50000, or 100000
termintYes1, 12, 24, or 36
asnintNoMCR ASN (defaults to Megaport-assigned if omitted)
diversity_zonestringNo
cost_centrestringNo
resource_tagsmapstringstringNo

MVE (mves[])

FieldTypeRequiredNotes
namestringYes
location_idintYes
termintYes1, 12, 24, or 36
vendor_configmapYesVendor-specific block — same shape as mve buy --json (vendor, imageId, etc.)
diversity_zonestringNo
cost_centrestringNo
resource_tagsmapstringstringNo

VXC (vxcs[])

FieldTypeRequiredNotes
namestringYes
rate_limitintYesMbps
termintYes1, 12, 24, or 36
a_endobjectYes{ product_uid, vlan }
b_endobjectYes{ product_uid, vlan }
cost_centrestringNo
resource_tagsmapstringstringNo

product_uid accepts a UID string or a template reference: {{.port.<name>}}, {{.mcr.<name>}}, or {{.mve.<name>}} resolving to a resource defined earlier in the same file.

⚠️

Apply is intentionally a subset of `*** buy`

The apply schema is deliberately narrower than the per-resource buy commands. It does not support:

  • VXC partner configs — there is no partner_config field on VXC endpoints, so apply cannot provision cloud VXCs (AWS, Azure, Google, Oracle, IBM, Transit, vRouter). Use vxc buy --json-file or vxc buy --b-end-partner-config for those.
  • VXC inner VLANs / vNIC indices — only vlan is supported per endpoint.
  • Service keys — VXCs that consume an Azure ExpressRoute service key must be created with vxc buy.
  • MCR marketplace_visibility — not present in the apply schema (MCRs created via apply default to not visible).
  • Port lag_count / LAG ports — only single ports.

For these resources, use the standalone buy commands. apply is best for port-to-port and port-to-MCR/MVE topology, where the value of declarative templating ({{.port.<name>}} references) is highest.


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
--tagFilter by resource tag (key=value or key; repeatable with AND logic)
--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. Deletion is immediate — the previous "terminate at end of billing period" option is no longer supported.

bash
megaport-cli ports delete port-xxx
megaport-cli ports delete port-xxx --force
megaport-cli ports delete port-xxx --safe-delete
FlagShortDefaultDescription
--force-ffalseSkip confirmation
--safe-deletefalseRefuse to delete if the port has attached VXCs

Note: Restore is only possible while the port is in DECOMMISSIONING. Once fully decommissioned, restoration is not possible.

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 (case-sensitive partial match)
--name-containsFilter by name (takes precedence over --name)
--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
--tagFilter by resource tag (key=value or key; repeatable with AND logic)
--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=auto, -1=untagged, 2–4094; 1 is reserved)Yes
--b-end-uidB-End product UIDYes
--b-end-vlan0B-End VLAN (0=auto, -1=untagged, 2–4094; 1 is reserved)Yes
--a-end-inner-vlan0A-End inner VLAN, QinQ (0=none, -1=untagged, 2–4094)No
--b-end-inner-vlan0B-End inner VLAN, QinQ (0=none, -1=untagged, 2–4094)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 (0=auto, -1=untagged, 2–4094)
--b-end-vlan0New B-End VLAN (0=auto, -1=untagged, 2–4094)
--a-end-inner-vlan0New A-End inner VLAN (0=none, -1=untagged, 2–4094)
--b-end-inner-vlan0New B-End inner VLAN (0=none, -1=untagged, 2–4094)
--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 immediate by default. Pass --later to schedule cancellation at the end of the current billing cycle instead (not supported for Transit VXCs).

bash
megaport-cli vxc delete vxc-xxx
megaport-cli vxc delete vxc-xxx --force
megaport-cli vxc delete vxc-xxx --later
FlagShortDefaultDescription
--force-ffalseSkip confirmation
--laterfalseSchedule deletion at the end of the current billing cycle instead of immediately

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
--tagFilter by resource tag (key=value or key; repeatable with AND logic)
--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 — string "true" or "false"Yes
--mcr-asn0ASN (64512-65534 for private, or public ASN)No
--ipsec-tunnel-count0IPSec tunnel count for an add-on (10, 20, or 30)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 --term 24 --mcr-asn 65010
megaport-cli mcr update mcr-xxx --json '{"name":"Updated MCR","marketplaceVisibility":true}'
FlagShortDefaultDescription
--nameNew name
--marketplace-visibilityfalseMarketplace visibility
--cost-centreCost centre
--term0New contract term: 1, 12, 24, or 36 months
--mcr-asn0New BGP ASN (64512-65534 for private, or public ASN); re-runs BGP setup
--interactive-ifalseInteractive mode
--jsonJSON config string
--json-filePath to JSON config file

mcr delete <mcrUID>

Delete an MCR. Deletion is immediate — restore is only possible while the MCR is in DECOMMISSIONING.

bash
megaport-cli mcr delete mcr-xxx
megaport-cli mcr delete mcr-xxx --force
megaport-cli mcr delete mcr-xxx --safe-delete
FlagShortDefaultDescription
--force-ffalseSkip confirmation
--safe-deletefalseRefuse to delete if the MCR 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.


MCR Looking Glass

Inspect live BGP and routing state on an MCR — equivalent to a hardware router's looking-glass interface. Useful for confirming peering, debugging route propagation, and seeing what's actually in the FIB after a vxc update to BGP config.

mcr looking-glass bgp-sessions <mcrUID>

List every BGP session configured on an MCR, with current session state, peer ASN, and uptime.

bash
megaport-cli mcr looking-glass bgp-sessions mcr-xxx
megaport-cli mcr looking-glass bgp-sessions mcr-xxx --output json

mcr looking-glass bgp-routes <mcrUID>

Show the BGP RIB on the MCR — routes received from all peers, including those filtered out by prefix-filter-lists.

bash
megaport-cli mcr looking-glass bgp-routes mcr-xxx
megaport-cli mcr looking-glass bgp-routes mcr-xxx --output json --query "[?as_path != null]"

mcr looking-glass bgp-neighbor-routes <mcrUID> <sessionID> <advertised|received>

Show routes advertised to or received from one specific BGP neighbor — get the session ID from bgp-sessions. Use the --ip flag to filter to a specific prefix.

bash
megaport-cli mcr looking-glass bgp-neighbor-routes mcr-xxx sess-001 received
megaport-cli mcr looking-glass bgp-neighbor-routes mcr-xxx sess-001 advertised
megaport-cli mcr looking-glass bgp-neighbor-routes mcr-xxx sess-001 received --ip 10.0.0.0/8
FlagDefaultDescription
--ipFilter by IP address or prefix (e.g. 10.0.0.0/8)

mcr looking-glass ip-routes <mcrUID>

Show the IP routing table (FIB) on the MCR — the routes the MCR is actually using to forward traffic, after BGP best-path selection and any local prefix-filter-lists.

bash
megaport-cli mcr looking-glass ip-routes mcr-xxx
megaport-cli mcr looking-glass ip-routes mcr-xxx --output json

Note: Looking Glass commands are read-only — they query MCR state but make no changes.


MVE

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

mve list

List all MVEs.

bash
megaport-cli mve list
megaport-cli mve list --vendor Cisco --location-id 67
megaport-cli mve list --tag env=prod
FlagDefaultDescription
--vendorFilter by vendor
--location-id0Filter by location ID
--nameFilter by name
--include-inactivefalseInclude inactive MVEs
--tagFilter by resource tag (key=value or key; repeatable with AND logic)
--limit0Max results (0 = unlimited)

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
megaport-cli mve update mve-xxx --vnics '[{"description":"Data Plane"},{"description":"Management"}]'
FlagShortDefaultDescription
--nameNew name
--cost-centreNew cost centre
--term0New term (1, 12, 24, or 36 months)
--vnicsJSON array of vNIC updates — one entry per existing vNIC, in order; only description is mutable
--interactive-ifalseInteractive mode
--jsonJSON config string
--json-filePath to JSON config file

Note: Vendor configuration, size, and location cannot be changed after provisioning. vNICs can only have their description updated — the vNIC count and VLANs are fixed once the MVE is live.

mve delete <mveUID>

Delete an MVE. Deletion is immediate — restore is only possible while the MVE is in DECOMMISSIONING.

bash
megaport-cli mve delete mve-xxx
megaport-cli mve delete mve-xxx --force
megaport-cli mve delete mve-xxx --safe-delete
FlagShortDefaultDescription
--force-ffalseSkip confirmation
--safe-deletefalseRefuse to delete if the MVE 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, with optional filters.

bash
megaport-cli ix list
megaport-cli ix list --network-service-type "Sydney IX"
megaport-cli ix list --asn 65000
megaport-cli ix list --location-id 3 --include-inactive
FlagDefaultDescription
--asn0Filter by ASN
--include-inactivefalseInclude inactive IXs in the list
--limit0Maximum number of results (0 = unlimited)
--location-id0Filter by location ID
--nameFilter by name (partial match)
--network-service-typeFilter by IX/network service type (e.g. "Sydney IX")
--rate-limit0Filter by rate limit in Mbps
--vlan0Filter by VLAN

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
ℹ️

Input is validated before the API call (v0.13)

ix buy and ix update check your values locally first: ASN in the range 1-4294967295, MAC address in EUI-48 form (for example 00:11:22:33:44:55), VLAN of 0 to auto-assign, -1 for untagged, or 2-4094, and a positive rate limit. You get a clear message up front instead of a generic API rejection.

ix delete <ixUID>

Delete an IX connection. Deletion is immediate by default. Pass --later to schedule cancellation at the end of the current billing cycle instead.

bash
megaport-cli ix delete ix-xxx
megaport-cli ix delete ix-xxx --force
megaport-cli ix delete ix-xxx --later
FlagShortDefaultDescription
--force-ffalseSkip confirmation
--laterfalseSchedule deletion at the end of the current billing cycle instead of immediately

NAT Gateway

Manage Megaport NAT Gateways — managed network address translation services hosted in the Megaport fabric. Note that delete is immediate and irreversible — there is no soft-delete window or restore command.

nat-gateway list

List all NAT Gateways.

bash
megaport-cli nat-gateway list

nat-gateway get <natUID>

Get details for a NAT Gateway.

nat-gateway list-sessions

List the valid speed / session-count combinations available when creating a NAT Gateway.

nat-gateway create

Create a NAT Gateway in DESIGN state — no charges yet. Follow with nat-gateway validate <natUID> and nat-gateway buy <natUID> to provision.

bash
megaport-cli nat-gateway create --interactive
megaport-cli nat-gateway create --name "Sydney NAT" --location-id 3 \
  --speed 1000 --term 12 --session-count 100
megaport-cli nat-gateway create --json-file ./nat.json
FlagShortDefaultDescriptionRequired
--nameNAT Gateway nameYes
--location-id0Location IDYes
--speed0Speed in MbpsYes
--term0Contract term: 1, 12, 24, or 36 monthsYes
--session-count0NAT session count (see list-sessions)No
--auto-renewfalseAuto-renew the contract termNo
--diversity-zoneDiversity zoneNo
--service-level-referenceService-level referenceNo
--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
--generate-skeletonfalsePrint a JSON skeleton template and exitNo
--yes-yfalseSkip confirmationNo

nat-gateway validate <natUID>

Validate a NAT Gateway that's still in DESIGN state — confirms pricing and configuration via /v3/networkdesign/validate without provisioning anything.

bash
megaport-cli nat-gateway validate <NAT-UID>
megaport-cli nat-gateway validate <NAT-UID> --output json

nat-gateway buy <natUID>

Purchase a previously created NAT Gateway design — begins provisioning and billing.

bash
megaport-cli nat-gateway buy <NAT-UID>
megaport-cli nat-gateway buy <NAT-UID> --yes
FlagDefaultDescription
--yesfalseSkip confirmation

nat-gateway update <natUID>

Update a NAT Gateway (name, cost centre, etc.).

nat-gateway delete <natUID>

Permanently delete a NAT Gateway. No restore window — once deleted, it's gone.

bash
# Interactive — prompts for confirmation
megaport-cli nat-gateway delete <NAT-UID>

# Non-interactive — skip the confirmation prompt
megaport-cli nat-gateway delete <NAT-UID> --force
FlagDefaultDescription
--forcefalseSkip confirmation
--yesfalseSkip confirmation (alias of --force)

nat-gateway telemetry <natUID>

Retrieve telemetry data (BITS, PACKETS, or SPEED) for a NAT Gateway.

bash
megaport-cli nat-gateway telemetry <NAT-UID> --types BITS --days 7
megaport-cli nat-gateway telemetry <NAT-UID> --types BITS,PACKETS --from 2026-04-01T00:00:00Z --to 2026-04-30T23:59:59Z
FlagDefaultDescriptionRequired
--typesComma-separated telemetry types: BITS, PACKETS, SPEEDYes
--days0Number of days (1–180); mutually exclusive with --from/--toNo
--fromStart time (RFC3339, e.g. 2026-01-01T00:00:00Z); use with --toNo
--toEnd time (RFC3339); use with --fromNo

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.

locations rtt

Query median round-trip times (RTT) between Megaport locations. Useful for designing low-latency MCR placements and cross-connect topology. Data is published after month end — the current month has no data.

bash
megaport-cli locations rtt --src-location 67
megaport-cli locations rtt --src-location 67 --dst-location 3
megaport-cli locations rtt --src-location 67 --year 2026 --month 3
FlagDefaultDescriptionRequired
--src-location0Source location IDYes
--dst-location0Filter to a specific destination location IDNo
--year0Year for RTT data (default: previous month)No
--month0Month 1–12 (default: previous month)No

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 --active
megaport-cli servicekeys update key-xxx --product-uid abc123 --single-use
FlagDefaultDescription
--product-uidNew product UID
--product-id0New product ID
--activefalseActivate or deactivate the key
--single-usefalseSingle-use
ℹ️

Update behaviour changed in v0.13

--description was removed: the update API does not support changing it, so set it at create time with servicekeys create --description. Omitting --active or --single-use no longer resets them to false, the command reads the current key and changes only the flags you pass. Passing both --product-uid and --product-id is rejected.


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 <companyUID> <accountName>

Get managed account details. Both arguments are required: the company UID and the account name.

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.