What it is
L402 (Lightning Labs Authentication Tokens, formerly "LSAT") is an open protocol that lets an HTTP server demand payment for a request and a client — typically an AI agent or another machine — pay it programmatically without involving a human. The flow is: client requests a paid resource; server returns HTTP 402 ("Payment Required") with a Lightning Network invoice and a "macaroon" (a scoped, authenticated token that becomes valid once the invoice is paid); client pays the invoice; client retries the request with the now-valid macaroon attached; server fulfills. It originated at Lightning Labs around 2020 and was renamed from LSAT to L402 in 2022. In 2025, Coinbase introduced x402, the same HTTP 402-based pattern but with stablecoin (USDC) settlement on Layer 2 rather than Lightning, broadening the protocol family. Both target the same gap: native, machine-speed, sub-cent payments that credit card rails cannot serve.
Why it matters
AI agents are starting to spend money — paying for premium APIs, scraping permission-gated content, tipping data providers, transacting with other agents. Credit card rails were not built for any of this: high minimum charges, human approval flows, chargeback risk, KYC overhead per merchant relationship. L402 (and x402) flip the model: every paid resource exposes its price natively in its HTTP response, agents pay autonomously within preset budgets, settlement is final and instant, and amounts can be fractions of a cent. As the "agent economy" emerges in 2026, the protocols that make agent-to-API and agent-to-agent payments practical are quietly becoming critical infrastructure. Most AI engineers have not heard of L402 yet; the ones who have are building the substrate that will run agent commerce in 2027.
Key components
- HTTP 402 — the long-reserved-but-unused HTTP status code for "Payment Required," now finally meaningful
- Lightning Network — Bitcoin Layer 2 enabling sub-cent, near-instant, machine-speed payments
- Macaroons — bearer tokens with attenuable scope, issued in the 402 response and validated post-payment
- Invoice + token round-trip — server issues invoice, client pays, server validates and accepts the token
- x402 — Coinbase's 2025 variant of the same pattern using USDC stablecoin settlement instead of Lightning
Related terms
MCP (Model Context Protocol)
Anthropic's open standard for connecting AI models to external data sources and tools. Think of it as a universal adapter for AI.
AI Agent
An autonomous AI system that can perceive its environment, make decisions, and take actions to achieve specific goals - without constant human direction.
Agent Operations
The discipline of running AI agents in production — capturing what they do, attributing what it costs, evaluating what they produce, and intervening when something goes wrong. The operational layer above agent observability and orchestration.
Agent Infrastructure
The runtime, network, and tooling substrate that AI agents need to execute reliably — sandboxed compute, tool access, memory, gateways to LLM providers, and the orchestration plumbing that connects them. Closer to the metal than agent operations.
LLM Gateway
A unified proxy in front of multiple LLM providers that captures every call, enforces policy, and lets a single application talk to Anthropic, OpenAI, xAI, Gemini, and local models through one interface.