ASCS Cloud Download V128
API/api/v1 — the management surface
Download V128

Go + HTTPS · LAN-only · RBAC admin/operator/viewer

The API is the console,
underneath.

Everything the management UI does goes through the same /api/v1 surface. This page documents the auth model, the RBAC matrix, health semantics, and every registered route — verified against the Preview 128 source tree.

Basics

  • Base URL: https://<lan-ip>/ (default 443; https://<lan-ip>:8443 also works). HTTP on 80/8080 redirects to HTTPS — as does a mistyped http://<lan-ip>:8443.
  • Management is LAN-only. The listener binds to the LAN interface after setup (SO_BINDTODEVICE). Do not expose it to the WAN — use a VPN for remote access.
  • Transport: TLS by default. First boot uses a self-signed certificate; replace it with one from your local CA or import a PEM pair (administrator manual · TLS). curl examples below use -k to tolerate that self-signed default — remove -k once a trusted certificate is installed.
  • Format: JSON in, JSON out. Errors are shaped {"error": "…"} with a non-2xx status. Collection writes use ETag / If-Match concurrency control, an apply lock, and file snapshot/rollback underneath.
  • Reconnect hint: writes that touch network state return X-ASCS-Reconnect: 1 so clients know to re-establish sessions.
  • Audit: every mutating request is appended to the audit log with actor, client IP, action, and result — read-only at /api/v1/audit.

Authentication

Two equivalent ways to authenticate, plus a first-boot setup path:

MechanismHowNotes
Session cookiePOST /api/v1/auth/login with username/password; cookie set for subsequent requests.Passwords are Argon2id (legacy hashes migrate to PBKDF2-on-login). Login is rate-limited: 5 failures per 5 minutes per source IP.
API keyAuthorization: Bearer <key-secret>Scoped, expirable, revocable, rotatable keys. The secret is shown once at creation — store it like a password. Keys authenticate as key:<id>; their role is derived from their scopes.
First-boot setupTokenless setup bound to the first enabled LAN interface; optional setup code from the console.Usable only before setup completes: /api/v1/system, /api/v1/config, /api/v1/setup/status, /api/v1/setup/apply.
# 1) Log in and keep the session cookie
curl -sk -c jar.txt -X POST https://10.10.0.1/api/v1/auth/login \
  -H 'Content-Type: application/json' \
  -d '{"username":"admin","password":"…"}'

# 2) Use the session
curl -sk -b jar.txt https://10.10.0.1/api/v1/auth/me

# 3) Or use an API key
curl -sk https://10.10.0.1/api/v1/stats \
  -H 'Authorization: Bearer ascs_…'

RBAC matrix

Roles: admin, operator, viewer. The matrix below is enforced server-side — hidden buttons are not the security boundary.

Capabilityvieweroperatoradmin
Read any object (GET/HEAD/OPTIONS)✓✓✓
Create/update/delete network objects (rules, NAT, DHCP, aliases, schedules, routes, reservations, filters, interfaces, uplinks, segments, bridges, public IPs, source-NATs, policy routes)—✓✓
PUT /api/v1/config (raw config replace)——✓
POST /api/v1/setup/apply——✓
Users (/api/v1/users…)——✓
API keys (/api/v1/api-keys…)——✓
Certificates & local CA (/api/v1/certificates…)——✓
PUT /api/v1/system/timezone · PUT /api/v1/system/power · POST /api/v1/system/factory-defaults——✓
Diagnostics ping/traceroute (POST /api/v1/diagnostics/ping, …/traceroute)——✓
Diagnostics read, firewall-test, capture, bundle✓ (read)✓✓
Apps: list, logs, install/start/stop/uninstall/update actions—✓✓
Update center: status (read) / apply / rollbackreadapply/rollbackapply/rollback
Own password change / logout✓✓✓

API-key scopes map to a role via scopeRole; a read-only scope yields a viewer-equivalent key. Rotate keys with POST /api/v1/api-keys/{id}/rotate; revoke with DELETE /api/v1/api-keys/{id}.

Health semantics (GET /api/v1/health)

Public, no auth — safe for monitoring. 200 means the management plane and dataplane prerequisites are present, not merely that the Go process is up.

$ curl -sk https://10.10.0.1/api/v1/health
{
  "status": "ok",
  "checks": {
    "nftables": "ok",
    "nat": "ok",
    "default_route": "ok",
    "dnsmasq": "ok",
    "systemd-networkd": "ok"
  }
}

