Skip to main content

Prerequisites

  • A host with WireGuard installed: Linux, macOS, or Windows.
  • A region that offers WireGuard Interfaces. GET /v2/network_coverage?filter[available_services][contains]=cloud_vpn lists them. A location’s location.code, such as ashburn-va, is the region_code to use.
  • A Network. POST /v2/networks with {"name": "acme-prod"} returns its id.

Create the interface

Send POST /v2/wireguard_interfaces:
An interface cannot move to another Network. Confirm network_id before sending the request.
The response returns status: provisioning and the values that peers need: endpoint, public_key, and server_ip_address.

Wait for provisioning

Poll GET /v2/wireguard_interfaces/{id} until status is provisioned. This takes a few minutes. Peers can be added once it is provisioned.

Create a peer

Register the host as a peer of the WireGuard Interface with POST /v2/wireguard_peers:
Telnyx generates the host’s key pair and returns its private_key once, in this response. Store it.
To keep the private key on the host instead, generate the key pair there and send only the public key as public_key. The response then has no private_key.

Configure the host

GET /v2/wireguard_peers/{id}/config returns a configuration template as plain text:
The file describes the tunnel from the host’s side: [Interface] is the local host itself, and [Peer] is the WireGuard Interface in Telnyx. Replace the placeholder with the host’s private key and save the file as /etc/wireguard/wg0.conf. On Linux, bring the tunnel up:

Verify

sudo wg show lists the local host as interface and the WireGuard Interface in Telnyx as peer, with a recent handshake:
The WireGuard Interface answers on its address:
GET /v2/wireguard_peers/{id} reports the peer’s last_seen time.