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
    • Check Region Switch Eligibility
      POST
    • Create or Reuse Region Switch Invoice
      POST
    • Claim Client-Held Region Switch Parameters
      POST
  • 🔑 Account
    • List Account Subscriptions (Authenticated)
    • Create Referral Code
    • Get Referral Code
    • Referral History
  • 🔧 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
    • ReferralHistory
    • ReferralCode
    • SubscriptionListItem
    • PublicKeyStatusResponse
    • BandwidthResetResponse
    • ApiError
    • ClaimResult
    • BandwidthResetPaymentStatus
    • RegionSwitchServer
    • RegionSwitchCheckResult
    • RenewalOrder
    • RegionSwitchInvoice
    • RegionSwitchClaimResult
    • RegionSwitchPaymentStatus
    • SyncResult
Tunnelsats Github
Tunnelsats Telegram
  1. Cookbook

🎁 Referral Program: Earn Bonus Months

The TunnelSats Referral Program rewards both the referred user (buyer) and the referring partner with bonus VPN months on 3, 6, and 12-month subscriptions. Whether you are building a node management dashboard or sharing your code with the community, you can automate your rewards.

📈 How It Works#

When a new 3, 6, or 12-month subscription is purchased with a valid referral code:
1.
Buyer Bonus: The referred buyer's new WireGuard tunnel is provisioned with the bonus months included up front (subscriptionEnd reflects duration + bonus).
2.
Partner Bonus: The referring partner's latest active subscription (or one that expired less than 30 days ago) is extended by the same bonus months, exactly once, as soon as the referred order is paid.
Both bonuses apply across every settlement path (payment webhook, GET /api/public/v1/subscription/{paymentHash} status polling, POST /api/public/v1/subscription/claim, and the web checkout).
Plan PurchasedBuyer Bonus (New Subscription)Partner Bonus (Credited to Referrer)
3-Month Plan+1 Month (4 months total)+1 Month
6-Month Plan+2 Months (8 months total)+2 Months
12-Month Plan+3 Months (15 months total)+3 Months

🛠️ Developer Integration#

You can integrate your referral code directly into the programmatic purchase flow to ensure every new subscription is linked to your account.
Linking a Referral
Managing Codes
Referral during Creation
Include your referralCode in the initial POST /api/public/v1/subscription/create request to track the conversion from the start. Unknown codes, and your own code when the request is authenticated, are rejected with 400 ERR_INVALID_INPUT before an invoice is created.
Request Example:
Create Subscription API Reference

💡 Partner Best Practices#

Plan Restrictions
Referral bonuses are applied only to 3, 6, and 12-month plans. Standard 1-month subscriptions do not trigger buyer or partner bonuses (bonus_earned: 0, bonus_status: "skipped", bonus_reason: "not_eligible").
Automatic Application & Self-Referral Rules
Partner bonus months are automatically added to the subscription linked to your account that expires last, if it is active or expired less than 30 days ago. If you have no such subscription when the referred order is paid, that partner bonus is forfeited (bonus_status: "forfeited", bonus_reason: "no_active_subscription").
Authenticated self-referrals (where the buyer authenticates with the same account that owns the referralCode via API key, NIP-98, or dashboard session) never receive buyer or partner bonus months (400 ERR_INVALID_INPUT at /create, or bonus_status: "skipped" with bonus_reason: "self_referral"). Anonymous purchases made without authentication carry no account identity to compare against the code owner and cannot be checked for self-referral.
Modified at 2026-10-16 20:05:59
Previous
🛡️ Security & Authentication
Next
🛑 Error Codes & Troubleshooting
Built with