This guide provides complete instructions and production-ready code examples to programmatically purchase and trigger an instant bandwidth reset for your active WireGuard tunnel: this month's usage counter goes back to 0 GB, so the full allowance is available again.
Each TunnelSats subscription includes 100 GB of bandwidth per calendar month. At any usage, including after the peer was disabled for exceeding its allowance, you can buy a $1 USD bandwidth reset in Bitcoin Lightning (sats) instead of waiting for the free reset on the 1st. A reset sets the usage counter back to 0 GB, so you get back what you used so far. It does not add allowance on top, and unused allowance does not carry over, so a reset is worth most when usage is high.Node management packages (e.g., RaspiBlitz, Umbrel, Start9, Baremetal, LNDg) and automation daemons can monitor usage via /api/public/v1/subscription/status and request a reset when their own usage policy says so, for example at 90% of the allowance./subscription/status also tells you whether a reset is available before you request one: it returns bandwidth_used_gb, bandwidth_limit_gb, bandwidth_resets_this_month and max_resets_per_month. bandwidth_resets_this_month is the same count this endpoint checks: once it reaches max_resets_per_month, a request gets HTTP 429, unless one of those slots is an open reset invoice, which is then returned again (an open invoice holds its slot until it is paid or expires; independently, requests in the last ~90 seconds of a UTC month also get 429). There is no usage threshold: the API accepts a reset at any usage, so apply your own policy before paying automatically.
BOLT11 Lightning invoice for $1 USD equivalent in sats.
paymentHash
string
SHA256 payment hash for tracking invoice settlement.
resetId
string
Unique UUID tracking this bandwidth reset request.
amountSats
number
Invoice amount in satoshis calculated dynamically from real-time BTC price.
amountUsd
string
Fixed price ("1.00").
expiresAt
string
ISO 8601 invoice expiry. Until then the invoice stays payable and its monthly slot stays reserved; requesting a reset again before then returns this same invoice.
currentUsagePercent
string
Current bandwidth consumption percentage on the VPN manager, for information only.
resetsThisMonth
number
Number of confirmed resets applied to this key in the current calendar month.
LNBits Webhook fires automatically to /api/webhooks/bandwidth-reset.
2.
The backend contacts the respective WireGuard server manager and resets the bandwidth counter (bwReset: true).
3.
If the peer key was disabled due to bandwidth exhaustion, it is automatically re-enabled immediately. A key disabled for any other reason is never re-enabled by a reset.
Polling settlement: GET /api/public/v1/subscription/{paymentHash}#
Poll with the reset's paymentHash to learn the outcome. If the webhook was missed, the poll applies the paid reset itself, so a paid reset cannot stay unapplied.
Always apply your own usage policy before paying. Don't rely on the API to reject resets you don't need. Every paid reset uses one of your monthly resets, so an automated client should check usage and remaining resets first and cap the amount it pays, as the Bash example does.
Bash (cURL + jq + lncli)
Python (Requests)
Prerequisites
Requires curl, jq, and an active Lightning CLI (e.g. lncli, cln, alby-cli, or WebLN).