Skip to content

L402

A paywall protocol built on HTTP 402 and Lightning

Visit official site

What L402 is

The protocol is described as an open paywall built on the HTTP 402 Payment Required status code and the Lightning Network for API monetization and digital services.

What you can do with it

  • Bill an API per call with micropayments
  • Gate article reading behind a paywall
  • Grant fine-grained access to specific services
  • Manage access rights with Macaroons tokens

Application scenarios

  • An API provider charges by the number of calls
  • An online publisher locks articles behind a paywall
  • A company controls access to particular data

Getting started

  • A server returns an L402 challenge with HTTP 402 Payment Required
  • The challenge carries a macaroon and a Lightning invoice
  • The client extracts both from the 402 response
  • The client pays the invoice and builds an authenticated request with the preimage

Pros & cons

✓ What we like

  • The open protocol is extensible across industries
  • Micropayments and pay-per-use open new revenue streams

! What to watch out for

  • A server must issue an L402 challenge before protected endpoints
  • Clients pay a Lightning invoice before an authenticated request

FAQ

What status code does it use?

The material states it is built on HTTP 402 Payment Required.

How does a client get access?

The documented flow is to pay a Lightning invoice and combine a macaroon with a preimage.

Last reviewed: 2026-11-15

More AI coding tools tools

View all →

How we review