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.
| Flag | Short | Default | Description |
|---|---|---|---|
--output | -o | table | Output format: table, json, csv, xml, go-template |
--template | Go template string when --output go-template | ||
--env | Environment: production, staging, development | ||
--profile | Use a specific config profile for this command | ||
--verbose | -v | false | Show additional debug information |
--quiet | -q | false | Suppress informational output — show only data and errors |
--no-color | false | Disable colorful output | |
--no-header | false | Suppress table/CSV header row | |
--no-pager | false | Disable the pager for long output | |
--timeout | 90s | Request timeout (e.g., 30s, 2m) | |
--fields | Comma-separated list of fields to include in output | ||
--query | JMESPath query to filter JSON output (requires -o json) | ||
--no-retry | false | Disable automatic retry on transient API failures | |
--max-retries | 3 | Maximum number of retries for transient failures | |
--log-http | false | Log raw HTTP requests and responses to stderr (may include auth tokens) | |
--base-url | Override the API base URL — e.g. for a staging or dev endpoint | ||
--token-url | Override 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):
- CLI flags (
--env+ profile credentials) - Environment variables:
MEGAPORT_ACCESS_KEY,MEGAPORT_SECRET_KEY,MEGAPORT_ENVIRONMENT - Active config profile
- 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).
megaport-cli auth status
megaport-cli auth status --output json
whoami
Alias for auth status — same output and flags.
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
megaport-cli apply -f infrastructure.yaml
megaport-cli apply -f infrastructure.yaml --dry-run
megaport-cli apply -f infrastructure.yaml --yes
| Flag | Short | Default | Description | Required |
|---|---|---|---|---|
--file | -f | Path to config file (YAML or JSON) | Yes | |
--dry-run | false | Validate all orders without provisioning | No | |
--yes | -y | false | Skip confirmation prompt | No |
--rollback-on-failure | false | If 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[])
| Field | Type | Required | Notes |
|---|---|---|---|
name | string | Yes | |
location_id | int | Yes | |
speed | int | Yes | 1000, 10000, or 100000 |
term | int | Yes | 1, 12, 24, or 36 |
marketplace_visibility | bool | Yes | true or false |
diversity_zone | string | No | |
cost_centre | string | No | |
resource_tags | mapstringstring | No |
MCR (mcrs[])
| Field | Type | Required | Notes |
|---|---|---|---|
name | string | Yes | |
location_id | int | Yes | |
speed | int | Yes | 1000, 2500, 5000, 10000, 25000, 50000, or 100000 |
term | int | Yes | 1, 12, 24, or 36 |
asn | int | No | MCR ASN (defaults to Megaport-assigned if omitted) |
diversity_zone | string | No | |
cost_centre | string | No | |
resource_tags | mapstringstring | No |
MVE (mves[])
| Field | Type | Required | Notes |
|---|---|---|---|
name | string | Yes | |
location_id | int | Yes | |
term | int | Yes | 1, 12, 24, or 36 |
vendor_config | map | Yes | Vendor-specific block — same shape as mve buy --json (vendor, imageId, etc.) |
diversity_zone | string | No | |
cost_centre | string | No | |
resource_tags | mapstringstring | No |
VXC (vxcs[])
| Field | Type | Required | Notes |
|---|---|---|---|
name | string | Yes | |
rate_limit | int | Yes | Mbps |
term | int | Yes | 1, 12, 24, or 36 |
a_end | object | Yes | { product_uid, vlan } |
b_end | object | Yes | { product_uid, vlan } |
cost_centre | string | No | |
resource_tags | mapstringstring | No |
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_configfield on VXC endpoints, soapplycannot provision cloud VXCs (AWS, Azure, Google, Oracle, IBM, Transit, vRouter). Usevxc buy --json-fileorvxc buy --b-end-partner-configfor those. - VXC inner VLANs / vNIC indices — only
vlanis 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 viaapplydefault 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.
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
| Flag | Default | Description |
|---|---|---|
--location-id | 0 | Filter by location ID |
--port-speed | 0 | Filter by port speed |
--port-name | Filter by port name | |
--include-inactive | false | Include CANCELLED/DECOMMISSIONED ports |
--tag | Filter by resource tag (key=value or key; repeatable with AND logic) | |
--limit | 0 | Max results (0 = unlimited) |
ports get <portUID>
Get full port details.
megaport-cli ports get port-abc123
megaport-cli ports get port-abc123 --export
| Flag | Default | Description |
|---|---|---|
--export | false | Output recreatable JSON config for use with buy --json |
--watch | false | Monitor status in real-time (auto-refresh) |
--interval | 5s | Refresh interval when using --watch |
ports status <portUID>
Lightweight status check — shows only provisioning status without all details.
megaport-cli ports status port-abc123
megaport-cli ports status port-abc123 --watch
| Flag | Default | Description |
|---|---|---|
--watch | false | Monitor status in real-time |
--interval | 5s | Refresh interval when using --watch |
ports buy
Provision a new port.
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
| Flag | Short | Default | Description | Required |
|---|---|---|---|---|
--name | Port name (1-64 chars) | Yes | ||
--term | 0 | Contract term: 1, 12, 24, or 36 months | Yes | |
--port-speed | 0 | Speed: 1000, 10000, or 100000 Mbps | Yes | |
--location-id | 0 | Location ID | Yes | |
--marketplace-visibility | false | Visible in marketplace | Yes | |
--cost-centre | Cost centre for billing | No | ||
--diversity-zone | Diversity zone | No | ||
--promo-code | Promotional code | No | ||
--resource-tags | Tags as JSON string | No | ||
--resource-tags-file | Path to tags JSON file | No | ||
--interactive | -i | false | Interactive mode | No |
--json | JSON config string | No | ||
--json-file | Path to JSON config file | No | ||
--no-wait | false | Don't wait for provisioning | No | |
--yes | -y | false | Skip confirmation | No |
{
"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).
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
| Flag | Short | Default | Description | Required |
|---|---|---|---|---|
--name | Port name (1-64 chars) | Yes | ||
--term | 0 | Contract term: 1, 12, or 24 months | Yes | |
--port-speed | 0 | Speed: 10000 or 100000 Mbps | Yes | |
--location-id | 0 | Location ID | Yes | |
--lag-count | 0 | Number of LAG members (1-8) | Yes | |
--marketplace-visibility | false | Visible in marketplace | Yes | |
--cost-centre | Cost centre | No | ||
--diversity-zone | Diversity zone | No | ||
--promo-code | Promotional code | No | ||
--resource-tags | Tags as JSON string | No | ||
--resource-tags-file | Path to tags JSON file | No | ||
--interactive | -i | false | Interactive mode | No |
--json | JSON config string | No | ||
--json-file | Path to JSON config file | No | ||
--no-wait | false | Don't wait for provisioning | No | |
--yes | -y | false | Skip confirmation | No |
ports validate
Validate a port buy config without provisioning. Same flags as ports buy.
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.
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}'
| Flag | Short | Default | Description |
|---|---|---|---|
--name | New port name | ||
--term | 0 | New term (1, 12, 24, or 36 months) | |
--marketplace-visibility | false | Marketplace visibility | |
--cost-centre | Cost centre | ||
--interactive | -i | false | Interactive mode |
--json | JSON config string | ||
--json-file | Path 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.
megaport-cli ports delete port-xxx
megaport-cli ports delete port-xxx --force
megaport-cli ports delete port-xxx --safe-delete
| Flag | Short | Default | Description |
|---|---|---|---|
--force | -f | false | Skip confirmation |
--safe-delete | false | Refuse 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.
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.
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.
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
| Flag | Default | Description |
|---|---|---|
--name | Filter by name (case-sensitive partial match) | |
--name-contains | Filter by name (takes precedence over --name) | |
--a-end-uid | Filter by A-End UID | |
--b-end-uid | Filter by B-End UID | |
--rate-limit | 0 | Filter by rate limit (Mbps) |
--status | Filter by status (comma-separated, e.g. LIVE,CONFIGURED) | |
--include-inactive | false | Include inactive VXCs |
--tag | Filter by resource tag (key=value or key; repeatable with AND logic) | |
--limit | 0 | Max results (0 = unlimited) |
vxc get <vxcUID>
Get full VXC details.
megaport-cli vxc get vxc-xxx
megaport-cli vxc get vxc-xxx --export
| Flag | Default | Description |
|---|---|---|
--export | false | Output recreatable JSON config (partner configs not available from API) |
--watch | false | Monitor status in real-time (auto-refresh) |
--interval | 5s | Refresh interval when using --watch |
vxc status <vxcUID>
Lightweight status check for a VXC.
| Flag | Default | Description |
|---|---|---|
--watch | false | Monitor status in real-time |
--interval | 5s | Refresh interval when using --watch |
vxc buy
Provision a new VXC.
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
| Flag | Short | Default | Description | Required |
|---|---|---|---|---|
--name | VXC name | Yes | ||
--rate-limit | 0 | Bandwidth in Mbps | Yes | |
--term | 0 | Contract term: 1, 12, 24, or 36 months | Yes | |
--a-end-uid | A-End product UID | Yes | ||
--a-end-vlan | 0 | A-End VLAN (0=auto, -1=untagged, 2–4094; 1 is reserved) | Yes | |
--b-end-uid | B-End product UID | Yes | ||
--b-end-vlan | 0 | B-End VLAN (0=auto, -1=untagged, 2–4094; 1 is reserved) | Yes | |
--a-end-inner-vlan | 0 | A-End inner VLAN, QinQ (0=none, -1=untagged, 2–4094) | No | |
--b-end-inner-vlan | 0 | B-End inner VLAN, QinQ (0=none, -1=untagged, 2–4094) | No | |
--a-end-vnic-index | 0 | A-End vNIC index (MVE) | No | |
--b-end-vnic-index | 0 | B-End vNIC index (MVE) | No | |
--a-end-partner-config | A-End partner config JSON | No | ||
--b-end-partner-config | B-End partner config JSON | No | ||
--cost-centre | Cost centre | No | ||
--service-key | Service key | No | ||
--promo-code | Promotional code | No | ||
--resource-tags | Tags as JSON string | No | ||
--resource-tags-file | Path to tags JSON file | No | ||
--interactive | -i | false | Interactive mode | No |
--json | JSON config string | No | ||
--json-file | Path to JSON config file | No | ||
--no-wait | false | Don't wait for provisioning | No | |
--yes | -y | false | Skip confirmation | No |
{
"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.
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.
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
| Flag | Default | Description |
|---|---|---|
--name | New VXC name | |
--rate-limit | 0 | New bandwidth (Mbps) |
--term | 0 | New term (1, 12, 24, or 36 months) |
--a-end-vlan | 0 | New A-End VLAN (0=auto, -1=untagged, 2–4094) |
--b-end-vlan | 0 | New B-End VLAN (0=auto, -1=untagged, 2–4094) |
--a-end-inner-vlan | 0 | New A-End inner VLAN (0=none, -1=untagged, 2–4094) |
--b-end-inner-vlan | 0 | New B-End inner VLAN (0=none, -1=untagged, 2–4094) |
--a-end-uid | New A-End product UID | |
--b-end-uid | New B-End product UID | |
--a-end-partner-config | A-End VRouter partner config JSON | |
--b-end-partner-config | B-End VRouter partner config JSON | |
--a-vnic-index | -1 | New A-End vNIC index (MVE move) |
--b-vnic-index | -1 | New B-End vNIC index (MVE move) |
--cost-centre | New cost centre | |
--shutdown | false | Shut down VXC |
--is-approved | false | Approve/reject via Marketplace |
--interactive | false | Interactive mode |
--json | JSON config string | |
--json-file | Path 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).
megaport-cli vxc delete vxc-xxx
megaport-cli vxc delete vxc-xxx --force
megaport-cli vxc delete vxc-xxx --later
| Flag | Short | Default | Description |
|---|---|---|---|
--force | -f | false | Skip confirmation |
--later | false | Schedule 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.
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
| Flag | Default | Description |
|---|---|---|
--location-id | 0 | Filter by location ID |
--port-speed | 0 | Filter by speed |
--name | Filter by name | |
--include-inactive | false | Include inactive MCRs |
--tag | Filter by resource tag (key=value or key; repeatable with AND logic) | |
--limit | 0 | Max results (0 = unlimited) |
mcr get <mcrUID>
megaport-cli mcr get mcr-abc123
megaport-cli mcr get mcr-abc123 --export
| Flag | Default | Description |
|---|---|---|
--export | false | Output recreatable JSON config |
--watch | false | Monitor status in real-time |
--interval | 5s | Refresh interval for --watch |
mcr status <mcrUID>
Lightweight provisioning status check.
| Flag | Default | Description |
|---|---|---|
--watch | false | Monitor status in real-time |
--interval | 5s | Refresh interval when using --watch |
mcr buy
Provision a new MCR.
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
| Flag | Short | Default | Description | Required |
|---|---|---|---|---|
--name | MCR name (1-64 chars) | Yes | ||
--term | 0 | Term: 1, 12, 24, or 36 months | Yes | |
--port-speed | 0 | Speed: 1000, 2500, 5000, 10000, 25000, 50000, or 100000 Mbps | Yes | |
--location-id | 0 | Location ID | Yes | |
--marketplace-visibility | Marketplace visibility — string "true" or "false" | Yes | ||
--mcr-asn | 0 | ASN (64512-65534 for private, or public ASN) | No | |
--ipsec-tunnel-count | 0 | IPSec tunnel count for an add-on (10, 20, or 30) | No | |
--cost-centre | Cost centre | No | ||
--diversity-zone | Diversity zone | No | ||
--promo-code | Promotional code | No | ||
--resource-tags | Tags as JSON string | No | ||
--resource-tags-file | Path to tags JSON file | No | ||
--interactive | -i | false | Interactive mode | No |
--json | JSON config string | No | ||
--json-file | Path to JSON config file | No | ||
--no-wait | false | Don't wait for provisioning | No | |
--yes | -y | false | Skip confirmation | No |
{
"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>
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}'
| Flag | Short | Default | Description |
|---|---|---|---|
--name | New name | ||
--marketplace-visibility | false | Marketplace visibility | |
--cost-centre | Cost centre | ||
--term | 0 | New contract term: 1, 12, 24, or 36 months | |
--mcr-asn | 0 | New BGP ASN (64512-65534 for private, or public ASN); re-runs BGP setup | |
--interactive | -i | false | Interactive mode |
--json | JSON config string | ||
--json-file | Path to JSON config file |
mcr delete <mcrUID>
Delete an MCR. Deletion is immediate — restore is only possible while the MCR is in DECOMMISSIONING.
megaport-cli mcr delete mcr-xxx
megaport-cli mcr delete mcr-xxx --force
megaport-cli mcr delete mcr-xxx --safe-delete
| Flag | Short | Default | Description |
|---|---|---|---|
--force | -f | false | Skip confirmation |
--safe-delete | false | Refuse 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.
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.
megaport-cli mcr add-ipsec-addon mcr-xxx --tunnel-count 10
megaport-cli mcr add-ipsec-addon mcr-xxx --interactive
| Flag | Default | Description |
|---|---|---|
--tunnel-count | Number of tunnels: 10, 20, or 30 | |
--interactive | false | Interactive mode |
mcr update-ipsec-addon <mcrUID> <addOnUID>
Update the tunnel count on an existing IPSec add-on.
megaport-cli mcr update-ipsec-addon mcr-xxx addon-xxx --tunnel-count 20
| Flag | Default | Description |
|---|---|---|
--tunnel-count | New 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.
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.
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.
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
| Flag | Default | Description |
|---|---|---|
--ip | Filter 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.
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.
megaport-cli mve list
megaport-cli mve list --vendor Cisco --location-id 67
megaport-cli mve list --tag env=prod
| Flag | Default | Description |
|---|---|---|
--vendor | Filter by vendor | |
--location-id | 0 | Filter by location ID |
--name | Filter by name | |
--include-inactive | false | Include inactive MVEs |
--tag | Filter by resource tag (key=value or key; repeatable with AND logic) | |
--limit | 0 | Max results (0 = unlimited) |
mve get <mveUID>
megaport-cli mve get mve-xxx
megaport-cli mve get mve-xxx --export
| Flag | Default | Description |
|---|---|---|
--export | false | Output recreatable JSON config |
--watch | false | Monitor status in real-time |
--interval | 5s | Refresh interval for --watch |
mve status <mveUID>
Lightweight provisioning status check.
| Flag | Default | Description |
|---|---|---|
--watch | false | Monitor status in real-time |
--interval | 5s | Refresh interval when using --watch |
mve buy
Provision a new MVE.
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
| Flag | Short | Default | Description | Required |
|---|---|---|---|---|
--name | MVE name | Yes | ||
--term | 0 | Term: 1, 12, 24, or 36 months | Yes | |
--location-id | 0 | Location ID | Yes | |
--vendor-config | Vendor-specific config JSON | Yes | ||
--vnics | Network interfaces JSON array | Yes | ||
--cost-centre | Cost centre | No | ||
--diversity-zone | Diversity zone | No | ||
--promo-code | Promotional code | No | ||
--resource-tags | Tags as JSON string | No | ||
--resource-tags-file | Path to tags JSON file | No | ||
--interactive | -i | false | Interactive mode | No |
--json | JSON config string | No | ||
--json-file | Path to JSON config file | No | ||
--no-wait | false | Don't wait for provisioning | No | |
--yes | -y | false | Skip confirmation | No |
{
"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-imagesandmve list-sizesto discover available options before buying.
mve validate
Validate an MVE order without purchasing. Same flags as mve buy.
mve update <mveUID>
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"}]'
| Flag | Short | Default | Description |
|---|---|---|---|
--name | New name | ||
--cost-centre | New cost centre | ||
--term | 0 | New term (1, 12, 24, or 36 months) | |
--vnics | JSON array of vNIC updates — one entry per existing vNIC, in order; only description is mutable | ||
--interactive | -i | false | Interactive mode |
--json | JSON config string | ||
--json-file | Path 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.
megaport-cli mve delete mve-xxx
megaport-cli mve delete mve-xxx --force
megaport-cli mve delete mve-xxx --safe-delete
| Flag | Short | Default | Description |
|---|---|---|---|
--force | -f | false | Skip confirmation |
--safe-delete | false | Refuse 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).
megaport-cli mve list-images
megaport-cli mve list-images --vendor "Cisco"
megaport-cli mve list-images --vendor "Fortinet" --release-image
| Flag | Default | Description |
|---|---|---|
--vendor | Filter by vendor name | |
--version | Filter by version | |
--id | 0 | Filter by image ID |
--product-code | Filter by product code | |
--release-image | false | Only show release images |
mve list-sizes
List all available MVE instance sizes.
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.
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
| Flag | Default | Description |
|---|---|---|
--asn | 0 | Filter by ASN |
--include-inactive | false | Include inactive IXs in the list |
--limit | 0 | Maximum number of results (0 = unlimited) |
--location-id | 0 | Filter by location ID |
--name | Filter by name (partial match) | |
--network-service-type | Filter by IX/network service type (e.g. "Sydney IX") | |
--rate-limit | 0 | Filter by rate limit in Mbps |
--vlan | 0 | Filter by VLAN |
ix get <ixUID>
Get full IX details.
ix status <ixUID>
Lightweight provisioning status check.
ix buy
Provision a new IX connection.
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
| Flag | Short | Default | Description | Required |
|---|---|---|---|---|
--product-uid | Port UID to attach IX to | Yes | ||
--name | IX name | Yes | ||
--network-service-type | IX type/network service | Yes | ||
--asn | 0 | ASN for BGP peering | Yes | |
--mac-address | MAC address for IX interface | Yes | ||
--rate-limit | 0 | Rate limit (Mbps) | Yes | |
--vlan | 0 | VLAN ID | Yes | |
--shutdown | false | Start in shutdown state | No | |
--promo-code | Promotional code | No | ||
--interactive | -i | false | Interactive mode | No |
--json | JSON config string | No | ||
--json-file | Path to JSON config file | No | ||
--no-wait | false | Don't wait for provisioning | No | |
--yes | -y | false | Skip confirmation | No |
{
"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>
megaport-cli ix update ix-xxx --name "Updated IX" --rate-limit 2000
megaport-cli ix update ix-xxx --json '{"name":"Updated IX","rateLimit":2000}'
| Flag | Default | Description |
|---|---|---|
--name | New name | |
--rate-limit | 0 | New rate limit (Mbps) |
--vlan | 0 | New VLAN ID |
--asn | 0 | New ASN |
--mac-address | New MAC address | |
--cost-centre | Cost centre | |
--password | BGP password | |
--reverse-dns | Reverse DNS | |
--shutdown | false | Shut down/re-enable |
--public-graph | false | Public usage stats |
--a-end-product-uid | Move IX to different port | |
--interactive | false | Interactive mode |
--json | JSON config string | |
--json-file | Path 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.
megaport-cli ix delete ix-xxx
megaport-cli ix delete ix-xxx --force
megaport-cli ix delete ix-xxx --later
| Flag | Short | Default | Description |
|---|---|---|---|
--force | -f | false | Skip confirmation |
--later | false | Schedule 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.
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.
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
| Flag | Short | Default | Description | Required |
|---|---|---|---|---|
--name | NAT Gateway name | Yes | ||
--location-id | 0 | Location ID | Yes | |
--speed | 0 | Speed in Mbps | Yes | |
--term | 0 | Contract term: 1, 12, 24, or 36 months | Yes | |
--session-count | 0 | NAT session count (see list-sessions) | No | |
--auto-renew | false | Auto-renew the contract term | No | |
--diversity-zone | Diversity zone | No | ||
--service-level-reference | Service-level reference | No | ||
--promo-code | Promotional code | No | ||
--resource-tags | Tags as JSON string | No | ||
--resource-tags-file | Path to tags JSON file | No | ||
--interactive | -i | false | Interactive mode | No |
--json | JSON config string | No | ||
--json-file | Path to JSON config file | No | ||
--generate-skeleton | false | Print a JSON skeleton template and exit | No | |
--yes | -y | false | Skip confirmation | No |
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.
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.
megaport-cli nat-gateway buy <NAT-UID>
megaport-cli nat-gateway buy <NAT-UID> --yes
| Flag | Default | Description |
|---|---|---|
--yes | false | Skip 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.
# 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
| Flag | Default | Description |
|---|---|---|
--force | false | Skip confirmation |
--yes | false | Skip confirmation (alias of --force) |
nat-gateway telemetry <natUID>
Retrieve telemetry data (BITS, PACKETS, or SPEED) for a NAT Gateway.
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
| Flag | Default | Description | Required |
|---|---|---|---|
--types | Comma-separated telemetry types: BITS, PACKETS, SPEED | Yes | |
--days | 0 | Number of days (1–180); mutually exclusive with --from/--to | No |
--from | Start time (RFC3339, e.g. 2026-01-01T00:00:00Z); use with --to | No | |
--to | End time (RFC3339); use with --from | No |
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.
megaport-cli product list
megaport-cli product list --include-inactive
megaport-cli product list --limit 10
| Flag | Default | Description |
|---|---|---|
--include-inactive | false | Include CANCELLED, DECOMMISSIONED, or DECOMMISSIONING products |
--limit | 0 | Max results (0 = unlimited) |
product get-type <productUID>
Return the resource type (port, MCR, MVE, VXC, IX) for any product UID.
megaport-cli product get-type <productUID>
Locations
Browse data centre locations on the Megaport fabric. Read-only — no UIDs required.
locations list
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"
| Flag | Default | Description |
|---|---|---|
--country | Filter by country code | |
--metro | Filter by metro area | |
--name | Filter by name | |
--market-code | Filter by market code | |
--mcr-available | false | Only locations that support MCR |
--limit | 0 | Max results (0 = unlimited) |
locations get <locationID>
Get details for a specific location.
megaport-cli locations get 3 --output json
locations search <query>
Fuzzy search locations by name.
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.
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
| Flag | Default | Description | Required |
|---|---|---|---|
--src-location | 0 | Source location ID | Yes |
--dst-location | 0 | Filter to a specific destination location ID | No |
--year | 0 | Year for RTT data (default: previous month) | No |
--month | 0 | Month 1–12 (default: previous month) | No |
Partners
Discover partner ports available on the Megaport fabric. Read-only.
partners list
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"
| Flag | Default | Description |
|---|---|---|
--company-name | Filter by provider name | |
--product-name | Filter by product/service name | |
--connect-type | Filter by connect type | |
--location-id | 0 | Filter by location ID |
--diversity-zone | Filter by diversity zone | |
--limit | 0 | Max results (0 = unlimited) |
partners find
Interactive partner port discovery. Prompts for search criteria — press Enter to skip any filter.
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
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
| Flag | Default | Description |
|---|---|---|
--product-uid | Product UID for the key | |
--product-id | 0 | Product ID for the key |
--description | Key description | |
--start-date | Start date (YYYY-MM-DD) | |
--end-date | End date (YYYY-MM-DD) | |
--max-speed | 0 | Maximum speed |
--vlan | 0 | VLAN ID (required for single-use keys) |
--single-use | false | Single-use key |
--active | false | Make available immediately |
--pre-approved | false | Pre-approve for use |
servicekeys update <key>
megaport-cli servicekeys update key-xxx --active
megaport-cli servicekeys update key-xxx --product-uid abc123 --single-use
| Flag | Default | Description |
|---|---|---|
--product-uid | New product UID | |
--product-id | 0 | New product ID |
--active | false | Activate or deactivate the key |
--single-use | false | Single-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
megaport-cli users create --interactive
megaport-cli users create --first-name "John" --last-name "Doe" --email "john@example.com" --position "Technical Admin"
| Flag | Short | Default | Description | Required |
|---|---|---|---|---|
--first-name | First name | Yes | ||
--last-name | Last name | Yes | ||
--email | Email address | Yes | ||
--position | Role (see below) | Yes | ||
--phone | Phone (international format) | No | ||
--interactive | -i | false | Interactive mode | No |
--json | JSON config string | No | ||
--json-file | Path to JSON config file | No |
Valid positions: Company Admin, Technical Admin, Technical Contact, Finance, Financial Contact, Read Only
users update <userID>
megaport-cli users update 12345 --first-name "Jane" --last-name "Smith"
megaport-cli users update 12345 --notification-enabled
| Flag | Default | Description |
|---|---|---|
--first-name | New first name | |
--last-name | New last name | |
--email | New email | |
--phone | New phone | |
--position | New role | |
--active | false | Set active status |
--notification-enabled | false | Enable/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
megaport-cli managed-account create --account-name "Acme Corp" --account-ref "REF-001"
megaport-cli managed-account create --interactive
| Flag | Short | Default | Description | Required |
|---|---|---|---|---|
--account-name | Account name | Yes | ||
--account-ref | Reference ID | Yes | ||
--interactive | -i | false | Interactive mode | No |
--json | JSON config string | No | ||
--json-file | Path to JSON config file | No |
managed-account update <uid>
megaport-cli managed-account update uid-xxx --account-name "New Name" --account-ref "REF-002"
| Flag | Short | Default | Description |
|---|---|---|---|
--account-name | New name | ||
--account-ref | New reference | ||
--interactive | -i | false | Interactive mode |
--json | JSON config string | ||
--json-file | Path 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.
megaport-cli config view
config create-profile <name>
megaport-cli config create-profile production \
--access-key $KEY --secret-key $SECRET \
--environment production --description "Prod credentials"
| Flag | Default | Description | Required |
|---|---|---|---|
--access-key | API access key | Yes | |
--secret-key | API secret key | Yes | |
--environment | production | Environment: production, staging, or development | No |
--description | Profile description | No |
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>
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.
megaport-cli config export --file myconfig.json
config import
Import config from JSON. Merges with existing config — adds new profiles, updates existing ones.
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.
megaport-cli topology
megaport-cli topology --output json
megaport-cli topology --type mcr
megaport-cli topology --include-inactive
| Flag | Default | Description |
|---|---|---|
--type | Filter by resource type: port, mcr, or mve | |
--include-inactive | false | Include 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.
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
| Flag | Default | Description | Required |
|---|---|---|---|
--currency | Billing currency code (e.g. USD, AUD, EUR) | Yes | |
--language | Two-letter language code (e.g. en) | Yes | |
--billing-contact-name | Name of the billing contact | Yes | |
--billing-contact-phone | Phone number of the billing contact | Yes | |
--billing-contact-email | Email address of the billing contact | Yes | |
--address1 | Physical address line 1 | Yes | |
--city | City | Yes | |
--state | State or region | Yes | |
--postcode | Postal code | Yes | |
--country | Country code (e.g. AU, US) | Yes | |
--first-party-id | 0 | Billing market region ID (e.g. 1558 for US, 808 for AU) | Yes |
--address2 | Physical address line 2 | No | |
--po-number | Purchase order number | No | |
--tax-number | Tax or VAT registration number | No |
Status
Dashboard view of all Megaport resources and their current state.
megaport-cli status
megaport-cli status --output json
megaport-cli status --include-inactive
| Flag | Default | Description |
|---|---|---|
--include-inactive | false | Include inactive/decommissioned resources |
Completion
Generate shell completion scripts.
# 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
megaport-cli version
Prints the CLI version. Useful for confirming the installed binary or the WASM build loaded in the browser terminal.