If any check fails the endpoint returns 503 with "status":"degraded" and the failing keys set to missing / not active / not installed. A degraded result with default_route: missing means the WAN is not providing a default route — reachable UI, dead uplink. Wire this into your monitoring; details in the administrator manual.

Route index

Every route registered in Preview 128. Collection routes support list/create/get/update/delete unless marked read-only. Network-affecting writes return X-ASCS-Reconnect: 1.

Auth & session

Method & pathPurpose
POST /api/v1/auth/loginSession login (rate-limited).
POST /api/v1/auth/logoutEnd the session.
GET /api/v1/auth/statusAuth subsystem status (public).
GET /api/v1/auth/meCurrent user and role.
POST /api/v1/auth/passwordChange own password.

Setup & system

Method & pathPurpose
GET /api/v1/setup/statusFirst-boot claim status.
POST /api/v1/setup/applyApply first-boot setup (admin).
GET /api/v1/systemSystem identity/version.
GET /api/v1/system/hardwareHardware profile (NICs, boot device, BIOS info).
GET/PUT /api/v1/system/timezoneTimezone (PUT = admin).
GET/PUT /api/v1/system/powerPower profile, e.g. power-on-after-AC-loss (PUT = admin).
GET/PUT /api/v1/system/sshKey-only SSH enable/restrict; disabling clears the authorized keys.
POST /api/v1/system/rebootReboot the appliance.
POST /api/v1/system/factory-defaultsFactory defaults (admin; destructive).

Users & API keys (admin)

Method & pathPurpose
GET/POST /api/v1/users · GET/PUT/DELETE /api/v1/users/{id}Named admin/operator/viewer accounts.
GET/POST /api/v1/api-keysList / create scoped, expirable keys (secret shown once).
POST /api/v1/api-keys/{id}/rotateRotate a key’s secret.
DELETE /api/v1/api-keys/{id}Revoke a key.

Config collections — CRUD (list/create/get/update/delete)

CollectionPathWhat it holds
Uplinks/api/v1/uplinksWAN interfaces: DHCP/static/PPPoE, gateway, metric, healthCheck/healthTarget, MSS clamp.
Segments/api/v1/segmentsLAN/OPT: interface, VLAN, subnet, DHCPv4 ranges/leases, DHCPv6 mode, IPv6 prefix hints, MAC, aliases.
Public IPs/api/v1/public-ipsRouted/assigned public addresses; explicit Unassigned / Avail filter in the UI.
Bridges/api/v1/bridgesBridge groups.
Port forwards/api/v1/port-forwardsDNAT: shared IP, ports (1–65535, !5000), target[:port], protocol, egress. Catch-all forwards are the 1:1 NAT building block.
IPv4 rules/api/v1/ipv4-rulesOrdered policy: action, interface, source/destination, ports, alias/schedule-aware.
IPv6 rules/api/v1/ipv6-rulesThe IPv6 counterpart.
Source NATs/api/v1/source-natsOutbound source rewriting per interface.
Policy routes/api/v1/policy-routesSource-based next-hop selection with metric — the multi-WAN scalpel.
Aliases/api/v1/aliasesHost / Network / Port aliases.
Schedules/api/v1/schedulesTime windows for rules.
Static routes/api/v1/static-routesStatic destinations via chosen interface/gateway.
Domain filters/api/v1/domain-filtersDNS domain blocking (domain and subdomains) via dnsmasq.
DHCP reservations/api/v1/dhcp-reservations (+ /bulk)MAC → address pinning; bulk import.

Audit (read-only)

GET /api/v1/audit · GET /api/v1/audit/{id} — append-only in the UI; every authenticated mutation lands here with actor, IP, action, target, and result. Filter here before you touch anything else when something changed overnight.

Monitoring

Method & pathPurpose
GET /api/v1/statsInterface rates, load, memory, conntrack and session counts.
GET /api/v1/wan-healthPer-uplink health probe results and failover state.
GET /api/v1/neighborsARP/NDP neighbor table — find what’s on the wire.
GET /api/v1/dhcp/leasesActive DHCPv4 leases (pairs with reservations).

Diagnostics

Method & pathPurpose
GET /api/v1/diagnosticsDiagnostics overview.
GET /api/v1/diagnostics/bundleRedacted, downloadable support bundle from Settings.
POST /api/v1/diagnostics/pingPing (admin).
POST /api/v1/diagnostics/tracerouteTraceroute (admin).
POST /api/v1/diagnostics/firewall-testExplain this flow — IPv4 forward-chain simulator with rule trace, alias/schedule awareness, conntrack states, LAN→WAN forwarding and DNAT acceptance.
POST /api/v1/diagnostics/captureBounded packet capture (pcap).

