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.
| Flag | Short | Default | Description |
|---|---|---|---|
--output | -o | table | Output format: table, json, csv, xml |
--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 | |
--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 |
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.
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 |
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 |
--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. By default scheduled for end of billing period.
megaport-cli ports delete port-xxx
megaport-cli ports delete port-xxx --now
megaport-cli ports delete port-xxx --now --force
| Flag | Short | Default | Description |
|---|---|---|---|
--force | -f | false | Skip confirmation |
--now | false | Delete immediately instead of end of billing cycle | |
--safe-delete | false | Fail 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.
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 (partial match) | |
--name-contains | Filter by partial name (server-side) | |
--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 |
--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-4093, except 1) | Yes | |
--b-end-uid | B-End product UID | Yes | ||
--b-end-vlan | 0 | B-End VLAN (0-4093, except 1) | Yes | |
--a-end-inner-vlan | 0 | A-End inner VLAN (QinQ) | No | |
--b-end-inner-vlan | 0 | B-End inner VLAN (QinQ) | 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 |
--b-end-vlan | 0 | New B-End VLAN |
--a-end-inner-vlan | 0 | New A-End inner VLAN |
--b-end-inner-vlan | 0 | New B-End inner VLAN |
--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 final and cannot be undone.
megaport-cli vxc delete vxc-xxx
megaport-cli vxc delete vxc-xxx --now --force
| Flag | Short | Default | Description |
|---|---|---|---|
--force | -f | false | Skip confirmation |
--now | false | Delete 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.
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 |
--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 (true/false) | Yes | ||
--mcr-asn | 0 | ASN (64512-65534 for private, or public ASN) | 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 --json '{"name":"Updated MCR","marketplaceVisibility":true}'
| Flag | Short | Default | Description |
|---|---|---|---|
--name | New name | ||
--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 |
mcr delete <mcrUID>
megaport-cli mcr delete mcr-xxx
megaport-cli mcr delete mcr-xxx --now --force
| Flag | Short | Default | Description |
|---|---|---|---|
--force | -f | false | Skip confirmation |
--now | false | Delete immediately | |
--safe-delete | false | Fail 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.
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.
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>
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
| Flag | Short | Default | Description |
|---|---|---|---|
--name | New name | ||
--cost-centre | New cost centre | ||
--term | 0 | New term (1, 12, 24, or 36 months) | |
--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.
mve delete <mveUID>
megaport-cli mve delete mve-xxx
megaport-cli mve delete mve-xxx --now --force
| Flag | Short | Default | Description |
|---|---|---|---|
--force | -f | false | Skip confirmation |
--now | false | Delete immediately | |
--safe-delete | false | Fail 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).
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.
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 |
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.
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.
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 --description "Updated description" --active
| Flag | Default | Description |
|---|---|---|
--description | New description | |
--product-uid | New product UID | |
--product-id | 0 | New product ID |
--active | false | Activate key |
--single-use | false | Single-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
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 <uid>
Get managed account details.
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.