docs/Reference
Self-hosted API
kagicyber serve: run audits over HTTP from your own dashboard or scheduler.
terminal
export KAGICYBER_API_KEYS="$(openssl rand -hex 24)"npx kagicyber serve --port 8787 # listens on 127.0.0.1; set HOST=0.0.0.0 in a containerSend a key as Authorization: Bearer <key>. Keys come from KAGICYBER_API_KEYS (comma-separated) and are compared as SHA-256 digests in constant time.
#Endpoints
| Method | Path | Notes |
|---|---|---|
GET | /healthz | { ok, version, rules } |
GET | /v1/rules | Rule catalog: jurisdictions, site types, rule counts |
POST | /v1/audit?format=json | Body { target, browser?, country? }. format is json, markdown, html, prompt or all. 5 requests per minute per key |
#Response
response
{ "scores": { "compliance": 58, "complianceCoverage": 91, "complianceCore": 71, "security": 74, "grade": "C", "seo": 62, "seoCoverage": 100, "risk": "high" }, "result": { "...the same JSON as kagicyber audit --json..." }, "markdown": "# KagiCyber audit: example.com (2026-11-20) ...", "html": "<!DOCTYPE html> ...", "prompt": "You are a senior web developer. Fix the problems ..."}Errors: 400 invalid input, 401 bad key, 404, 413 body too large, 429 rate limit, 500.
#Docker
terminal
docker build -t kagicyber .docker run -p 8787:8787 -e KAGICYBER_API_KEYS="$(openssl rand -hex 24)" kagicyber- Put it behind HTTPS: your platform's TLS, Caddy or nginx.
- Audits make outbound requests to the audited site and to public DNS, so allow egress.
- The real-browser test needs Playwright and Chromium in the image; without them, browser-dependent rows become MANUAL.
- Rate limits are in memory per instance; use a shared store before scaling horizontally.
- Log metadata only (host, scores, duration), never evidence.