
The L402 Ecosystem Has 100+ Live APIs. The Problem Is Finding Them.
HTTP 402 "Payment Required" has been a reserved status code since 1997. For nearly 30 years, no browser or server actually used it. That changed recently. What is L402? L402 is a protocol that puts Bitcoin Lightning micropayments behind the 402 status code. The flow is simple: Client requests a resource Server returns 402 with a WWW-Authenticate header containing a Lightning invoice and a macaroon Client pays the invoice (a few sats, fractions of a cent) Client retries with Authorization: L402 MACAROON:PREIMAGE Server verifies and returns the resource No API keys. No OAuth. No credit cards. No accounts. The payment is the authentication. # Example: hit an L402-protected endpoint curl https://api.example.com/v1/data # Returns: 402 + WWW-Authenticate: L402 macaroon="...", invoice="lnbc..." # Pay the invoice with any Lightning wallet, get the preimage # Then retry with the proof of payment curl -H "Authorization: L402 MACAROON:PREIMAGE" https://api.example.com/v1/data # Returns: 200 + dat
Continue reading on Dev.to
Opens in a new tab


