VPN API for developers & AI agents

Everything on NanVPN can be done over a small REST API. There is no API key or account: an order is accessed with the secret token returned when it is created.

Base URL: https://api.nanvpn.com · OpenAPI spec · llms.txt

1. Choose a plan

curl "https://api.nanvpn.com/catalog"   # plans[] {days, priceUsd}, locations, accepted coins

2. Order

curl -X POST "https://api.nanvpn.com/buy" \
  -H "Content-Type: application/json" \
  -d '{"days":30,"payinCurrency":"XNO"}'

The response contains token (shown only once, store it), priceUsd and payment with payinAddress, payinAmount, payinCurrency and paymentLink.

3. Pay

Send exactly payinAmount of payinCurrency to payinAddress before expireAt, or open paymentLink. XNO and NANUSD confirm in seconds; "payinCurrency":"BALANCE" with a funded balanceToken is instant.

4. Get a configuration

curl "https://api.nanvpn.com/order" -H "Authorization: Bearer nv_..."      # wait for status "active"
curl "https://api.nanvpn.com/servers"                                      # servers[], vlessServers[], ports[]
curl "https://api.nanvpn.com/order/config?protocol=wireguard&server=12" -H "Authorization: Bearer nv_..."

protocol: wireguard (a .conf for wg-quick or the apps), vless (a vless:// link, VLESS + Reality, server id from vlessServers) or openvpn (an .ovpn, optional port id; log in with credentials from GET /order). The response is { name, content, server }.

5. Renew

curl -X POST "https://api.nanvpn.com/extend" \
  -H "Authorization: Bearer nv_..." -H "Content-Type: application/json" \
  -d '{"days":30,"payinCurrency":"XNO"}'

Pay the returned payment the same way. The period is added to expiresAt (or starts now if expired); credentials and configurations stay the same.

Errors & limits

Errors return {"error": "message"} with status 400 (invalid input), 401 (bad token), 402 (balance too low), 409 (order not active), 429 (too many orders), 502 or 503.