What Is x402: Machine Payments for AI Agents

What Is x402: Machine Payments for AI Agents

Crypto APIs Team

Sep 25, 2026 • 5 min

x402 is an open payment standard that lets software pay for HTTP requests using the long-dormant HTTP 402 Payment Required status code. An AI agent calls an API, receives a 402 with payment instructions, settles the amount in stablecoins or Bitcoin Lightning, and retries the same request to get its response. It turns any endpoint into something an autonomous program can pay for without a human, an account, or a saved card.

x402 is a standard for machines to pay for API calls

The HTTP specification has reserved status code 402, Payment Required, since the early 1990s. It sat unused for decades. x402 fills it in. The idea is simple: when a client requests a paid resource, the server responds with 402 and a header describing what to pay, where, and in what asset. The client pays on-chain, attaches proof, and retries. The second request succeeds.

Adoption is widening. Block added Bitcoin Lightning support to x402, so agents can settle in Lightning as well as stablecoins such as USDC on Base. Cloudflare, AWS CloudFront, and 0x have shipped x402 support for API monetization. The pattern is the same across all of them. Only the settlement rail changes.

The reason this matters now is AI agents. An agent that browses, trades, or aggregates data hits paid APIs constantly. Traditional billing assumes a human signed up, entered a card, and agreed to terms. Agents do none of that. x402 gives them a native way to pay per call, in seconds, with no prior relationship to the service.

How it works

The flow has three steps and no accounts.

First, the client sends a normal request. The server checks for payment. If none is present, it returns 402 Payment Required with a payment payload: the amount, the accepted asset and chain, the recipient address, and a nonce. On Base that might be a few cents of USDC. On Lightning it might be a sub-cent invoice.

Second, the client pays. For a stablecoin rail this is a signed transfer on an EVM chain like Base; for Lightning it is paying an invoice. The client then repeats the original request with a header carrying the payment proof.

Third, the server verifies the proof and returns the resource with 200 OK. Settlement and delivery happen inside a single request-retry cycle, typically in under a second for Lightning and within block time for stablecoins.

Crypto APIs runs live x402 endpoints through our AI compatibility layer, including MCP (Model Context Protocol) servers and an n8n integration. That means an agent can pay for blockchain data, fee estimates, or AML screening using the same 402 handshake it uses elsewhere. The agent does not need a Crypto APIs account provisioned in advance. It pays per call.

Behind the paid call sits normal infrastructure. An agent building a payment flow might screen a counterparty before sending funds. That call is a straightforward GET with the address in the path:

GET https://rest.cryptoapis.io/aml/addresses/{address}
Header: X-API-Key: <your key>

Response (200):
{"apiVersion":"2024-12-12","requestId":"6aa3c48d2f6f68835e3dbf05","data":{"item":{
  "isFlagged":false,"riskScore":0,"riskBand":"low","severity":"none",
  "categories":[],"sources":[]}}}

x402 governs how the agent pays for that request. The endpoint itself is unchanged.

Why it matters

x402 removes the account layer from API commerce. There is no signup, no API key issuance for the payment relationship, no monthly minimum. A program discovers a service, pays for one call, and moves on. For agent developers, this changes what an agent can do without a human in the loop.

Consider a treasury agent that needs current fee data before broadcasting a transaction. It can pay a few cents for a fee estimate, pay again for an AML check on the destination, and pay a third time to broadcast. Each step is metered, priced, and settled independently. No standing contract ties them together.

For infrastructure providers, x402 aligns cost with usage precisely. An agent that makes ten thousand calls pays for ten thousand calls, on-chain, without invoicing. Stablecoin settlement on Base keeps per-call fees low enough that micropayments are practical. Lightning pushes them lower still, into fractions of a cent, which suits high-frequency read operations.

The standard is also chain-neutral by design. The 402 response names the asset and network it accepts. A server can accept USDC on Base and Lightning at once, letting the client choose. That optionality is what makes x402 durable rather than tied to one rail.

Common misconceptions

x402 is not a new blockchain or token. It is an HTTP convention that reuses an existing status code and settles on chains that already exist. There is nothing to buy beyond the stablecoin or Bitcoin you pay with.

It is not only for AI. Any HTTP client can implement the handshake. Agents are the driving use case because they operate without human billing, but a script or a backend service can use x402 the same way.

It does not replace subscriptions everywhere. For predictable, high-volume workloads a flat plan is often cheaper than per-call settlement. x402 is strongest where usage is bursty, unpredictable, or driven by an agent that has no prior relationship with the service.

It is not a compliance shortcut either. Paying per call over x402 does not exempt anyone from screening counterparties or meeting jurisdictional rules. The payment layer and the compliance layer are separate concerns. An agent still has to check the addresses it pays and receives from.

x402 is a small idea with a large surface: give machines a native way to pay for the requests they make. The plumbing already existed in HTTP and on public chains. What was missing was the convention that ties a 402 response to an on-chain settlement and back to the original request. That convention is now shipping across gateways and payment rails, and it is what lets an autonomous program transact for itself.

Frequently asked questions

What assets can an agent pay with over x402?

It depends on what the server accepts. Common options are stablecoins such as USDC on Base and, following Block's addition, Bitcoin over Lightning. The 402 response names the accepted asset and network, and the client chooses among them.

Do I need an account to use an x402 endpoint?

No. That is the point. The client pays per call using the payment instructions in the 402 response, with no signup or stored payment method. This is what makes it workable for autonomous agents.

How does x402 relate to MCP and n8n?

MCP servers and n8n workflows are how agents call tools and services. x402 is how those calls get paid for. Crypto APIs exposes both, so an agent can invoke a Crypto APIs tool and settle the cost through the 402 handshake in the same flow.

Infrastructure optimized for growth

35+

Networks Supported

25ms

Avg Processing Time

25,000+ rq/s

Enterprise-ready

100+ TB

of Big Data

Related articles

Share