Glossary · Infrastructure

What is HTTP 402?

HTTP 402 is 'Payment Required': a status code the web specified in the 1990s and never used, because there was nothing to pay with. It sat reserved until machine-to-machine payments gave it a job: a server answers 402 with a price, a client answers with payment, the request proceeds.

The code matters because it standardizes the handshake: any client, any server, one meaning. AI agents buying API calls, meters buying electricity, cars buying charging: 402 is the door they knock on.

How HTTP 402 works

HTTP 402 is the status code reserved since the protocol's early days for payment required, specified but unused because web payments had no native mechanism. The modern reading treats it as the natural handshake for machine commerce: a request hits a paid endpoint, the server answers 402 with payment terms, and the client pays and retries, now authorized.

What makes this usable now rather than a curiosity is a few missing pieces arriving at once: stablecoins give the money a settled unit, wallets give requests a signing identity, and APIs give machines something worth buying per call. A 402 interaction can carry its payment in headers, keeping the loop entirely machine-paced.

The design point is that payment becomes a protocol state rather than a page. No checkout UI, no redirect, no subscription console: just terms, payment, and access, legible to any HTTP client that can hold a key.

HTTP 402 in practice

An agent calls a data API, receives 402 with a price for the next thousand calls, pays it from its wallet in a stablecoin, and retries with the payment proof attached. The whole loop completes in under a second with no human in it.

HTTP 402 on U.CASH

U.CASH implements 402-native payments for machine and agent flows: agents hold keys, answer 402 challenges, and pay per call, with the same non-custodial settlement as every other rail.

Merchants selling to software rather than people get a metering rail that matches how software consumes: per call, per kilobyte, per result. Monetizing an API stops meaning invoicing enterprise deals and starts meaning a 402 handshake any client can complete. For planning purposes, treat 402 as complementary to subscriptions rather than their replacement: metered consumption suits variable workloads, committed suits predictable ones, and the two price the same endpoint without conflict. The merchant's win is that the metered tier stops requiring contracts, minimums, or a billing relationship per customer.

Related infrastructure terms

DEX routingCross-chain swapGas fees

See also

AI agentsDeveloper docs

HTTP 402: FAQ

Why is it called 402?
It is the HTTP status code for Payment Required, defined early and unused for decades. Payments on the web finally gave it work.
What pays in a 402 handshake?
Whatever the server prices in, typically a token the client's wallet holds. The handshake is the standard; the asset is a parameter.
Why is it called 402?
It is the HTTP status code for Payment Required, defined in the early web specification and left unused for decades for want of a native payment layer. Machine commerce finally gives it work.
How does the server know I paid?
The retry carries the payment reference or a signed token from the payment flow, which the server verifies before serving. The mechanism is part of the endpoint's terms in the 402 response.
Is this only for AI agents?
Agents are the demanding case because they consume APIs continuously. Any programmatic client, from a script to a service, can complete the same handshake.
Keep reading

The glossary, A to Z

Every term behind the rails, the assets, and the settlement.