ZefiraZEFIRA Docs GitHub ↗

API Reference

Cookie-authenticated JSON API for bots and dashboards.

Authenticate with POST /api/login (keeps the zefira_session cookie), then send X-Requested-With: XMLHttpRequest on every mutating call. No OpenAPI explorer is exposed.

Auth & account

MethodEndpointNotes
POST/api/login{username, password, code?} — 401, or totp_required
POST/api/logoutInvalidates the session server-side
GET/api/meUsername, 2FA state
POST/api/change-passwordStrong-password enforced, kills other sessions
GET/api/2fa/status
POST/api/2fa/setup · /enable · /disableQR uri + 6-digit code flow

Users

MethodEndpointNotes
GET/api/statsCounters: active, expired, expiring-soon, limited…
GET/api/users?q=…Up to 500, username/note search
POST/api/usersCreate (protocols, volume, days, first-use, device limit)
PATCH/api/users/{id}Extend, top-up, note, expiry, active flag
DELETE/api/users/{id}
POST/api/users/{id}/reset-tokenRotates token + all secrets
GET/api/users/{id}/qr · /configSub URL + QR / config file or ZIP

Server objects

MethodEndpointNotes
GET PUT/api/settingsDomain, ports, REALITY, obfuscation…
POST/api/reality/generateNew X25519 keypair
GET/api/reality/privateAudit-logged reveal
GET/api/ssl/statusCertbot presence, domains, expiry
POST/api/ssl/issue · /ssl/renew{domain, subdomain?, email}
GET POST DELETE/api/inbounds · /api/inbounds/{id}Extra ports per protocol
GET POST DELETE/api/templates… · /api/nodes… · /api/blocklist…Plans, tunnels, blocked sites
POST/api/nodes/{id}/check · /guide · /reveal-token · /regen-tokenTunnel ops
POST/api/backupFull JSON export, password-confirmed (download)
POST/api/restorePassword-confirmed re-import
GET/api/audit · /api/system · /api/telegram…Logs, CPU/RAM/disk, notifications

Public

MethodEndpointNotes
GET/sub/{token}Base64 sub, or Clash YAML with ?format=clash

Example: create a user

curl -c jar.txt -H 'Content-Type: application/json' \
     -H 'X-Requested-With: XMLHttpRequest' \
     -d '{"username":"admin","password":"…"}' \
     https://vpn.example.com/api/login

curl -b jar.txt -H 'Content-Type: application/json' \
     -H 'X-Requested-With: XMLHttpRequest' \
     -d '{"username":"buyer1","protocols":["vless","reality"],"volume_gb":50,"days":30}' \
     https://vpn.example.com/api/users