L402
In plain words
L402 is a protocol for paying for web resources with Lightning inside an ordinary HTTP request. The server replies 402 "Payment Required" with an invoice and a token; the client pays, retries with the proof and gets access. It needs no account or API key, which suits software agents.
How a request is paid
- The client asks for a paid resource.
- The server answers 402 with a Lightning invoice and a macaroon (a bearer token that can carry limits such as expiry or scope).
- The client pays; the payment reveals a secret (the preimage) that proves it paid.
- The client repeats the request with the macaroon and the preimage, and the server lets it in without looking anyone up.
Who uses it
Lightning Labs' Aperture proxy puts an L402 paywall in front of an existing API; its Lightning Agent Tools (2026) add lnget, a downloader that pays L402 invoices automatically with a spending cap, so AI agents can buy data per request. Coinbase's x402 applies the same 402 idea to stablecoins.
See also
- AI agents and BitcoinAI agents are programs that do work on their own and increasingly need to pay for it: an API call, a page of data, a minute of compute. They cannot open a bank account, but they can hold a Bitcoin key and pay over Lightning in amounts far smaller than a card can handle. That is the case for why the next billion Bitcoin users may not be people. It is a strong argument with real caveats.
- x402x402 is an open payment standard started by Coinbase and now run by the x402 Foundation. Like L402 it uses HTTP 402, but it mostly settles in USDC stablecoins on chains such as Base and Solana rather than in bitcoin.
- CashuCashu is an open-source ecash protocol for Bitcoin. A mint holds bitcoin and issues blinded tokens that are private, instant and can be passed around as plain text; the trade-off is that the mint is custodial.
- Nostr Wallet Connect (NWC)Nostr Wallet Connect (NIP-47) lets an app or an AI agent ask your Lightning wallet to pay or create invoices over encrypted Nostr messages, within a budget you set, without ever holding the wallet's keys.
- Lightning NetworkLightning is a payment network built on top of Bitcoin. Two parties lock bitcoin in a shared channel and then pay each other instantly and cheaply off-chain; payments can hop across channels to reach anyone.
References
- Lightning Labs: L402 protocol documentation docs.lightning.engineering
- Aperture: L402 reverse proxy (GitHub) github.com
- Lightning Labs: Lightning Agent Tools (Feb 2026) lightning.engineering
- MDN: 402 Payment Required developer.mozilla.org