What is L402?
L402 (formerly LSAT) uses Bitcoin's Lightning Network for instant API payments. The server issues a macaroon (a bearer token) paired with a Lightning invoice — once the agent pays the invoice, the macaroon becomes valid.
How it works
WWW-Authenticate: L402 macaroon="...", invoice="..."Authorization: L402 macaroon:preimage)Key concepts
- Macaroon: A cryptographic bearer token that becomes valid once its paired invoice is paid
- Lightning invoice: A one-time BOLT11 payment request on Bitcoin's Lightning Network
- Preimage: The proof-of-payment revealed when a Lightning invoice is settled
- Instant settlement: Lightning payments confirm in milliseconds
- Bitcoin-native: Payments are in satoshis (1 sat = 0.00000001 BTC)
How to add L402 to your service
WWW-Authenticate: L402 macaroon="", invoice="" Spec maturity
Established. Originally developed by Lightning Labs as LSAT, renamed to L402. Used in production by multiple Lightning-powered APIs.