HTTP 402 · AGENTIC WEB

HTTP 402 Payment Required — What It Means for AI Agents

HTTP 402 Payment Required has existed in the HTTP spec since 1.1, reserved for “future use.” The x402 protocol is what that future use turned out to be: a server returns 402 with a machine-readable payment requirement, and an AI agent's own middleware settles that requirement on-chain and retries — all without a human clicking anything.

Quick facts

  • Historic status: 402 has been in the HTTP spec since RFC 2616 (1997), essentially unused until x402.
  • Machine-first design: the 402 response body is structured JSON an agent's code can parse and act on directly — not an HTML paywall for a human to read.
  • Retry pattern: agent requests → 402 + requirements → agent pays on-chain → agent retries with proof → 200 OK.
  • Live implementation: SqueezeOS's MCP server returns real 402 responses on its premium tools.

Frequently asked questions

Why wasn't HTTP 402 used before?

There was no standardized, machine-verifiable way to actually complete a payment inline with an HTTP request until on-chain settlement (stablecoins, fast finality ledgers) made it practical for software — not humans — to negotiate and settle payment in milliseconds to seconds.

Do human users ever see a 402 response?

Not directly in agent-to-agent flows — the response is consumed and resolved entirely by the calling agent's middleware before any result reaches a human.

Can any web server return HTTP 402?

Yes, any server can return the status code. x402 standardizes what goes in the response body (payment requirements) and what the client is expected to do next (pay, then retry with proof).

Related