PiVPN Web includes a JSON REST API built on Express.js. Every response body is JSON, all write operations are guarded by session-cookie authentication, and the server runs on portDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/AZhur771/pivpn-web/llms.txt
Use this file to discover all available pages before exploring further.
3001 by default. The same API endpoints power the built-in Vue.js dashboard — anything the UI can do, you can do programmatically.
Base URL
https:// instead. The PORT environment variable overrides the default 3001.
Content-Type
All requests that include a body must set theContent-Type header to application/json. Requests without a body (e.g. GET and DELETE requests that carry no payload) do not need to set this header.
Authentication
All endpoints exceptPOST /api/session require a valid session cookie. Unauthenticated requests receive a 401 response. See the Authentication page for the full login flow, session lifetime details, and role-based access rules.
Endpoint Summary
| Method | Path | Auth Required | Admin Required | Description |
|---|---|---|---|---|
GET | /api/session | No | No | Get current session info |
POST | /api/session | No | No | Log in and create a session |
DELETE | /api/session | Yes | No | Log out and destroy the session |
GET | /api/wireguard/client | Yes | No | List all WireGuard clients |
GET | /api/wireguard/client-status | Yes | No | List clients with live connection status |
GET | /api/wireguard/client/:name | Yes | No | Get a specific client by name |
POST | /api/wireguard/client/:name | Yes | Yes | Create a new client |
DELETE | /api/wireguard/client/:name | Yes | Yes | Delete a client |
POST | /api/wireguard/client/:name/enable | Yes | Yes | Enable a client |
POST | /api/wireguard/client/:name/disable | Yes | Yes | Disable a client |
GET | /api/wireguard/client/:name/qrcode.svg | Yes | No | Get client QR code as an SVG image |
GET | /api/wireguard/client/:name/configuration | Yes | No | Download the client .conf file |
Response Format
Successful responses
Endpoints that return data respond with HTTP200 and a JSON body. Endpoints that perform mutations but have no meaningful return value — such as POST /api/session and DELETE /api/session — respond with 204 No Content and an empty body.
The /api/wireguard/client-status endpoint returns enriched objects that include live WireGuard connection data (endpoint IP, transfer bytes, latest handshake time) alongside the base client fields:
Error responses
All errors return a JSON object with anerror field containing a human-readable message and a stack field with the server-side stack trace:
| Status | Meaning |
|---|---|
401 | Not authenticated — no valid session cookie is present |
403 | Authenticated but not an admin — the operation requires elevated privileges |
500 | Server-side error — includes validation failures (missing fields, invalid client name, wrong credentials) and unexpected server errors |
[a-z0-9 .,_-] (case-insensitive). Names containing other characters return a 500 error with the message Invalid Client Name: <name>.
The API is consumed directly by the PiVPN Web frontend — a Vue.js single-page application served from the same Express process. Every action available in the dashboard (listing clients, toggling enabled state, downloading configs, viewing QR codes) maps 1:1 to one of the endpoints listed above. This means you can script or automate any dashboard action using the same API.