Start a VPN session
A VPN session turns a node into your VPN endpoint in its location. It is billed by traffic (traffic_price per GB).
VPN is available through the API and the JavaScript SDK.
Protocols
subkind | You connect with |
|---|---|
wg | WireGuard config file |
awg | AmneziaWG config file |
reality | VLESS Reality link |
http_proxy | HTTP proxy. It lets in only the IP address the start request came from |
v2ray | V2Ray link; protocol is vless, vmess or trojan (default). Not checked on nodes, so it may not work everywhere |
Each node in GET /services/vpn lists its protocols: the ones that passed an end-to-end check on that node. Pick a subkind from that list; another one is rejected with 400 (Node's VPN did not pass the connection check) and nothing is charged.
Start and get the config
import { writeFile } from 'node:fs/promises'
import { OctaClient, isVpnSession } from '@octaspace/sdk'
const client = new OctaClient({ apiKey: process.env.OCTA_API_KEY })
const nodes = await client.vpn.list()
const node = nodes.find((n) => n.country_iso === 'DE' && n.protocols.includes('wg'))
const { uuid } = await client.vpn.start({ node_number: node.node_number, subkind: 'wg' })
const session = await client.sessions.waitReady(uuid)
if (isVpnSession(session)) {
await writeFile('octa.conf', session.config ?? '', { mode: 0o600 })
}With the API: POST /services/vpn with {"node_number": "...", "subkind": "wg"}, then poll GET /services/{uuid}/info until status is ready and read config.
Import octa.conf into your WireGuard client (wg-quick up ./octa.conf on Linux).
Rules
- One VPN session per node: a second one on the same node is rejected (You already have a VPN session on this node).
- VPN sessions have no logs.
- Stop the session when you no longer need it: client.sessions.stop(uuid) or octa sessions stop <uuid>. It is charged for traffic until then.