API: Managing Servers and Users

Last updated 11 May 2026 42 views 🔒 Dedicated WireGuard VPN

List Your Servers

GET /api/wg/servers

Returns all dedicated servers assigned to your account.

curl -s -H "Authorization: Bearer wg_YOUR_KEY" \
  https://portal.premiervpn.net/api/wg/servers

Response includes the assignment_id which you use in other endpoints to specify which server.

List Users on a Server

GET /api/wg/servers/{assignment_id}/users

Returns all WireGuard users on the specified server, including live online/offline status and bandwidth usage.

curl -s -H "Authorization: Bearer wg_YOUR_KEY" \
  https://portal.premiervpn.net/api/wg/servers/5/users

Each user includes: id, client_name, client_ip, online (true/false), last_seen, rx_bytes, tx_bytes, and formatted bandwidth values.

Create a User

POST /api/wg/servers/{assignment_id}/users

Creates a new WireGuard user on the server. Returns the full config file and all keys.

curl -s -X POST -H "Authorization: Bearer wg_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"client_name": "my-phone"}' \
  https://portal.premiervpn.net/api/wg/servers/5/users

The client_name must contain only letters, numbers, hyphens, and underscores. Maximum 50 characters.

The response includes:

  • config — the complete WireGuard .conf file contents (save to a file)
  • keys.client_private_key — for building custom configs
  • keys.client_public_key — the user's public key
  • keys.preshared_key — the preshared key
  • keys.server_public_key — the server's public key

Get a Single User

GET /api/wg/users/{user_id}

Returns full details for a user including config, all keys, and live connection status.

curl -s -H "Authorization: Bearer wg_YOUR_KEY" \
  https://portal.premiervpn.net/api/wg/users/12

Delete a User

DELETE /api/wg/users/{user_id}

Removes a WireGuard user and revokes their access from the server.

curl -s -X DELETE -H "Authorization: Bearer wg_YOUR_KEY" \
  https://portal.premiervpn.net/api/wg/users/12

Check Device Status

GET /api/wg/servers/{assignment_id}/status

Returns live status for all users on a server — who's online, last handshake time, and bandwidth consumed.

curl -s -H "Authorization: Bearer wg_YOUR_KEY" \
  https://portal.premiervpn.net/api/wg/servers/5/status

A device is considered "online" if the last handshake was within the past 3 minutes.

Didn't find what you were looking for?

Our support team is happy to help.

Open a Ticket