Skip to content

Appendix C. REST API

Anything you can do in the Web UI can be done by a program: the Web UI itself uses this API. The full list of operations with request and response schemas is in the API reference. This chapter shows how to get started, with ready-to-use examples.

C.1. Address and certificate

The API is at https://<appliance address>:8443/api/v1, reachable from the same addresses as the Web UI (management is never open to the internet).

By default the Web UI has a self-signed certificate. For programs, issue a Let's Encrypt certificate for the Web UI (System → Web UI certificate). In a lab you can save the current certificate and pass it to curl:

openssl s_client -connect 192.168.1.1:8443 </dev/null 2>/dev/null | openssl x509 > arxis.crt

Compare its fingerprint (openssl x509 -in arxis.crt -noout -fingerprint -sha256) with the one your browser shows for the Web UI.

C.2. API token

Programs authenticate with an API token, not with the administrator password:

  1. Web UI → Users → API tokens (for programs) → Create token.
  2. Enter a name (for example crm-sync), a role and an expiry. In the addresses field list the addresses or networks the program will connect from: the token is rejected from anywhere else.
  3. Copy the token (fwat_…) — it is shown once. The appliance stores only its hash.
Role Allowed
viewer Read only: status, attack log, configuration, charts
admin Everything except managing users, tokens, 2FA, the audit log, automatic backup and the Web UI certificate

Send the token as Authorization: Bearer fwat_…. With a token, X-CSRF-Token and two-factor authentication are not required. Changes made with a token are recorded in the version history and audit log with the author token:<name>.

In the examples below:

export ARX=https://192.168.1.1:8443/api/v1
export TOKEN=fwat_...        # the token from the Web UI
arx() { curl -s --cacert arxis.crt -H "Authorization: Bearer $TOKEN" "$@"; }

C.3. Status and attack log

arx $ARX/status | jq '.services'

The latest blocked SQL injections:

arx "$ARX/events?action=blocked&attack_type=sqli&limit=20" \
  | jq -r '.items[] | [.timestamp, .source_ip, .host, .path] | @tsv'

Filters: action (blocked, detected), attack_type, source_ip, application_id, host, path, country, from and to (RFC 3339), limit (up to 500) and offset. A 24-hour summary with the top attacks, addresses and paths:

arx $ARX/events/summary | jq '{blocked, detected, top_sources}'

The same in Python (standard library only):

import json, os, ssl, urllib.request

BASE = "https://192.168.1.1:8443/api/v1"
ctx = ssl.create_default_context(cafile="arxis.crt")
req = urllib.request.Request(
    f"{BASE}/events?action=blocked&limit=5",
    headers={"Authorization": f"Bearer {os.environ['TOKEN']}"},
)
with urllib.request.urlopen(req, context=ctx) as r:
    for e in json.load(r)["items"]:
        print(e["timestamp"], e["source_ip"], e["host"], e["path"], e.get("attack_types"))

C.4. Changing the WAF configuration

The WAF configuration (applications, policies, global access rules) is a single versioned document. To change it:

  1. GET /config — the current configuration and an ETag header (the version number).
  2. Edit the document.
  3. PUT /config with an If-Match: <ETag> header.

Arxis validates and compiles the whole configuration, applies it and checks that the inspector and proxy have picked it up. If not, it restores the previous one (response 502). If someone changed the configuration after your GET, the response is 412: reload and try again.

Block an address on all websites (global deny list):

arx -D headers.txt $ARX/config -o config.json
ETAG=$(grep -i '^etag:' headers.txt | tr -d '\r' | cut -d' ' -f2)

jq '{config: (.config | .global.acl.deny_cidrs += ["203.0.113.66/32"]),
     comment: "block scanner"}' config.json \
  | arx -X PUT -H 'Content-Type: application/json' -H "If-Match: $ETAG" \
        --data @- $ARX/config | jq '{version, comment}'

Note the -X PUT: without it curl sends --data as a POST.

Validate without applying — send the same document to POST /config/validate. Errors are reported per field:

{"valid": false, "errors": [{"field": "global.acl.deny_cidrs[0]", "message": "invalid IP address or CIDR"}]}

Add a website (in Detection mode first):

jq '{config: (.config | .applications += [{
      id: "blog", name: "Blog", domains: ["blog.example.uz"],
      policy: {mode: "detection", sensitivity: "medium", fail_mode: "open", rule_exclusions: []},
      origin: {protocol: "http", verify_tls: true, timeout_seconds: 30,
               servers: [{address: "10.0.0.20", port: 80, weight: 100}]},
      tls: {certificate_id: "", redirect_http: false, hsts: false}}]),
     comment: "add blog"}' config.json \
  | arx -X PUT -H 'Content-Type: application/json' -H "If-Match: $ETAG" --data @- $ARX/config

All application fields are in the reference (the ApplianceConfig schema). If a website is already set up in the Web UI, look at how it appears in GET /config first.

History and rollback:

arx "$ARX/config/versions" | jq '.items[:5] | map({version, comment, created_by})'
arx -X POST -H "If-Match: $ETAG" $ARX/config/versions/2/rollback

A rollback also creates a new version and needs a current If-Match.

C.5. Other common tasks

Task Operation
Temporary blocks (auto-blocking, rate limits) and removing them GET /blocks, DELETE /blocks?app=…&ip=…
Block a device on the network (router address list) POST /router/address-lists/{name}/entries
Add a WireGuard client and get its configuration POST /router/wireguard/{iface}/peers
Issue a Let's Encrypt certificate for a website POST /certificates/acme
Import virtual patches from a ZAP or Burp report POST /virtual-patches/import
License status GET /license
Configuration backup POST /system/backup

Router changes via PUT /router are applied with confirmation: without POST /router/confirm within the given time they roll back. Targeted operations (address lists, WireGuard clients) apply immediately.

C.6. Responses and errors

Code Meaning
200, 201, 204 Success
400, 422 Bad request, or the configuration failed validation (details in errors)
401 No token, or the token is wrong, expired or deleted
403 Insufficient role (administrator role required), the operation is not available with a token (not available with an API token), or the request comes from an address the token does not allow
412 The configuration changed after your GET — reload it
501 The feature is not available on this installation
502 The inspector or proxy did not confirm the configuration — the previous one was restored

Errors use application/problem+json (RFC 9457): fields type, title, status, detail.

C.7. Security

  • Give a program the smallest role it needs: monitoring and reports only need viewer.
  • Always restrict the token's addresses and set an expiry.
  • Treat a token like a password: keep it in a secrets manager, not in code or a repository.
  • Delete unused tokens (Users → API tokens (for programs)), where the last-used time is shown.