WireGuard Configuration

Retrieve a WireGuard VPN configuration for a specific server, including interface and peer settings.

Get WireGuard Configuration

Retrieve a complete WireGuard VPN configuration for a specific server. The response includes all interface and peer settings needed to establish a connection, along with a ready-to-use configuration file content.

GET/api/v1/vpn/servers/{serverId}/wireguard

Get WireGuard configuration for a specific server

Authentication:Bearer Token
ParameterTypeRequiredDescription
serverIdinteger RequiredThe numeric ID of the VPN server
device_idintegerOptionalSpecific device ID to generate the configuration for. Defaults to the current device.

Authorize First

You should call the VPN Authorization endpoint before fetching a configuration to ensure the user is eligible to connect.

# Basic request
curl -X GET https://api.orbai.world/api/v1/vpn/servers/101/wireguard \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"

# With specific device
curl -X GET "https://api.orbai.world/api/v1/vpn/servers/101/wireguard?device_id=1001" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"
200WireGuard configuration generated successfully
{
  "success": true,
  "data": {
    "interface": {
      "private_key": "yAnz5TF+lXXJte14tji3zlMNq+hd2rYUIgJBgB3fBmk=",
      "address": "10.66.66.2/32",
      "dns": ["1.1.1.1", "1.0.0.1"],
      "mtu": 1420
    },
    "peer": {
      "public_key": "xTIBA5rboUvnH4htodjb6e697QjLERt1NAB4mZqp8Dg=",
      "endpoint": "203.0.113.10:51820",
      "allowed_ips": ["0.0.0.0/0", "::/0"],
      "persistent_keepalive": 25
    },
    "config": "[Interface]\nPrivateKey = yAnz5TF+lXXJte14tji3zlMNq+hd2rYUIgJBgB3fBmk=\nAddress = 10.66.66.2/32\nDNS = 1.1.1.1, 1.0.0.1\nMTU = 1420\n\n[Peer]\nPublicKey = xTIBA5rboUvnH4htodjb6e697QjLERt1NAB4mZqp8Dg=\nEndpoint = 203.0.113.10:51820\nAllowedIPs = 0.0.0.0/0, ::/0\nPersistentKeepalive = 25"
  }
}
401Authentication required
{
  "success": false,
  "error": {
    "code": "UNAUTHORIZED",
    "message": "Invalid or expired access token"
  }
}
403Subscription does not allow access to this server
{
  "success": false,
  "error": {
    "code": "ACCESS_DENIED",
    "message": "Your subscription plan does not include access to this server. Please upgrade your plan."
  }
}
404Server not found
{
  "success": false,
  "error": {
    "code": "NOT_FOUND",
    "message": "Server with the specified ID does not exist"
  }
}

Response Fields

FieldTypeDescription
interface.private_keystringWireGuard private key for the client
interface.addressstringAssigned tunnel IP address with subnet mask
interface.dnsstring[]DNS servers to use while connected
interface.mtuintegerMaximum Transmission Unit size
peer.public_keystringServer's WireGuard public key
peer.endpointstringServer endpoint in host:port format
peer.allowed_ipsstring[]IP ranges to route through the tunnel
peer.persistent_keepaliveintegerKeepalive interval in seconds
configstringComplete WireGuard configuration file content

Private Key Security

The private_key in the response is unique to your session. Never share it publicly or commit it to version control. Each request generates fresh cryptographic keys.

Using the Config

The config field contains the entire WireGuard configuration as a single string. You can save it directly to a .conf file and import it into any WireGuard client.