TunnelSats Public Wireguard API
  1. Cookbook
TunnelSats Public Wireguard API
  • About our team
  • šŸ“¢ Public
    • List Servers
      GET
    • Create Subscription
      POST
    • Check Status / Heal
      GET
    • Claim Subscription
      POST
    • Renew Subscription
      POST
    • Get Subscription Status
      POST
  • šŸ” Authenticated
    • List My Subscriptions
      GET
    • Sync Subscription
      POST
    • Create Referral Code
      POST
    • Referral History
      GET
  • Announcements
    • šŸ’« What is TunnelSats?
    • šŸš€ Introducing the TunnelSats Public API v1
  • Cookbook
    • šŸ› ļø Automation & Code Examples
    • 🐚 Bash One-Liners
    • šŸ›‘ Error Codes & Troubleshooting
    • šŸŽ Referral Program: Earn Bonus Months
  • Schemas
    • Server
    • InvoiceOrder
    • SubscriptionStatus
    • WireGuardConfig
    • ReferralCode
    • ReferralHistory
    • NodeLookup
    • ConnectivityResult
  1. Cookbook

šŸ› ļø Automation & Code Examples

This guide provides production-ready scripts to purchase, pay for, and provision a VPN tunnel programmatically using TunnelSats.

⚔ Quick Start Scripts#

Choose your preferred environment to automate the VPN lifecycle.
Python (Requests)
Bash (cURL + jq)
Recommended for Integrators
Use this script if you are building a dashboard, an auto-renewal bot, or integrating TunnelSats into node management software.

Prerequisites#

The "Full Lifecycle" Script#

This script automates the Create -> Pay -> Claim flow.

šŸ’” Important Considerations#

Invoice Expiry
Lightning invoices and their associated paymentHash typically expire within 10 minutes. If payment is not detected within this window, the polling script will timeout, and you must generate a new subscription request.
WireGuard Keys
In the examples above, we leave wgPublicKey empty in the /claim request. This tells the TunnelSats server to generate a fresh keypair for you. If you prefer to use your own keys, include your Public Key in the request body.
Modified atĀ 2026-02-15 19:16:09
Previous
šŸš€ Introducing the TunnelSats Public API v1
Next
🐚 Bash One-Liners
Built with