Update center & certificates

Method & pathPurpose
GET /api/v1/update/statusCurrent/previous slot, application version, health. Read-only.
POST /api/v1/update/applyApply a signed update; health supervision auto-rolls-back an unhealthy slot.
POST /api/v1/update/rollbackRoll back to the previous application slot.
GET /api/v1/certificatesList issued/imported certificates.
POST /api/v1/certificates/caCreate/manage the local CA (ECDSA P-256).
POST /api/v1/certificates · POST /api/v1/certificates/importIssue with DNS/IP SANs · import PEM certificate/key.
GET /api/v1/certificates/{id}/downloadDownload certificate PEM (keys are root-only, never exportable via API).
POST /api/v1/certificates/{id}/management · DELETE /api/v1/certificates/managementSelect a cert for the management listener · one-click revert to the generated cert.
DELETE /api/v1/certificates/{id}Delete a certificate.

Traffic shaping, interfaces, cloud I/O, apps

Method & pathPurpose
GET/PUT /api/v1/traffic-shapingWAN upload/download limits; Preview 128 adds granular HTB classes + flower filters (per interface, IP/CIDR, TCP/UDP port, direction, rate, ceiling, priority).
POST /api/v1/interfaces/remapRemap logical roles onto interfaces (e.g. after restore from another box).
PATCH /api/v1/config/metadataPatch config metadata without a full replace.
GET/PUT /api/v1/configWhole-config read/replace — PUT is admin-only. GET doubles as the JSON export the appliance uses for configuration backups.
GET/POST /api/v1/cloud-io/interfaces · DELETE …/{name}Cloud-side virtual NIC management (ASCS Cloud VPS edition).
GET /api/v1/apps · GET /api/v1/apps/{id}/logs · POST /api/v1/apps/{id}/{action}App Store: catalog with runtime status, logs, install/start/stop/uninstall/update-slot actions (Docker runtime).

Worked examples

# Create an alias for three management hosts
curl -sk -b jar.txt -X POST https://10.10.0.1/api/v1/aliases \
  -H 'Content-Type: application/json' \
  -d '{"name":"mgmt-hosts","type":"Host","value":"10.10.0.11,10.10.0.12,10.10.0.13","description":"admin stations","state":"Active"}'

# List IPv4 rules, ordered
curl -sk -b jar.txt https://10.10.0.1/api/v1/ipv4-rules | jq '.[] | {id,action,interface,source,destination,dport}'

# Add a port forward: public 8080 -> internal 10.10.0.20:80
curl -sk -b jar.txt -X POST https://10.10.0.1/api/v1/port-forwards \
  -H 'Content-Type: application/json' \
  -d '{"sharedIp":"<WAN-IP>","ports":"8080","target":"10.10.0.20","targetPort":"80","protocol":"TCP","state":"Active"}'

# Ask why a flow would be dropped
curl -sk -b jar.txt -X POST https://10.10.0.1/api/v1/diagnostics/firewall-test \
  -H 'Content-Type: application/json' \
  -d '{"src":"10.10.0.50","dst":"203.0.113.10","proto":"tcp","dport":443}'

# Pull a JSON configuration backup yourself
curl -sk -b jar.txt https://10.10.0.1/api/v1/config -o backup-$(date +%F).json
# (preferred: the UI’s Backups & Recovery page — see /storage.html)

# Check health the way monitoring would
curl -sk -w '\nHTTP %{http_code}\n' https://10.10.0.1/api/v1/health

The contract & CI

The Go API is covered by an OpenAPI 3.1 contract and a JSON Schema in the source tree (specs/openapi.yaml, specs/config.schema.json). CI enforces: route-versus-contract conformance, schema validation, Go tests/vet/staticcheck, JSON Schema and OpenAPI validation, ESLint/JS syntax checks for the console, and a disposable TLS/auth/API smoke test. The same checks gate the ISO. If you are building tooling against this API, this page plus those two files are the source of truth — and support@ascsonoway.com for anything ambiguous.

Client tooling.

curl + jq are enough for everything above. RFC 9110 covers the HTTP semantics (ETag/If-Match are §13.1.1). For UI behaviour with live data, see the real console captures; for update/rollback flows see the administrator manual.