WireGuard REST API — Getting Started
Overview
The WireGuard REST API lets you manage your dedicated VPN server programmatically. You can create and delete users, download configs, check device status, and manage port forwarding — all via simple HTTP requests.
The API is available to all customers with a dedicated WireGuard server addon.
Base URL
https://portal.premiervpn.net/api/wg
Authentication
All requests require a Bearer token in the Authorization header:
Authorization: Bearer wg_your_api_key_here
Generating an API Key
- Log into portal.premiervpn.net
- Go to your WireGuard server page
- Click API Keys & Documentation in the sidebar
- Enter a name for your key (e.g. "Production") and click Generate Key
- Copy the key immediately — it won't be shown again
You can create up to 5 active API keys. Each key has access to all your assigned servers.
Rate Limits
The API is rate limited to 60 requests per minute per API key. Exceeding this returns HTTP 429.
Response Format
All responses are JSON. Successful requests return the data directly. Error responses include an error message and a code field:
{
"error": "Description of what went wrong",
"code": "error_code"
}
Security
- API keys are hashed (SHA-256) — we never store the plain text
- Keys are scoped to your account — you can only access your own servers and users
- All API actions are recorded in the audit log
- Last used time and IP are tracked per key
- Revoke a key instantly if compromised