{{define "content"}}
{{with .Data}}
Everything the MCP server offers, over plain HTTP. Base address Every call needs a token on the API access page, sent as Errors are JSON, Examples use Using the API
{{.Base}}; the machine-readable description
is /api/openapi.json (OpenAPI 3.1, no token needed).Authorization: Bearer rtr_….
A read token may use the read operations; a change token also the others. Changes to the
settings are saved, never applied: you review them under Changes and apply them yourself.{"error": "…"}, with the status 400 (refused or a bad argument), 401 (no or an expired token),
403 (the token's access is too low), 409 (stale ETag) or 500. Results are JSON, except the pending changes and the
journal, which are plain text.{{if .HasOptions}} GET /api/v1/options lists every router option with its type,
default and description: what settings may contain.{{end}}-k because the certificate is self-signed unless you set up a
certificate; put your token in $TOKEN.
{{.Method}} {{.Path}} {{.Summary}}Access: {{.Scope}}
{{.Description}}
{{if .Params}}| Parameter | Type | Description | |
|---|---|---|---|
{{.Name}} | {{.Type}} | {{if .Required}}required{{end}} | {{.Description}} |
Body: {{.}}
{{end}}{{.Curl}}
The settings are a tree, and every part of it has its own path below /api/v1/settings:
router/firewall, router/lans/lan (one LAN, by its name), router/dns/hosts,
system, down to a single option like router/wan/interface (lists are replaced whole; their
elements have no paths). The OpenAPI document describes each with the type of its value.
GET reads the part (404 when it is not set and the defaults apply); the ETag header is the
settings' version.PUT replaces it, PATCH merges a JSON merge patch into it (objects only), DELETE removes
it. They need If-Match with the ETag, need a change token, and are refused (400, with the place) when a value
does not fit its option's type or a key is not an option.GET /api/v1/settings/check evaluates them.curl -sk -H "Authorization: Bearer $TOKEN" https://{{.Host}}/api/v1/settings/router/dns
curl -sk -X PUT -H "Authorization: Bearer $TOKEN" -H 'If-Match: "ETAG"' \
-d '{"domain":"home.example.org","dynamicLeases":true}' https://{{.Host}}/api/v1/settings/router/dns
{{.Path}}| Option | Type | Default | Description |
|---|---|---|---|
{{.Name}} | {{.Type}} | {{with .Default}}{{.}}{{end}} | {{.Description}} |
<name> is the key of an entry in a map, * an element of a list.