What is the X402 Protocol?
Overview
X402 is an open protocol that enables machine-native payments on the web. It builds on HTTP status code 402 ("Payment Required"), which was reserved in the original HTTP specification but never standardized. X402 gives that status code a concrete meaning: when a server returns 402, it includes payment instructions that any client -- human or machine -- can follow to unlock the resource.
The result is a web where APIs can charge per-request without requiring user accounts, API keys, or monthly subscriptions. A client sends a request, gets a 402 response with a price and a payment address, makes a crypto payment, and retries the request with a payment proof. The server verifies the proof and returns the data.
How It Works
The X402 flow has four steps. First, a client makes a standard HTTP request to a protected endpoint. Second, the server responds with HTTP 402, including headers that specify the price, accepted payment networks (such as Base, Solana, or Polygon), and the payment address. Third, the client constructs and submits a blockchain transaction for the specified amount. Fourth, the client retries the original request, attaching the transaction hash or a signed payment proof in the request headers. The server validates the payment on-chain and fulfills the request.
Because the payment information is embedded in standard HTTP headers, existing tools like curl and fetch can be extended to handle the flow. Libraries and SDKs abstract away the payment step entirely, making X402 requests feel like ordinary API calls.
Why It Exists
Traditional API monetization relies on API keys, OAuth tokens, and billing platforms. These systems require account creation, credit card entry, rate-limit management, and invoicing infrastructure. They work for humans but create a bottleneck for autonomous software. An AI agent that needs to call a new API cannot sign up for an account, enter payment details, and wait for key approval.
X402 removes that bottleneck. Any client with a funded wallet can pay for any X402-enabled endpoint instantly, without registration. This makes the web programmable at the transaction layer, not just the data layer.
Who Uses It
X402 is used by API providers who want to monetize endpoints without building billing infrastructure. It is used by AI agents and autonomous systems that need to discover and pay for services programmatically. It is used by developers building composable applications that chain multiple paid APIs together. And it is used by researchers and hobbyists who want pay-per-use access without monthly commitments. You can explore live X402 services in the service directory.
X402 vs API Keys
API keys gate access but do not handle payment. They require a signup flow, a billing system, and manual key management. X402 combines access control and payment into a single HTTP exchange. There are no keys to rotate, no accounts to manage, and no invoices to reconcile. The payment itself is the credential. For a detailed comparison, see X402 vs Traditional API Payments.