1. 🔄 Lifecycle
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
    • Check Region Switch Eligibility
      POST
    • Create or Reuse Region Switch Invoice
      POST
    • Claim Client-Held Region Switch Parameters
      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
    • ReferralHistory
    • ReferralCode
    • SubscriptionListItem
    • PublicKeyStatusResponse
    • BandwidthResetResponse
    • ApiError
    • ClaimResult
    • BandwidthResetPaymentStatus
    • RegionSwitchServer
    • RegionSwitchCheckResult
    • RenewalOrder
    • RegionSwitchInvoice
    • RegionSwitchClaimResult
    • RegionSwitchPaymentStatus
    • SyncResult
Tunnelsats Github
Tunnelsats Telegram
  1. 🔄 Lifecycle

Create or Reuse Region Switch Invoice

POST
https://tunnelsats.com/api/public/v1/subscription/migrate

Authorize with either source-private-key possession (proof x25519: against the current check challenge, echoing challengeWindow) or an owning Bearer sk_live_... / Nostr NIP-98 account. Cookie sessions and PSK proofs are not accepted. NIP-98 requires an exact absolute u URL including query, matching method, a timestamp within 60 seconds, and the SHA256 of the exact request body in a payload tag. Invalid supplied account credentials never fall back to a proof. Never transmit either WireGuard private key. The new public key must be fresh and strong. Atomically reserves one shared monthly $1.00 slot before LNBits creation; exact unpaid retries reuse an invoice with more than 30 seconds remaining. Bound proofs cannot change target/key before their ten-minute challenge expires. Invoice lifetime is at most one hour and capped before UTC month rollover. Rate limits: 10 requests/min per IP (rolling), five failed proofs/hour per source public key across IPs. Request bodies are limited to 8192 bytes.

Request

Authorization
Bearer Token
Provide your bearer token in the
Authorization
header when making requests to protected resources.
Example:
Authorization: Bearer ********************
or
Bearer Token
Provide your bearer token in the
Authorization
header when making requests to protected resources.
Example:
Authorization: Bearer ********************
or
Body Params application/jsonRequired

Examples

Responses

🟢200
application/json
New or reused $1.00 BOLT11 invoice; resetsThisMonth includes its held slot.
Headers

Bodyapplication/json

🟠400
🟠401
🟠403
🟠404
🟠409
🟠413
🟠429
🔴500
🔴503
Request Request Example
Shell
JavaScript
Java
Swift
curl --location 'https://tunnelsats.com/api/public/v1/subscription/migrate' \
--header 'Content-Type: application/json' \
--data '{
    "sourceWgPublicKey": "hSDwCYkwp1R0i33ctD73Wg2/Og0mOBr066SpjqqbTmo=",
    "targetServerId": "eu-ch",
    "newWgPublicKey": "3p7bfXt9wbTTW2HC7OQ1Nz+DQ8hbeGdNrfx+FG+IK08=",
    "proof": "x25519:C1qwwR+zCDFSMb3vTSuEVCwmIaLV6r4egeVreJRAv3s=",
    "challengeWindow": 123
}'
Response Response Example
200 - Success Example
{
    "invoice": "lnbc1example-not-payable",
    "paymentHash": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
    "migrationId": "41300000-0000-4000-8000-000000000001",
    "amountSats": 1000,
    "amountUsd": "1.00",
    "expiresAt": "2026-11-02T12:15:00.000Z",
    "resetsThisMonth": 1,
    "maxResetsPerMonth": 2
}
Modified at 2026-11-06 19:55:30
Previous
Check Region Switch Eligibility
Next
Claim Client-Held Region Switch Parameters
Built with