What is the X402 Protocol?
x402 is an open protocol based on the HTTP 402 Payment Required status code that lets AI agents and other clients pay for APIs per request in stablecoins on-chain, with no accounts, API keys, or subscriptions.
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 whose JSON body lists the accepted payment options, signs a payment authorization, and retries the request with the signed payload in the X-PAYMENT header. The server verifies and settles the payment 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 and a JSON body containing an accepts[] array: each entry describes one accepted payment option, including the scheme, the network, the amount in atomic units of the asset, the asset contract address, and the payTo address. Third, the client picks an option and constructs a signed payment payload; on EVM networks this is an EIP-3009 transferWithAuthorization signature authorizing the exact amount. Fourth, the client retries the original request with the payload, base64-encoded, in the X-PAYMENT header. The server verifies the payment, settles it on-chain (typically through a facilitator), and fulfills the request with a 200 response that includes an X-PAYMENT-RESPONSE header describing the settlement.
Because the whole exchange is plain HTTP and JSON, existing tools like curl and fetch can drive the flow. Libraries and SDKs abstract away the signing 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.