voidly
Guide · updated 2026-05-30

What Is x402? HTTP 402 for AI Agents, Explained

HTTP 402 "Payment Required" sat unused in the spec for 25 years. x402 finally gives it a job: letting a server charge an AI agent for a request, and letting the agent pay automatically.

6 min read

The 25-year-old status code that finally has a use

HTTP 402 Payment Required has been "reserved for future use" since the original HTTP spec. x402 is that future: a convention for using 402 to do real machine-to-machine payments over plain HTTP. No new protocol, no special port — just a 402 response with a structured body the client knows how to pay.

The handshake, concretely

A client requests a paid resource. The server responds 402 with an "accepts" array — each entry describing a way to pay: the scheme (e.g. "exact" for an exact-amount EVM/USDC transfer), the network (e.g. Base mainnet), the asset, the amount, and where to send it. The client picks a scheme it supports, makes the payment, attaches proof, and retries the request. The server verifies and returns the resource.

Because the 402 body is machine-readable, the agent does not need a human-built integration per API. Any x402-aware client can pay any x402 server.

Discovery: how agents find what they can pay for

A 402 only happens once you hit an endpoint. To find endpoints in the first place, x402 has a discovery layer — a catalog of resources, each with its canonical accepts[] entry. Crawlers and agent frameworks index these catalogs so an agent can ask "what can I buy?" before it spends anything.

A well-formed catalog lists each resource with its price, network, asset, and pay-to address, so an agent (or a directory like an x402 scanner / bazaar) can plan a purchase programmatically.

Credits vs on-chain

x402 supports more than one settlement scheme on the same resource. A server can accept a canonical on-chain USDC transfer AND a faster native-credit scheme. Agents that want instant, gas-free settlement use credits; agents that want pure on-chain settlement use the USDC scheme. The 402 body advertises both.

Where Voidly fits

Voidly Pay is x402-native: it returns canonical 402 quotes (EVM/USDC on Base + a native voidly-credit scheme), runs a facilitator that signs quotes against MitM, and publishes a canonical x402 discovery catalog of every paid endpoint at /v1/pay/x402/resources.

FAQ

Is x402 a blockchain protocol?

Not exactly. x402 is an HTTP convention. It commonly settles on-chain (USDC on Base via EIP-3009), but it can also settle via off-chain credit schemes. The blockchain is one settlement option, not the protocol itself.

What does a 402 payment quote contain?

An "accepts" array; each entry has a scheme, network, asset, maxAmountRequired (in the asset's base units), a pay-to address, the resource URL, and a timeout. The client picks an entry it supports and pays it.

How does an agent discover x402 endpoints to pay for?

Through an x402 discovery catalog — a list of resources each carrying its canonical accepts[]. Indexers (x402 scanners / bazaars) crawl these so agents can browse what is payable. Voidly publishes one at /v1/pay/x402/resources.

More on the agentic economy

What Is the Agentic Economy?
The agentic economy is software agents transacting with other software agents — paying for data, tools, and work without a human in the loop. What it is, why it matters in 2026, and where the money is.
How Do AI Agents Pay Each Other?
A clear technical walkthrough of how autonomous AI agents pay each other: cryptographic identity, signed payment envelopes, HTTP 402 / x402, escrow, and stablecoin settlement — with a working example.
Anthropic, the Anthology Fund & AI Payments Infrastructure
How Anthropic and the Anthology Fund relate to the agentic economy and AI-payments infrastructure — the investment thesis, what gets funded, and what builders need to show. An independent explainer.
AI Agent Payment Protocols Compared
A neutral comparison of the main ways AI agents pay for things: x402 (HTTP 402), Google's AP2, Lightning's L402, and stablecoin transfers. Strengths, trade-offs, and when to use each.
How to Add Payments to an MCP Server
Step-by-step: turn your MCP server or API into something AI agents can pay for, using x402 and an agent-payment SDK. Identity, the 402 handshake, pricing, and discovery — with a three-line example.
Anthropic for Startups: Credits, Programs & the Anthology Fund
An independent guide to the ways startups get value from Anthropic in 2026: API credits, the for-startups program, and the Anthology Fund — what each is, what it is not, and how to qualify.
How to Fund an AI Agent Startup in 2026
A practical, hype-free playbook for funding an AI-agent or agent-payments startup in 2026: credits, angels, agent-focused funds like Anthology, and the traction that actually unlocks each.

Independent explainer published by Voidly. Not affiliated with, endorsed by, or funded by any company named. Cite as https://voidly.ai/agentic-economy/what-is-x402