1. Cookbook
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
    • Universal Connectivity & Latency Probe
  • 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. Cookbook

🐚 Bash One-Liners

For sysadmins who prefer the terminal, you can interact with TunnelSats using standard curl, jq (1.6+) and wg (wireguard-tools).

1. Generate Your Keypair Locally#

The private key stays on your machine; only its public half is sent.

2. Get a Lightning Invoice (registering your public key)#

Generate a 1-month invoice for a specific region, bound to your key.
Create Subscription

3. Check Payment Status#

Check Invoice Status & Polling by Payment Hash

4. Claim & Build Your Config#

Once paid, claim with the same public key. The response contains the tunnel parameters only (fullConfig is null); your config is built locally from them and your private key. If the response is HTTP 202 ("status": "processing"), wait a few seconds and repeat the claim.
Claim WireGuard Configuration After Payment Settlement

5. Check Bandwidth & Expiry by WireGuard Key#

Query real-time subscription status using your WireGuard public key (no auth needed).

6. Sync Subscription (Authenticated, Real-Time Refresh)#

Force a real-time data sync from the VPN server. Requires an API key.

7. List All Subscriptions (Snake Case Alert)#

When listing all subscriptions for an authenticated account, the API returns snake_case keys (e.g., payment_hash instead of paymentHash).

8. Auto-Renewal Cron Job#

Add this script to your crontab to check expiry and generate a new invoice if needed.

9. Bandwidth Top-Up ($1 Usage Reset)#

For the full bandwidth reset workflow, including a client-side usage policy and payment settlement, see ⚡ Bandwidth Top-Up ($1 Usage Reset).
Modified at 2026-10-16 19:46:37
Previous
🛠️ Automation & Code Examples
Next
🚑 Node Health & Upkeep
Built with