openwrt-iac / uapi / docs / 3.5.0 / Curated resources
This document indexes the 45 curated resources shipped in v3.x. For the full
schema (every field, its type, enum values, ranges, patterns), read
build/openapi.json (also served at /api/v3/openapi.json on a live
router) or open it in Swagger UI. Per-resource sample curls live in
examples/curl/.
GET /schema/<package>/<resource> serves a module's declared properties as one
set, without the
request and response split the OpenAPI document makes. It is the module's own
view: a property
marked readOnly there is absent from that resource's *Request schema, a
property marked
x-uapi-read-nullable has null added to its type (and to its enum) in both
halves, as the
next paragraph explains, a property marked x-uapi-write-string keeps string
in its type only
in the *Request schema, the keywords under a property's x-uapi-write (such
as minimum: 68
on mtu) apply only in the *Request schema, and id, managed and runtime
are stamped by
the framework rather than declared by the module. For the two halves, read
build/openapi.json.
x-uapi-read-nullable marks a property a read can answer null for, and widens
its type (and
enum) with null in both halves. Both, because every IaC apply is a
read-modify-write: the
response view goes back out as the next request body, so a request schema that
refused those
nulls would describe the round trip as invalid while the server accepts it.
Widening does not
weaken a required field, since the type is not what guards one;
resource.validate() is, and it
answers 422 naming the field for a null target on a create.
tests/lint_response_nullability.uc calls each resource's real fromUci on a
bare section and
fails if anything it returns null for is not null-permitted in the response
schema.
The authoritative inventory is the OpenAPI spec; if this document drifts, the spec wins.
Curated resources that drive a daemon shipped as a separate OpenWrt
package (unbound/server, sqm/queues, snmpd/*, openvpn/instances,
mwan3/*, vnstat/config, usteer/config, lldpd/config,
prometheus_node_exporter_lua/config,
uhttpd/instances beyond main) need the underlying package installed
before writes succeed. Writing to a resource whose daemon is absent
returns 503 init_script_missing with the missing
/etc/init.d/<service> path in the response body, before any uci
write. The pre-flight check is part of the atomic transaction recipe;
no partial state is left behind.
The uci config file has to exist too. wireless/devices and
wireless/interfaces need /etc/config/wireless, which only
wifi-scripts creates, with wifi config when it finds a radio. LuCI
never creates a radio section. On a router or an image without it, a
write answers 503 config_missing with the missing path, before any uci
write. That includes a PUT or PATCH of an id that a GET answers 404 for,
as with init_script_missing. A DELETE answers 404, because no section
can exist there, and a client reads that as already gone. A DELETE in a
POST /batch answers the 503, because the batch commits as one write. A
read answers an empty list. The same applies to any package whose file
was removed. An empty file is enough.
Install the daemon either out of band (apk add unbound, etc.) or
through uapi itself via POST /api/v3/packages/installed. The latter
is what a Terraform configuration would chain via depends_on on a
uapi_package resource. The base uapi package's Depends: only
covers what uapi itself needs to run (uhttpd, ucode mods); per-daemon
packages are deliberately not pulled in.
| Path | Wraps | Notes |
|---|---|---|
network/interfaces |
config interface |
Protos static, dhcp, dhcpv6, pppoe, ppp, wwan, wireguard and none. Optional id picks the section name at create time (uci section-name charset, 32 chars, tightened to 15 for proto=wireguard because netifd uses it as the kernel netdev name); absent, the server emits a 14-char wg_<rand> for wireguard or a 28-char ULID otherwise. A section that LuCI or a shell named otherwise, such as 4g, takes every other write, and a PUT may send its id back. runtime block carries live ubus state (uptime, ipv4/ipv6 addresses, route table). Some fields apply only to some protos, as the allOf entries on proto in the spec say: a read omits the others, a write that names one with a value other than null, "" or [] answers 422 conflict, and a proto switch removes the old proto's options, private_key included, by PATCH as by PUT. The options that netifd reads for every proto (metric, defaultroute, delegate, ip4table, ip6table, dns, mtu, the ip6assign group) apply to all of them. netifd applies mtu to the interface's device only when that device has no config device section of its own, as br-lan has in the stock configuration, and to every device that joins the interface later, such as a Wi-Fi netdev. A device with its own section takes its MTU from network/devices. On ppp and pppoe, mtu goes to pppd, which takes 128 to 16384. listen_port reads a service name as the port that wg resolves, and -1 when the name does not resolve. A write that switches an enabled interface to wireguard, or enables a wireguard interface, answers 422 conflict while one of its stored network/wireguard_peers holds a value for which a peer write refuses to enable the peer, such as one that makes wg refuse the whole interface. A PATCH that switches an enabled interface to wireguard and leaves listen_port out answers 422 conflict on listen_port while uci holds a hand-written value that reads -1, which the read of the old proto does not show: null in the switch removes it, and a PUT removes it anyway. On a proto that uapi does not model, such as 6in4, a read shows the modelled options that uci stores, a POST or PUT answers 422 not_in_enum, and a PATCH that leaves proto out refuses only broadcast_flag and keeps the options of the proto's handler. On such a proto, a write stores one value of ipaddrs, ip6addrs or ip6prefix as an option, as LuCI writes it, and refuses several with 422 conflict when the handler declares the option as one value in ubus call network get_proto_handlers, as 6in4, gre, ipip and vxlan declare ipaddr. netifd hands such a handler no uci list, so a stored list shows in the validation sweep, and a PATCH that sends the value stores it as an option. |
network/devices |
config device |
Bridges, VLANs (8021q/8021ad), macvlan, veth, tun/tap. mtu below 68 is refused on write, because netifd ignores it. A stored one reads as it is. A read also gives a type that uapi does not write, such as the bonding or vrf that LuCI writes, and a vid of 0, which the netifd of OpenWrt main takes. A write refuses a change to either, and takes one that sends it back. |
network/routes |
config route |
Static routes; cross-refs interface. table reads a stored name as its id (253 default, 254 main, 255 local, or the id in /etc/iproute2/rt_tables), and 0 when netifd cannot resolve it and drops the route. A write takes an id from 1 to 4294967295. |
network/rules |
config rule |
Policy routing. lookup reads and writes like the table of network/routes. netifd parses no lookup or goto action: a rule without action is a goto rule when goto is set and a lookup rule otherwise, so a read derives action that way and a write stores no action for those two. A goto must jump forward, past priority, and goes only with action goto. A rule needs no selector, as for netifd, the kernel and LuCI. Such a rule matches every packet, so with a table that holds a default route it routes all traffic, the management session included, and without a priority netifd numbers it by its place among the rules, from 1 up, ahead of main. LuCI allows the same. suppress_prefixlength and tos read as netifd reads an integer, like priority. ipproto reads a decimal as an integer, and the other spellings that netifd takes, such as 06 or tcp, as uci holds them. uidrange, sport and dport read as uci holds them. Each reads null when unset. A write takes an integer from 0 to 32 for suppress_prefixlength and from 1 to 255 for ipproto, as LuCI's form does, a tos of 0, 4, 8, 12, 16, 20, 24 or 28, and ports from 1 to 65534 and uids from 0 to 4294967294 as plain decimals, alone or as a range that does not run backwards. A stored value in another form passes a write that leaves it as it is. A write that enables the rule refuses it only when netifd drops the rule or the kernel refuses it, and the validation sweep lists it with that flag. |
network/bridge_vlans |
config bridge-vlan |
Bridge VLAN tagging (vlan 1-4094 + port spec). |
network/wireguard_peers |
config wireguard_<iface> (dynamic) |
Peers on a wireguard interface; preshared_key masked on read. endpoint_port reads a service name such as https as its port from /etc/services, as wg resolves it, and 0 when the name does not resolve. persistent_keepalive reads off as 0, and -1 when wg cannot read the stored value. allowed_ips is optional, as in LuCI, and a peer without it is set in the kernel with none. allowed_ips reads the entries as wg gets them: wireguard.sh joins a list with spaces, leaving out an empty entry, makes each space a comma, and expands the escapes of printf %b, and wg cuts the line at a NUL byte and at # and splits it at commas. So \054 and a comma separate two entries, two prefixes that a tab separates read as one entry, and a space at either end or next to another adds an empty one. wg refuses the last two, and so does a write that leaves the peer enabled, while one that leaves it disabled checks only the entries that it sends. A value that the escapes would give a second line, the end of the config or a byte that is not printable ASCII, or that holds a backslash and is longer than 512 bytes, reads unexpanded. A value that wg reads as an empty line, such as one that starts with #, reads as one empty entry, because wireguard.sh still writes the line and wg refuses it. The routes of route_allowed_ips go to each word of the option as stored, split at tabs and newlines too and before the escapes, as wireguard.sh installs them: the address before the first / of a word and the length after its last, read as netifd reads it. A write that sets a key, or enables a peer, refuses a key that is not on one line as wg genkey prints it, or that holds a backslash. A peer that stores such a key still takes a DELETE, and a PATCH that disables it, unless the key holds a backslash and is longer than 512 bytes. The restore after a failed write keeps a peer whose stored preshared_key wg cannot read as the kernel holds it, and sets the peers after it. It answers reload_failed_unrecovered when the failed write set or removed that peer, or the kernel does not hold it. runtime carries what the kernel holds for the peer, from one wg show <iface> dump for each interface that a request reads: in_kernel, under the key that wg reads from the stored public_key, the endpoint, allowed_ips and persistent_keepalive of the kernel beside the fields that uci holds, and latest_handshake, rx_bytes and tx_bytes. uapi compares nothing and corrects nothing, so a client sees a peer that wg changed by hand, or that a failed apply left behind. Only a GET reads runtime: unlike the other resources, a write answers runtime: {} and reads no kernel state, since the kernel apply comes after its body, and X-Kernel-Status says whether the apply landed. A GET in a /batch that writes answers {} too, since it runs before the apply of the batch. runtime is also {} when uapi did not read the kernel, because the interface is not up, wg fails or wg prints a dump in a shape that uapi does not read, and when the stored key gives wg more than a key or is too long to expand. runtime.allowed_ips is in the form that the kernel prints, with the host bits cleared and IPv6 in its short form, and two peers that store the same key both report the one peer of the kernel. |
network/wireguard_kernel_peers (read-only collection) |
wg show <iface> dump |
The WireGuard peers the kernel holds that no uci section of their interface claims, on up interfaces with proto=wireguard: what a hand wg set added or a failed apply left, which no other read reports. Keyed as wg reads the stored key, the later PublicKey= lines of one included, and disabled sections included, because the runtime of a disabled section already reports a peer the kernel holds under its key. One dump per interface per request, the same one the runtime reads. A down interface or a failing wg lists nothing, as runtime answers {}. The stable id is the first 12 hex of the sha256 of the interface name and the public key. No write, no lock, no ETag. |
option disabled is modelled on network/interfaces, network/routes and
network/rules. netifd drops a disabled section outright on all three: a
disabled
interface is never registered, so it has no ubus object and its addresses and
routes
are absent, and a disabled route or rule is never installed. Each resource reads
the
option with the helper matching its own parser, because netifd does not parse it
the
same way for all three: strict_bool on the interface, where netifd compares
the
value literally against 1, and platform_bool on routes and rules, where it
goes
through the boolean blob converter that also accepts true.
network/wireguard_peers
models disabled as well.
#64 tracked the gap while it
was
open; docs/roadmap.md carries the reasoning and the alternatives that were
turned
down.
Reload: network (netifd), then odhcpd while procd holds a config.change
trigger for it, under the rule of a dhcp write below. odhcpd reads the network
config and has a procd trigger on network, which a commit through libuci does
not fire. So a network write runs one more init script while procd holds that
trigger, /etc/init.d/odhcpd reload, which sends odhcpd a signal, and holds the
global SH and the lock of network while it runs, so a non-uci write at that
moment answers 423 locked. If that reload exits non-zero, the write answers
500 reload_failed_restored and restores the previous config, or 500
reload_failed_unrecovered when the reload fails on that config too. A LuCI save
of network also reloads dnsmasq and unbound, because LuCI's ucitrack has
network affect dhcp. uapi leaves them out on purpose: from this package
dnsmasq.init reads only ula_prefix of the globals, which no resource here
writes, and unbound that and the names of the interface sections, and both
reload on the netifd events of the interfaces that they serve (docs/raw.md).
So a network write takes no lock of unbound and does not wait for unbound.
Editing the interface that backs your management connection is dangerous.
/etc/init.d/network reload returns exit 0 even when an interface fails to
come up at runtime; uapi only sees the init script's exit code, not the
daemon's runtime convergence.
| Path | Wraps | Notes |
|---|---|---|
firewall/zones |
config zone |
input/output/forward policies, network list. |
firewall/rules |
config rule |
Nested match: {src_zone, dest_zone, src_ip, dest_ip, src_port, dest_port, proto, family, mark, dscp}. MARK and DSCP targets carry set_mark / set_xmark and set_dscp. src_zone is required only for NOTRACK, matching fw4. A read also gives the HELPER target that LuCI writes. A write refuses it, except in a PATCH that sends it back: a PUT removes the set_helper option, which uapi does not model, and firewall4 skips a HELPER rule without it. A negated match, such as ! 22, can have blanks after the !, as LuCI writes it. |
firewall/redirects |
config redirect |
DNAT + NAT loopback reflection. DNAT and SNAT. Every match field except proto is a scalar, because firewall4 refuses a list on them and drops the section. match.src_dip is the external address matched on a DNAT (and the address NAT reflection uses) and the rewrite source on an SNAT, where it is required along with a named match.dest_zone. Prefer firewall/nat for new source NAT; LuCI migrates these sections there. |
firewall/nat |
config nat |
Source NAT: SNAT (snat_ip / snat_port), MASQUERADE, or ACCEPT to exempt traffic from rewriting. match.src_zone is the outbound zone. An unset match.family means IPv4 only, which is fw4's default for NAT. A read also gives the NPT target that firewall4 of OpenWrt main takes, with its snat_ip, and a write refuses a change to it. |
firewall/forwardings |
config forwarding |
Zone-to-zone forwarding. |
firewall/defaults (singleton) |
config defaults |
Global verdicts, syn_flood, synflood_burst/rate, tcp_syncookies, flow_offloading. |
Reload: firewall (fw4).
| Path | Wraps | Notes |
|---|---|---|
wireless/devices |
config wifi-device |
Radios (mac80211/broadcom, and a read also gives the type of a vendor driver, which a write refuses as a change), the path, macaddr, phy and radio that bind them to their hardware, band, channel, htmode, country, txpower, cell_density, legacy_rates. |
wireless/interfaces |
config wifi-iface |
SSIDs, with every 802.11r option of LuCI's WLAN roaming tab. key, r0kh and r1kh are write-only, and a PUT that leaves them out keeps them. Responses include has_key, has_r0kh and has_r1kh. wifi-scripts writes key, nasid, mobility_domain, r1_key_holder, r0kh and r1kh into the daemon's config as lines, so a write refuses a newline in them, more than 1024 bytes in each of them but key, and a key holder entry that hostapd reads and cannot parse. A write is refused for such a value only when it adds the error, for example when it changes the field, sets the SSID up, which wifi-scripts does only while the SSID and its radio are enabled, or turns 802.11r on. A write also refuses the values that the daemons refuse or misread: an ssid over 32 bytes, a key in a form that hostapd or wpa_supplicant refuses for the mode and encryption, a nasid over 253 bytes on an EAP access point, ieee80211r with owe on an access point, a reassociation_deadline outside 1000 to 65535, a mobility_domain other than 4 hex digits, an r1_key_holder other than 12, mode wds, and an encryption that starts with wep in mode mesh, or where the router does not set WEP up. WEP needs the shell wifi-scripts and the daemon of the mode built with WEP: hostapd in mode ap, wpa_supplicant in mode sta or adhoc. The ucode wifi-scripts, which OpenWrt builds by default, give the daemon no WEP key, and the SSID runs without encryption. uapi asks hostapd -vwep or wpa_supplicant -vwep, as LuCI does, at most once per request and only for a WEP value. The same rule applies to these: a write that leaves a stored value as it is is refused for it only when it makes the daemon read it. hostapd reads mobility_domain as the mobility domain with 802.11r, and as the EAP domain of an access point with fils, which uapi does not model. That domain takes any form, so a newline or a length in mobility_domain counts on an EAP access point too, and its form only with 802.11r. A write to wireless/devices that turns a radio on is refused while an enabled SSID of the radio holds any of these values. The validation sweep lists every SSID that holds such a value. These rules follow the ucode wifi-scripts, which OpenWrt 25.12 builds by default. They were not checked against the shell wifi-scripts, which OpenWrt 24.10 uses: uapi supports 25.12 and later, where the shell variant runs only on an image built without CONFIG_WIFI_SCRIPTS_UCODE. A write that changes encryption to an EAP mode requires key. LuCI writes an EAP SSID without one, and a write that leaves encryption out or sends it back unchanged, such as a PUT of the read, passes on it. encryption also takes the sae-compat, wpa3-192, wpa-mixed, wep-open and wep-shared that LuCI writes, and psk3 and psk3-mixed, which wifi-scripts takes as sae and sae-mixed. A read also reports mode ahdemo, which LuCI writes and wifi-scripts skips, and a write refuses a change to it. A create or a PUT that sends no mode stores ap, which a read reports for a section with no mode. A write that sends a null mode answers 422 required: wifi-scripts sets up no interface without a mode, and storing ap would turn a station into an access point. runtime carries iwinfo state. |
Reload: network. A LuCI save of wireless also reaches odhcpd, dnsmasq and
unbound, because LuCI's ucitrack has wireless affect network, which affects
dhcp. None of them reads /etc/config/wireless, so a wireless write leaves
them out (docs/raw.md). Requires rpcd-mod-iwinfo at runtime for the
runtime block on wireless/interfaces.
| Path | Wraps | Notes |
|---|---|---|
dhcp/hosts |
config host |
Static leases. macs (the whole uci list mac), ip, name, leasetime, duid, tag (tags the host sets), match_tag (tags a request must carry). dnsmasq.init joins mac and tag with spaces and splits the words, so a list entry a b reads as two. A MAC octet can be *, which dnsmasq and LuCI take. odhcpd cannot parse such a MAC and skips the whole host. |
dhcp/servers |
config dhcp |
Per-interface server config. runtime carries active-lease counts. dhcpv4, ra_flags and ra_slaac are the options that odhcpd.defaults writes into the stock lan section. ra_flags reads null when unset, which odhcpd takes as other-config only, and ["none"] sets no flag. A read gives the flags that odhcpd sets: uci passes it the words of an option split at spaces and tabs, or each list entry whole, and odhcpd stops at the first word that is no flag name. When it sets none, such as for an option of spaces, the read gives ["none"]. dhcpv4 takes the four modes of ra. odhcpd has no DHCPv4 relay, so dnsmasq and odhcpd both serve on every value but disabled, and odhcpd reads dhcpv4 only when dhcp/odhcpd sets maindhcp. An unset dhcpv4 differs by platform: the dnsmasq of OpenWrt 25.12 serves it, and the dnsmasq of OpenWrt main takes it as disabled (dnsmasq.init, config_get dhcpv4 "$cfg" dhcpv4 disabled), as odhcpd does. LuCI's DHCP setup writes server. dhcp_option takes one option per entry, because dnsmasq.init passes each entry to dnsmasq whole and dnsmasq reads it as one option. An entry answers 422 invalid_format when, outside a quoted string, a field that reads as an address, such as 10.0.0.1 or [::], is followed by whitespace and then by what starts a dhcp-option value: a number and a comma, option:, option6:, tag:, net:, set:, vendor:, encap: or vi-encap:, as in 3,10.0.0.1 6,10.0.0.1. LuCI's form takes any entry. A text option with spaces, such as 15,my domain or 15,my 6,domain, stays valid, and a write that leaves a stored list as it is passes. Other entries that dnsmasq refuses, such as 3,10.0.0.1, 6,10.0.0.1, pass the rule and are left to the --test check below. |
dhcp/dnsmasq (singleton) |
config dnsmasq |
Global dnsmasq tuning; forwarders, address overrides, rebind protection. dnsmasq.init passes server and address with config_list_foreach, so an option of either reads null. |
dhcp/odhcpd (singleton) |
config odhcpd |
maindhcp, leasefile, loglevel. maindhcp reads true only for 1 in the section named odhcpd, which both daemons take. dnsmasq.init stops serving DHCPv4 for any number above 0 in that section, and odhcpd takes true too and keeps the value that it has for any other value or no option, since a reload does not reset it. A write that sends maindhcp stores 1 or 0 even when the read already gives that value, so that both daemons agree, and null removes the option. LuCI shows a value other than 1 unchecked and removes the option when it saves the form. |
dhcp/leases (read-only collection) |
/tmp/dhcp.leases |
IPv4 leases parsed from dnsmasq's lease file. |
dhcp/leases6 (read-only collection) |
the leasefile of odhcpd, /tmp/odhcpd.leases by default |
IPv6 leases from odhcpd. Per-IA-address entries. |
Reload: each write reloads the daemons that read what it writes, in this order,
and each of them only while procd runs it. dhcp/servers and dhcp/hosts
reload dnsmasq, odhcpd and unbound. odhcpd reads a server section too,
ra, dhcpv6 and ra_default among others, and the static leases of a host.
unbound reads interface and ignore of a server section, and makes records of
the name and ip of a host when its add_extra_dns is set. dhcp/odhcpd
reloads odhcpd, dnsmasq and unbound, because dnsmasq.init reads maindhcp
and unbound makes the directory of leasefile. dhcp/dnsmasq reloads dnsmasq
and unbound, which reads domain and port when it forwards local names to
dnsmasq. procd runs a daemon while it holds a config.change trigger for it,
from the start of the service to its stop, whatever its instances show, which is
when a LuCI save reloads it. A daemon that the router does not ship, that the
operator stopped, or that has no such trigger yet, as unbound at boot until 3 s
after the last interface event, is skipped: the write does not answer 503
init_script_missing for it, and its reload does not start it, as the reload of
dnsmasq.init and unbound.init would. When the service list call fails, uapi
cannot tell, and reloads the daemon. A write when none of them runs answers 2xx
with X-Reload-Status: no_reload. LuCI saves through rpcd, which fires the
procd reload trigger on dhcp of each daemon that procd lists with one. A
commit through libuci fires none, so uapi runs the reloads above itself. A write
takes the lock of unbound too while /etc/init.d/unbound exists, before it
asks procd which daemons to reload, so a write to the unbound packages, or a
system write that can reload unbound, at the same moment answers 423 locked,
whether unbound runs or not. When unbound ran before the write, it waits 2 s for
unbound to keep running, as a write to unbound/server does.
After a write that reloads dnsmasq, uapi runs the command of each dnsmasq
instance with --test on the config that dnsmasq.init just wrote. If dnsmasq
refuses it, the write answers 500 reload_failed_restored and restores the
previous config. dnsmasq refuses a line such as a dhcp_option of
3,not-an-address in a section that it reads, one that is not ignored, on an
interface that is up and static. The check covers every instance, one that is
not running included, so on a router whose dnsmasq config was refused before the
write, a write that does not fix it answers 500 reload_failed_unrecovered. A
--test that cannot run, because fork fails, fails the write in the same way. A
--test that does not finish within 10 s, such as one that reads a conf-file
on a mount that hangs, or that another SIGKILL stops, is killed and judges
nothing: the write keeps its commit and answers 2xx with X-Reload-Status:
unverified. A target that takes longer than 10 s to parse its config, such as a
slow router with large adblock lists, answers unverified on every dhcp write.
--test only parses: a config that dnsmasq parses but cannot start with, such
as one whose port another daemon holds, still answers 2xx. No write waits for
the daemon to start, and each pays one parse of the whole config per instance,
which grows with its size, and again on a restore. A write that does not reload
dnsmasq, because procd does not run it, runs no check.
| Path | Wraps | Notes |
|---|---|---|
system (singleton) |
config system |
hostname, timezone, log_size, log_ip, log_proto, log_remote, urandom_seed. Reloads system and log, then dnsmasq, odhcpd and unbound while procd runs each: dnsmasq.init and unbound read the hostname, and odhcpd the timezone. It runs no dnsmasq --test check. While /etc/init.d/unbound exists, the write takes the lock of unbound, so a write to unbound/server, unbound/srv, unbound/ext or the dhcp package at the same moment answers 423 locked, whether unbound runs or not, and when unbound ran before the write, it waits 2 s for unbound to keep running. |
system/timeservers |
config timeserver |
NTP server list; reloads sysntpd, then dnsmasq while procd runs it, because dnsmasq.init reads enabled for DNSSEC. It runs no dnsmasq --test check. |
system/password |
/bin/busybox passwd (non-uci, write-only) |
POST {user, password} -> 204. Audit-logged without password. |
system/authorized_keys |
/etc/dropbear/authorized_keys (non-uci) |
GET/POST/PUT/DELETE for SSH key entries. Server-side key-type validation. |
system/cron_jobs |
/etc/crontabs/root (non-uci) |
GET/POST/DELETE for one crontab line each. Lines from packages stay as they are. runtime.crond_running reports whether crond runs, and runtime.runs_as_written flags a line crond misreads. |
| Path | Wraps | Notes |
|---|---|---|
dropbear/instances |
config dropbear |
Per-instance SSH config (port, password_auth, root_login, etc.). |
uhttpd/instances |
config uhttpd |
Per-instance HTTP server. Validate refuses to strip uapi's own ucode_prefix from main (self-lockout protection). |
uhttpd/certs |
config cert |
px5g cert generation params. A write refuses a change of days to 0, for which px5g makes a certificate that has already expired. |
unbound/server (singleton) |
config unbound |
Recursive DNS tuning. |
unbound/srv (singleton) |
config unbound_srv 'main' |
Server-clause directives (interface_bind, interface_outgoing, ip_transparent, plus a raw srv_line passthrough). Requires apk add unbound-uci-ext from the openwrt-iac feed; otherwise the first write returns 503 init_script_missing. |
unbound/ext (singleton) |
config unbound_ext 'main' |
Outside-server clauses (forward-zone:, view:, stub:, remote-control:) expressed as a verbatim ext_line list (one entry per rendered line). Same install dependency as unbound/srv. |
sqm/queues |
config queue |
Per-interface SQM shaping. |
snmpd/agents |
config agent |
SNMP listen addrs. |
snmpd/com2secs |
config com2sec |
community-to-security mapping. |
snmpd/groups |
config group |
SNMP group definitions. |
snmpd/accesses |
config access |
group-to-view ACLs. |
snmpd/system (singleton) |
config system (snmpd) |
sys_location, sys_contact, etc. (snake_case in v2). |
lldpd/config (singleton) |
config lldpd 'config' |
LLDP/CDP/etc. toggles. |
prometheus_node_exporter_lua/config (singleton) |
config prometheus-node-exporter-lua 'main' |
listen_interface + listen_port. |
vnstat/config (singleton) |
config vnstat |
interfaces, the devices vnstat tracks (kernel device names, not uci interface names). The only vnstat option any shipped code reads. |
mwan3/globals (singleton) |
config globals |
mmx_mask, logging, loglevel. |
mwan3/interfaces |
config interface (mwan3) |
Per-WAN tracking: track_ip, track_method, probe sizing and timing, up/down thresholds, flush_conntrack. |
mwan3/members |
config member |
Binds an mwan3/interfaces section to a metric and a weight. |
mwan3/policies |
config policy |
use_members plus a last_resort verdict. |
mwan3/rules |
config rule (mwan3) |
Traffic match (family, proto, src/dest ip and port, ipset) routed to a use_policy. |
openvpn/instances |
config openvpn |
Per-instance OpenVPN config. key, tls_auth and pkcs12 are write-only; responses carry has_key / has_tls_auth / has_pkcs12. |
usteer/config (singleton) |
config usteer |
Band-steering and roaming thresholds for the usteer daemon. |
When unbound runs, a write to one of the three unbound resources waits 2 s after
the reload. If unbound stops in that time, the write answers 500
reload_failed_restored and restores the previous config. unbound stops for a
line of srv_line or ext_line that it cannot parse. Two of these writes at
the same time answer 423 locked for the second, because each restarts unbound,
and so does one of them beside a dhcp or system write, which can reload
unbound.
| Path | Source of truth | Notes |
|---|---|---|
packages/installed |
apk DB | GET lists, POST {name} installs (apk add), DELETE /<name> removes. |
packages/feeds |
/etc/apk/repositories.d/*.list |
POST {name, url} creates a feed file + apk update. |
OpenWrt's uci distinguishes named sections (stable identifier across
rewrites) from anonymous sections (auto-assigned cfgXXXXXX ids that change
on rewrite). Anonymous ids are useless for IaC state tracking.
uapi-managed sections are always named: when a client POSTs to create a
resource, the server emits a ULID-style identifier (Crockford base32,
alphanumeric only, fitting uci's [A-Za-z0-9_] charset) and writes it as the
section's .name. From that point on, the section behaves like any other named
uci section and its id is stable. Optional one-character type prefix for
grep-ability (r_01HX... for rules, i_01HX... for interfaces). No uapi_
namespace prefix; uapi is just another writer to uci.
Section names are caller-pickable on every CRUD resource (since 2.2.0). POST
/<resource> accepts an optional id field; if supplied it becomes the section
name (after charset / length / collision checks). Absent, the server emits the
ULID.
The common starting state for a router under management is a mix of LuCI-named sections, hand-edited sections, and anonymous sections from prior tooling. Posture: read-only by default, explicit adoption.
GET /<resource> returns existing anonymous sections with a content-derived
synthetic id and managed: false.PUT/PATCH/DELETE on a managed: false section returns 409
unmanaged_resource.POST /<resource>/<id>/adopt on an anonymous section renames it under
uapi's ULID scheme and flips it to managed: true. The section is writable
like any other after that.POST /<resource>/<id>/adopt on a named section is an idempotent
acknowledgement: the section keeps its name and the response carries the
existing view with managed: true. The 2.2.0 behavior change replaced the
prior rename-to-ULID which broke uci cross-references where sections
referenced this one by name (firewall.zones.lan → firewall.rules.src_zone =
"lan").Sections that already have a .name (e.g. LuCI-named myrule) are managed
normally, using their existing .name as the id. uapi does not rewrite names it
didn't author.
GET on a collection includes both managed and unmanaged sections by default.
Clients filter via ?managed=true / ?managed=false when they want one or the
other. The Link to the next page keeps the filter.
/api/v3/raw/<package>/<id> is the escape hatch for any uci config type
uapi doesn't curate. See docs/raw.md for full semantics, scope
composition rules, and stability caveat.
| Path | Auth | Notes |
|---|---|---|
GET /healthz |
none | {status, version, checks: {ubus, uci, lock_dir, time_sync}}. 503 when any subsystem is degraded. |
GET /openapi.json |
none | The OpenAPI 3.1 spec. |
GET /schema/<package>/<resource> |
none | One resource's schema_properties. GET /schema lists all keys. |
GET /auth/whoami |
any token | Token introspection: token_id, scopes, source_ip, expires_at, allowed_cidrs, last_used_at, last_used_ip. |
GET /tokens, POST /tokens, DELETE /tokens/<id> |
uapi:tokens:rw (or *:rw) |
HTTP token rotation. POST requires the caller's scopes to cover the requested scopes, equal or narrower. |
GET /metrics |
uapi:metrics:ro (or *:ro) |
Prometheus 0.0.4 text. |
GET /diagnostics |
uapi:diagnostics:ro |
Version, uptime, loaded resources, current lock holders. |
POST /batch |
each sub-request scope-checked | Multi-package all-or-nothing transaction (max 50 ops). |