Skip to main content

API Reference

All API endpoints are served on the admin listener (127.0.0.1:9443 by default). Authenticated endpoints require a valid session cookie (kwaf_session) and CSRF token.

Setup

MethodPathDescription
GET/api/v1/setup/statusCheck if initial setup has been completed
POST/api/v1/setup/initCreate the first admin user and optionally configure SMTP

Authentication

MethodPathDescription
POST/api/v1/auth/loginAuthenticate with username and password
POST/api/v1/auth/logoutDestroy the current session
POST/api/v1/auth/magic-linkRequest a passwordless login email
GET/api/v1/auth/verifyVerify a magic link token and create a session

Proxy Hosts

MethodPathDescription
GET/api/v1/hostsList all proxy hosts
POST/api/v1/hostsCreate a new proxy host
GET/api/v1/hosts/{id}Get a proxy host by ID
PUT/api/v1/hosts/{id}Update a proxy host
DELETE/api/v1/hosts/{id}Delete a proxy host

WAF Rules

MethodPathDescription
GET/api/v1/rulesList all WAF rules (filterable by host_id)
POST/api/v1/rulesCreate a custom WAF rule
GET/api/v1/rules/{id}Get a WAF rule by ID
PUT/api/v1/rules/{id}Update a WAF rule
DELETE/api/v1/rules/{id}Delete a WAF rule

Traffic & Analytics

MethodPathDescription
GET/api/v1/trafficQuery request logs with filters (host, IP, status, action, time range)
GET/api/v1/analytics/top-ipsTop source IPs by request and block count
GET/api/v1/analytics/top-hostsTop attacked hosts
GET/api/v1/analytics/timelineTraffic timeline with allowed/blocked/detected buckets
GET/api/v1/analytics/top-rulesMost frequently triggered WAF rules
GET/api/v1/analytics/geoGeographic traffic distribution by country
GET/api/v1/eventsServer-Sent Events stream for live traffic

Dashboard & System

MethodPathDescription
GET/api/v1/dashboardAggregate dashboard stats (host count, request count, block rate, top rule)
GET/api/v1/auditAdmin audit log
POST/api/v1/reloadHot reload proxy hosts and WAF rules from the database

SMTP & Notifications

MethodPathDescription
GET/api/v1/smtpList SMTP sending profiles
POST/api/v1/smtpCreate an SMTP profile
PUT/api/v1/smtp/{id}Update an SMTP profile
DELETE/api/v1/smtp/{id}Delete an SMTP profile
POST/api/v1/smtp/testTest SMTP connection

Users

MethodPathDescription
GET/api/v1/users/meGet the currently authenticated user