HTTP API reference
HTTP endpoints and conventions for the open-source self-hosted gateway-server.
Conventions
- Envelope: always { ok: true, data: … } / { ok: false, error: { code, message } }.
- Dual auth: Authorization: Bearer <token> (takes priority; an invalid token returns 401 with no fallback) or the session cookie zr_gw_session (32-byte random hex; only its sha256 is stored).
- Error codes: SCREAMING_SNAKE (NOT_FOUND, INVALID_REQUEST, RATE_LIMITED, OTP_COOLDOWN, QUOTA_EXCEEDED, …).
Auth & sessions
| Method | Path | Description |
|---|
| POST | /api/v1/auth/login | Email and password login; returns a session token |
| POST | /api/v1/auth/signup | Register an account (returns 403 when sign-up is disabled) |
| POST | /api/v1/auth/logout | End the current session |
| GET | /api/v1/auth/me | Current identity and quota |
| POST | /api/v1/auth/send-otp | Send a verification code (purpose=signup/reset_password) |
| POST | /api/v1/auth/reset-password | Reset password using a verification code |
Account settings
| Method | Path | Description |
|---|
| PATCH | /api/v1/auth/account/password | Change account password |
| POST | /api/v1/auth/account/email/request | Request an email change (sends a verification code) |
| POST | /api/v1/auth/account/email | Confirm email change |
Networks & members
| Method | Path | Description |
|---|
| GET | /api/v1/networks | List networks owned by the current user |
| POST | /api/v1/networks | Create a network (supports inviteTtlHours 1–720 default 168, inviteMaxUses 1–1000 default 10) |
| PATCH | /api/v1/networks/:id | Rename, update admission mode, member cap, or peerDirectMaxRttMs (0–10000 ms, default 300, 0 = uncapped) |
| DELETE | /api/v1/networks/:id | Delete a network |
| POST | /api/v1/networks/:id/rotate-key | Rotate the join key and reset expiry & use count (optional inviteTtlHours / inviteMaxUses; see the zr-net protocol spec) |
| POST | /api/v1/networks/:id/members/:nodeId/approve / reject | Approve or reject a pending member |
| POST | /api/v1/networks/:id/members/:nodeId/pause / resume | Pause or resume a member |
| POST | /api/v1/networks/:id/members/:nodeId/repin | Re-pin an identity fingerprint |
| PATCH | /api/v1/networks/:id/members/:nodeId | Update member note or display name |
| DELETE | /api/v1/networks/:id/members/:nodeId | Remove a member |
Topology & events
| Method | Path | Description |
|---|
| GET | /api/v1/networks/:id/topology | Live topology snapshot |
| GET | /api/v1/networks/:id/events | SSE topology stream (text/event-stream; disable proxy buffering) |
Admin
| Method | Path | Description |
|---|
| GET/PATCH | /api/v1/admin/settings | Gateway settings (including live SMTP configuration) |
| POST | /api/v1/admin/settings/smtp-test | Send a test email |
| POST/DELETE | /api/v1/admin/settings/api-key | Mint or revoke an API key |
| GET | /api/v1/admin/runtime | Runtime status |
| GET/POST/PATCH/DELETE | /api/v1/admin/groups(/:id) | User-group CRUD (quota configuration) |
| GET/POST/PATCH/DELETE | /api/v1/admin/users(/:id) | User CRUD |
| POST | /api/v1/admin/users/:id/reset-password | Admin-triggered password reset |
Certificates & auto-update (admin)
| Method | Path | Description |
|---|
| GET / PATCH | /api/v1/admin/tls | Read or modify TLS configuration |
| PUT | /api/v1/admin/tls/certificate | Upload a TLS certificate |
| POST | /api/v1/admin/tls/reload | Reload TLS certificates |
| GET | /api/v1/admin/update | Read update state |
| POST | /api/v1/admin/update/check / apply / dismiss-rollback | Check, apply, or dismiss the rollback notice |
Node internal surface (peer)
The control WebSocket /peer/v1/ws is covered in the zr-net protocol spec.
| Method | Path | Description |
|---|
| GET | /peer/v1/ping | Node liveness ping |
| POST | /peer/v1/leave | Node leave report |