# What is L402?

> L402 is a standard from Lightning Labs for charging for web resources with bitcoin over the Lightning Network. A server answers with status 402, a token and a Lightning invoice. The client pays the invoice, which reveals a secret, and presents the token with that secret to get access. The token, usually a macaroon, can be reused for later requests.

## The short version

L402 puts a price on an HTTP request and takes payment in bitcoin, through the Lightning Network. Lightning Labs, which develops it, describes it as "the standard for selling and buying digital resources".

It is older than x402 and was earlier known as LSAT. Some servers still send that name.

## How a payment works

1. The client asks for a resource.
2. The server replies **402** with a `WWW-Authenticate: L402` header holding two things: a token and a Lightning invoice.
3. The client pays the invoice. Paying it reveals a secret called the **preimage**.
4. The client repeats the request with `Authorization: L402`, sending the token and the preimage together.
5. The server checks them and returns the resource.

The token is tied to the invoice. A valid token with the matching preimage shows that the invoice was paid.

## The two ideas that make it work

| Idea | What it is | Why it matters |
|---|---|---|
| Preimage | A secret released only when a Lightning invoice is paid | It is the proof of payment. No one can produce it without paying |
| Macaroon | The recommended token format | A server can verify one "using only a root key and basic cryptography", with no lookup in a payments database |

Macaroons have one more property. Whoever holds one can narrow what it allows before passing it on, for example to a sub-agent with fewer rights.

## A pass, not just a payment

In x402, a standard payment buys one response. In L402, the buyer ends up holding a credential. The server decides what that credential is good for: one request, a hundred, or a period of time. So L402 naturally sells access as well as single calls.

## What you need

- **To pay:** a Lightning wallet holding bitcoin, and a client that understands L402.
- **To charge:** a Lightning node or service to issue invoices, and something that speaks L402 in front of your API.

Lightning Labs publishes **Aperture** for the second part. It is an open-source reverse proxy that issues the invoices and tokens and forwards paid requests to your backend. It handles both gRPC and REST. Lightning Labs' own Loop service uses it.

## Key facts

| | |
|---|---|
| Developed by | Lightning Labs |
| Formerly called | LSAT |
| Pays with | Bitcoin over the Lightning Network |
| Prices are in | Satoshis, the smallest unit of bitcoin |
| HTTP status | 402 for the first challenge |
| Token format | Macaroons recommended |
| Reference proxy | Aperture |

## L402 and x402

They share a status code and a goal. They differ in the money and in what the buyer holds afterwards. L402 is bitcoin only. x402 works across many blockchains and is mostly used with dollar stablecoins.

They also overlap. The x402 repository includes a specification for its `exact` scheme on Bitcoin Lightning, where the proof of payment is likewise the invoice preimage.

The full comparison, and which to choose, is in [x402 vs L402](https://www.ask402.ai/x402/x402-vs-l402).

## See one

The [402 checker](https://www.ask402.ai/tools/402-checker) recognizes L402 replies, including older ones that use the LSAT name, and shows the invoice amount.

## Sources

- [L402, Lightning Labs documentation](https://docs.lightning.engineering/the-lightning-network/l402)
- [L402 protocol specification, Lightning Labs](https://github.com/lightninglabs/L402/blob/master/protocol-specification.md)
- [Scheme specifications, x402 repository](https://github.com/x402-foundation/x402/tree/main/specs/schemes)

---

Facts checked against the sources above on 2026-11-20. Canonical page: https://www.ask402.ai/x402/what-is-l402
