API: Complete Endpoint Reference
All Endpoints
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/wg/servers | List your assigned servers |
| GET | /api/wg/servers/{id}/users | List users with live status & bandwidth |
| POST | /api/wg/servers/{id}/users | Create user — returns config & all keys |
| GET | /api/wg/servers/{id}/status | Live device status for all users |
| GET | /api/wg/users/{id} | Get user details, config, keys, status |
| DELETE | /api/wg/users/{id} | Remove user |
| GET | /api/wg/users/{id}/port-forwards | List port forwards for a user |
| POST | /api/wg/users/{id}/port-forwards | Create port forward |
| DELETE | /api/wg/port-forwards/{id} | Remove port forward |
Authentication
Every request requires a Bearer token:
Authorization: Bearer wg_your_api_key_here
Generate keys at: WireGuard Server → API Keys & Documentation
Rate Limits
60 requests per minute per API key. HTTP 429 returned if exceeded.
HTTP Status Codes
| Code | Meaning |
|---|---|
| 200 | Success |
| 201 | Created (user or port forward) |
| 401 | Invalid or missing API key |
| 403 | Forbidden — resource belongs to another account |
| 409 | Conflict — duplicate name or port already in use |
| 422 | Validation error — invalid input |
| 429 | Rate limit exceeded |
| 500 | Server error — check the error message |
Multi-Server Usage
One API key gives you access to all your assigned servers. You specify which server by its assignment_id (returned by GET /servers). You don't need separate keys per server.
If you need different keys for different applications or environments (e.g. production vs staging), you can create up to 5 active keys.
Example: Full Workflow
# 1. List servers to get assignment IDs
curl -s -H "Authorization: Bearer wg_KEY" \
https://portal.premiervpn.net/api/wg/servers
# 2. Create a user on server 5
curl -s -X POST -H "Authorization: Bearer wg_KEY" \
-H "Content-Type: application/json" \
-d '{"client_name": "web-server"}' \
https://portal.premiervpn.net/api/wg/servers/5/users
# Save the returned config to a .conf file
# 3. Add port forwarding for a web server
curl -s -X POST -H "Authorization: Bearer wg_KEY" \
-H "Content-Type: application/json" \
-d '{"external_port": 443, "internal_port": 443, "protocol": "tcp", "comment": "HTTPS"}' \
https://portal.premiervpn.net/api/wg/users/NEW_USER_ID/port-forwards
# 4. Check if the user is online
curl -s -H "Authorization: Bearer wg_KEY" \
https://portal.premiervpn.net/api/wg/servers/5/status
# 5. When done, clean up
curl -s -X DELETE -H "Authorization: Bearer wg_KEY" \
https://portal.premiervpn.net/api/wg/port-forwards/PF_ID
curl -s -X DELETE -H "Authorization: Bearer wg_KEY" \
https://portal.premiervpn.net/api/wg/users/USER_ID