Lightning-native API authentication for Lightning Faucet endpoints
L402 (formerly LSAT) is an HTTP authentication protocol that uses Lightning Network payments as proof of access. Instead of API keys, you pay a small Lightning invoice and receive a macaroon token that grants access to the API.
HTTP 402 Payment Required and a WWW-Authenticate header containing a macaroon and a Lightning invoice.Authorization header containing the macaroon and payment preimage.Authorization: L402 <macaroon>:<preimage>
Where:
<macaroon> is the base64-encoded macaroon from the WWW-Authenticate header<preimage> is the 64-character hex payment preimage obtained after paying the invoiceL402 (not Bearer). The legacy prefix LSAT is also accepted.
When you hit a protected endpoint without valid credentials, the response includes:
HTTP/1.1 402 Payment Required
WWW-Authenticate: L402 macaroon="<base64>", invoice="<bolt11>"
curl -X POST https://lightningfaucet.com/api/l402/fortune
# Response headers contain:
# WWW-Authenticate: L402 macaroon="eyJpZG...", invoice="lnbc..."
#
# Extract the macaroon and invoice values
# Pay the bolt11 invoice with your Lightning wallet
# Save the payment preimage (64 hex chars)
curl -X POST https://lightningfaucet.com/api/l402/fortune \
-H "Authorization: L402 eyJpZG...:abc123def456..."
/api/l402/fortune - Random fortune (10-50 sats)/api/l402/joke - Random joke (10-50 sats)/api/l402/quote - Random quote (10-50 sats)/api/l402/registry-submit - Submit an API to the registry (1,000 sats)invalid_auth_formatThe Authorization header must exactly match: L402 <macaroon>:<preimage>
L402 and the macaroonA-Za-z0-9+/=)a-f0-9)invalid_tokenThe macaroon signature doesn't match or the payment hash doesn't correspond to the preimage. Ensure you're using the macaroon from the original 402 response paired with the preimage from that same payment.
Lightning Faucet © 2026 | lightningfaucet.com