Skip to content

GET /api/networks

Updated

Read host networks, observed state, and the default VM network pointer.

PropertyValue
Scoperead
Request bodynone
Success200 OK

Endpoint

GET ${baseUrl}/api/networks
read

Read host networks and the current default VM network pointer.

Use your host URL and API key as shell variables:

baseUrl="https://agent.example.com"
VIRT_AGENT_API_KEY="<your-api-key>"

cURL template

curl --request GET "${baseUrl}/api/networks" \
  --header "Authorization: Bearer ${VIRT_AGENT_API_KEY}"
LocationNameTypeRequiredDescription
HeaderAuthorizationbearer tokenyesBearer ${VIRT_AGENT_API_KEY}.

Returns a network list object.

ObjectFieldTypePresenceDescription
Responsenetworksarray of objectsalwaysHost networks known to Virtainer.
suggested_bridgestringalwaysNext available PVE-style bridge name, such as vmbr1.
default_vm_network_idstring or nullalwaysExplicit default network for new VMs. null means the host falls back to the bridged management network.
networks[]idstringalwaysNetwork id. The default management network is usually default.
namestringalwaysDisplay name.
bridgestringalwaysLinux bridge interface used by VM tap devices.
rolestringalwaysmanagement or vm_only.
scopestringalwaysNetwork scope, for example host_local.
uplinkstring or nullalwaysPhysical uplink interface, if any.
is_bridgedbooleanalwaysWhether VMs can attach to this network through a bridge.
l3_methodstringalwaysdhcp, static, or none.
policyobjectalwaysNetwork-level security policy overrides. Empty object means inherit node defaults.
observedobjectalwaysLive host observation. Nested fields are documented in the networks[].observed rows below.
vm_countintegeralwaysNumber of VMs attached to this network.
networks[].policyspoof_guardbooleanoptionalNetwork-level default for MAC/IP anti-spoofing. Omitted means inherit the node default.
port_isolationbooleanoptionalNetwork-level default for bridge port isolation. Omitted means inherit the node default.
networks[].observedbridge_existsbooleanalwaysWhether the bridge device exists on the host.
membersarray of stringsalwaysCurrent bridge members, including uplink and VM tap devices.
has_ipv4booleanalwaysWhether the bridge currently has an IPv4 address.
healthybooleanalwaysAggregate readiness for VM attachment and host network health.
Terminal window
baseUrl="https://agent.example.com"
VIRT_AGENT_API_KEY="<your-api-key>"
curl "${baseUrl}/api/networks" \
--header "Authorization: Bearer ${VIRT_AGENT_API_KEY}"
{
"networks": [
{
"id": "default",
"name": "Default",
"bridge": "vmbr0",
"role": "management",
"scope": "host_local",
"uplink": "eno1",
"is_bridged": true,
"l3_method": "dhcp",
"policy": {},
"observed": {
"bridge_exists": true,
"members": ["eno1"],
"has_ipv4": true,
"healthy": true
},
"vm_count": 2
}
],
"suggested_bridge": "vmbr1",
"default_vm_network_id": "default"
}
StatusCodeDescription
401UNAUTHORIZEDAPI key is missing or invalid.
403FORBIDDENAPI key is valid but not allowed to access the endpoint.
500NETWORK_ERROR or INTERNALThe host could not observe network state.