x402 Explained: The HTTP Status Code That Took 35 Years to Ship
In 1991, Tim Berners-Lee and his team defined the HTTP status codes. 200 OK. 404 Not Found. 401 Unauthorized. And 402 Payment Required -- reserved for future use.
That future took thirty-five years to arrive.
The Original Vision
The idea behind 402 was elegant. Just as 401 tells a client "you need to authenticate," 402 would tell a client "you need to pay." The web would have a native payment layer built into the protocol itself. No third-party payment processors. No checkout pages. Just a status code and a transaction.
But in 1991, there was no way to make it work. Digital payments required credit card numbers typed into forms. Micropayments -- paying a few cents for an article or an API call -- were economically impossible when transaction fees were 30 cents plus 2.9%. The plumbing did not exist.
So 402 sat there. For thirty-five years. Every HTTP specification dutifully included it, marked "reserved for future use." Developers joked about it. Some used it as an Easter egg. Nobody shipped a real implementation.
What Changed
Two things converged to make 402 viable.
First: stablecoins on L2 networks. USDC on Base (Coinbase's Layer 2 Ethereum chain) settles in under a second with gas fees measured in fractions of a cent. For the first time, a machine can send $0.01 to another machine without the transaction cost exceeding the payment. Micropayments went from economically impossible to trivially cheap.
Second: AI agents need to spend money. We are building a world where AI agents browse the web, call APIs, and complete tasks autonomously. These agents need to pay for services. But they cannot type a credit card number into a checkout page. They need a protocol -- a machine-readable way to discover that something costs money, pay for it, and prove they paid.
HTTP 402 was sitting right there, waiting.
The x402 Protocol
In early 2025, Coinbase published the x402 specification. It defines exactly how 402 should work in practice:
- A client sends a request to a server
- The server responds with 402 and headers specifying the price, currency, network, and payment address
- The client signs a payment transaction (USDC on Base)
- The client retries the request with a payment receipt header
- The server verifies the payment on-chain and fulfills the request
The entire flow happens in HTTP. No redirect to a payment page. No webhook to wait for. No polling for payment confirmation. It is as native to the web as authentication.
The Linux Foundation Gets Involved
What turned x402 from a Coinbase project into an industry standard was the Linux Foundation. They adopted x402 as an open specification with over 22 member organizations backing it, including Coinbase, Cloudflare, Stripe, Visa, and AWS.
This matters because it signals that x402 is not a crypto niche play. When Visa and Stripe are at the table, the traditional finance world is paying attention. When Cloudflare and AWS are involved, the infrastructure is going to be there. When the Linux Foundation governs it, the specification will be open and vendor-neutral.
The coalition is a mix of crypto-native companies (Coinbase, Circle), traditional payment processors (Visa, Stripe), cloud infrastructure (AWS, Cloudflare), and developer tool companies. That breadth is unusual for a crypto-related standard and suggests real staying power.
Payment as Authentication
Here is the paradigm shift that most people miss: in x402, the payment IS the authentication.
Traditional APIs work like this: you create an account, get an API key, attach it to every request, and get billed monthly based on usage. The API key proves who you are. Billing is a separate system that charges your credit card later.
With x402, there is no account. There is no API key. There is no billing system. If you can pay, you are authorized. The payment receipt proves you paid, and that is all the server needs to know about you.
This collapses three separate systems (identity, authorization, billing) into one atomic action (payment). The implications are significant:
- No API keys to leak. There is nothing to rotate, nothing to store in environment variables, nothing to accidentally commit to GitHub.
- No accounts to manage. No signup flow, no email verification, no password resets, no billing dashboards.
- No credit risk. The server is paid before it does any work. No invoices. No chargebacks. No collections.
- Privacy by default. The server does not need to know who you are. It only needs to verify that the payment cleared.
What x402 Is Not
x402 is not a cryptocurrency pitch. You do not need to understand blockchain to use it. USDC is a dollar. One USDC equals one US dollar, always. It happens to move on a blockchain instead of through a bank, which makes it fast and cheap, but the end user does not need to care about the underlying technology.
x402 is also not a replacement for all payment systems. If you are selling physical goods with shipping and returns, you still need a traditional checkout flow. If you need recurring subscriptions with invoicing, x402 is not the right tool.
Where x402 excels is in programmatic, per-request transactions. API calls. AI agent spending. Micropayments. Machine-to-machine commerce. The use cases that traditional payment infrastructure was never designed for.
Why Now
The timing is not accidental. We are at the convergence of three trends:
- AI agents are going autonomous. Models can now browse, code, and make decisions. They need a payment protocol.
- L2 infrastructure is mature. Base, Arbitrum, and Optimism provide fast, cheap settlement.
- The developer economy is shifting. More services, more APIs, more granular billing. Per-seat is giving way to per-request.
HTTP 402 was an answer waiting for the right question. The question turned out to be: how do machines pay each other?
See x402 in Action
24K Labs runs six AI services on the x402 protocol. Try a request and see the payment flow yourself.
Quickstart Guide