Skip to content

Network Endpoints

GET /api/network/config

Returns network configuration for both the Ethernet and USB-C interfaces, including configured settings and live interface information.

Response:

{
  "ethernet": {
    "mode": "dhcp_client_fallback",
    "ip_address": "192.168.0.95",
    "netmask": "255.255.0.0",
    "gateway": "",
    "dhcp_fallback_timeout": 30,
    "dhcp_server": {
      "range_start": "192.168.0.100",
      "range_end": "192.168.0.199",
      "lease_time": "30s"
    },
    "live_ip": "192.168.0.95",
    "mac": "00:11:22:33:44:55"
  },
  "usb_gadget": {
    "mode": "dhcp_host",
    "ip_address": "192.168.42.95",
    "netmask": "255.255.255.0",
    "enabled": true,
    "dhcp_server": {
      "range_start": "192.168.42.100",
      "range_end": "192.168.42.200",
      "lease_time": "30s"
    },
    "live_ip": "192.168.42.95",
    "mac": "00:11:22:33:44:56"
  }
}

Ethernet Modes

Mode Description
dhcp_client_fallback Try DHCP; fall back to static IP after timeout (factory default)
static Static IP address
dhcp_client Obtain IP from a network DHCP server

USB-C Modes

Mode Description
dhcp_host Run DHCP server for the connected host computer (factory default)
static Static IP address
disabled Interface is brought down

Read-Only Fields

The live_ip and mac fields are read-only and reflect the current state of the interface.

POST /api/network/config

Updates network configuration and applies it immediately. You can update Ethernet, USB-C, or both interfaces in a single request. Only include the fields you want to change.

Warning

Changing network settings while connected may result in loss of connectivity. Settings take effect immediately.

Example — set Ethernet to static IP:

curl -X POST -H "Content-Type: application/json" -d '{
  "ethernet": {
    "mode": "static",
    "ip_address": "192.168.1.100",
    "netmask": "255.255.255.0",
    "gateway": "192.168.1.1"
  }
}' http://<device-ip>/api/network/config

Example — set Ethernet to DHCP client mode:

curl -X POST -H "Content-Type: application/json" -d '{
  "ethernet": {
    "mode": "dhcp_client"
  }
}' http://<device-ip>/api/network/config

Example — set Ethernet to DHCP client with static fallback:

curl -X POST -H "Content-Type: application/json" -d '{
  "ethernet": {
    "mode": "dhcp_client_fallback",
    "ip_address": "192.168.0.95",
    "netmask": "255.255.0.0",
    "dhcp_fallback_timeout": 30
  }
}' http://<device-ip>/api/network/config

Example — disable USB-C networking:

curl -X POST -H "Content-Type: application/json" -d '{
  "usb_gadget": {
    "mode": "disabled",
    "enabled": false
  }
}' http://<device-ip>/api/network/config

Response:

{
  "status": "ok"
}

Errors:

  • 400 — Invalid request body, invalid or unknown mode, or invalid IP address
  • 500 — Failed to save or apply configuration

POST /api/network/reset

Restores factory default network configuration and applies it immediately.

Request: No body required.

Response:

{
  "status": "ok"
}

Warning

The device will briefly be unreachable while factory default settings are applied. The default configuration is DHCP Client with Static Fallback on Ethernet (fallback IP: 192.168.0.95) and DHCP Host on USB-C (IP: 192.168.42.95).