Glossary

What is L402 (formerly LSAT)?

L402 is Lightning Labs' protocol for paying for APIs with HTTP 402, a macaroon and a Lightning invoice. The header flow, and how it differs from x402.

L402 is an open protocol developed by Lightning Labs for paying for and authenticating access to APIs over HTTP, combining the 402 Payment Required status, a macaroon credential and a Bitcoin Lightning Network invoice; it was formerly known as LSAT.

How does it work?

A client requests a protected resource and the server replies 402 with a challenge: WWW-Authenticate: L402 macaroon="…", invoice="…". The client pays the Lightning invoice and receives a preimage, a 32-byte value whose SHA-256 hash is the invoice's payment hash, so holding it proves the invoice was paid. The client then retries with Authorization: L402 followed by the macaroon and the hex preimage, separated by a colon. The server checks the preimage against the hash committed in the macaroon, which it can do without a database lookup. Macaroons are bearer credentials that carry caveats. The specification says caveats can encode service access, capabilities, expiry, volume limits and other constraints, and each one can only narrow access. Unlike a single-use payment, L402 credentials are meant to be reused: a client caches one and keeps sending it until the server answers with a new challenge. The specification reserves 402 for that first challenge and says a server must reply 401, not 402, when a presented credential fails. For compatibility with the old name, servers should offer both LSAT and L402 schemes and clients and servers must accept both. Lightning Labs' Aperture is a reverse proxy that implements L402 in front of existing services.

In practice

To pay L402 APIs, an agent needs a Lightning wallet it can pay invoices from and a client that understands the challenge and caches credentials. Put limits on that wallet: each invoice is small, but a looping agent can pay many. To sell over L402, you can run Aperture in front of your API and decide which caveats, such as expiry or usage tier, each credential carries.

What it does not mean

  • L402 isn't x402. L402 settles over Bitcoin's Lightning Network with macaroons; x402 uses signed payments, typically stablecoins, on networks such as Base.
  • A 402 response isn't always L402. Without the L402 or LSAT scheme in WWW-Authenticate, it's something else.
  • The credential isn't single-use; it's designed to be reused until it expires or is revoked.
  • A macaroon is a bearer token: anyone holding it with the preimage can use it, so store it like a password.

Where does Veyra fit?

Veyra doesn't implement L402, doesn't pay Lightning invoices and doesn't handle bitcoin. It controls USDC payments on Base, so it isn't a way to pay L402 APIs.

Veyra's spend policy for one agent endpoint: per-transaction limit, daily limit, auto-approve limit, ask-up-to limit and recipient allowlist
What this looks like in Veyra: one spend policy per agent endpoint, with a per-payment cap, a daily cap, an auto-approve band, an ask band and a recipient allowlist, all checked on the server. Try the free policy generator →

Sources

Guides that use this term

This page explains how agent payments and the related technology work. It is not financial, investment, legal or tax advice. Protocols and provider features change; check the linked official sources before relying on a detail.