1. ⚡ Purchase
TunnelSats Public Wireguard API
  • Announcements
    • 👋 About our team
    • 💫 What is TunnelSats?
    • 🚀 Introducing the TunnelSats Public API v1
    • 🧩 How the TunnelSats StartOS Package Uses the Public API
    • How TunnelSats Leverages Public APIs for Confined VPN Management
    • 🤖 Autonomous Agent Payments (L402 & x402) & Level 5 Agent-Native Architecture
  • 📡 Discovery
    • List Available WireGuard Servers & Regions
      GET
    • L402 Agent Payment Gateway Discovery Metadata
      GET
  • ⚡ Purchase
    • Create a New WireGuard Subscription (Invoice Generation)
      POST
    • Check Invoice Status & Polling by Payment Hash
      GET
    • Claim WireGuard Configuration After Payment Settlement
      POST
    • Autonomous Agent HTTP 402 Gateway (L402 Purchase + Claim)
      POST
  • 🔄 Lifecycle
    • Get Subscription & Bandwidth Status by WireGuard Public Key
      POST
    • Sync Subscription (Real-Time Server Refresh)
      POST
    • Renew an Existing VPN Subscription (Anonymous)
      POST
    • Request Bandwidth Top-Up ($1 Usage Reset)
      POST
  • 🔑 Account
    • List Account Subscriptions (Authenticated)
      GET
    • Create Referral Code
      POST
    • Get Referral Code
      GET
    • Referral History
      GET
  • 🔧 Tools
    • Lightning Node Network Address Discovery
      POST
    • Universal Connectivity & Latency Probe
      POST
  • Cookbook
    • 🛠️ Automation & Code Examples
    • 🐚 Bash One-Liners
    • 🚑 Node Health & Upkeep
    • ⚡ Bandwidth Top-Up ($1 Usage Reset)
    • 🛡️ Security & Authentication
    • 🎁 Referral Program: Earn Bonus Months
    • 🛑 Error Codes & Troubleshooting
    • 🤖 Agent Payments: L402 & x402 Protocol
  • Schemas
    • Server
    • InvoiceOrder
    • SubscriptionStatus
    • NodeLookup
    • ConnectivityResult
    • ApiError
    • ClaimResult
    • BandwidthResetResponse
    • PublicKeyStatusResponse
    • SubscriptionListItem
    • ReferralCode
    • ReferralHistory
    • BandwidthResetPaymentStatus
    • RenewalOrder
    • SyncResult
Tunnelsats Github
Tunnelsats Telegram
  1. ⚡ Purchase

Autonomous Agent HTTP 402 Gateway (L402 Purchase + Claim)

POST
https://tunnelsats.com/api/v1

Unified HTTP 402 endpoint for autonomous AI agents. When called without Authorization: L402 : (or X-PAYMENT), creates a live BOLT11 Lightning invoice and pending order and returns HTTP 402 Payment Required with an interoperable binary V2 L402 macaroon and experimental x402 v2 discovery envelope. When replayed with Authorization: L402 :, cryptographically verifies the V2 macaroon and SHA256(preimage) == paymentHash, confirms settlement, and returns 200 OK with the provisioned WireGuard tunnel parameters. Rate limit: 10 requests/min per IP.

Request

Header Params

Body Params application/json

Examples

Responses

🟢200OK
application/json
WireGuard tunnel provisioned after L402 preimage verification
Bodyapplication/json

🟠400Bad Request
🟠401Unauthorized
🟠402Payment Required
🟠409Conflict
🟠429Too Many Requests
Request Request Example
Shell
JavaScript
Java
Swift
curl --location 'https://tunnelsats.com/api/v1' \
--header 'Authorization: L402 AgJ0dW5uZWxzYXRz...==:0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef' \
--header 'Content-Type: application/json' \
--data '{
    "serverId": "eu-de",
    "duration": 1,
    "wgPublicKey": "hnG/fWsNx7DiVbGUj3B/i0EtXvpIZdO5cuoQJCTWhRU=",
    "referralCode": "string"
}'
Response Response Example
200 - Example 1
{
    "config": "[Interface]\nPrivateKey = ...\nAddress = 10.9.0.2/32\nDNS = 1.1.1.1\n\n[Peer]\nPublicKey = ...\nEndpoint = de2.tunnelsats.com:51820\nAllowedIPs = 0.0.0.0/0",
    "fullConfig": "string",
    "status": "success",
    "subscriptionEnd": "2027-01-01T00:00:00.000Z",
    "server": {
        "endpoint": "de2.tunnelsats.com:51820",
        "publicKey": "string",
        "allowedIPs": "0.0.0.0/0, ::/0"
    },
    "peer": {
        "address": "10.9.0.7",
        "publicKey": "string",
        "presharedKey": "string"
    },
    "vpnPort": 24556
}
Modified at 2026-10-16 18:50:50
Previous
Claim WireGuard Configuration After Payment Settlement
Next
Get Subscription & Bandwidth Status by WireGuard Public Key
Built with