x402 is an open-source payments protocol developed by Coinbase that is built on the HTTP standard. It utilizes the historically dormant 402 Payment Required status code to enable internet-native, machine-to-machine micropayments using on-chain assets like stablecoins.
The x402 protocol was designed to address perceived inefficiencies in traditional online payment systems, such as credit cards and bank transfers, which are often characterized by high friction, slow settlement times, and a lack of suitability for programmatic or automated transactions. [8] The project's core philosophy is that payments on the internet should be as seamless and native as the flow of information. It aims to create a payment rail that is equally accessible to human users and autonomous AI agents, facilitating a pay-per-use economy for digital resources like API calls, data access, and cloud computing. [6] [1]
Coinbase positioned the protocol as a way of "fixing the internet's first mistake," arguing that traditional payment rails were built for a "pre-internet world" and are slow, expensive, and geographically limited. [8] The protocol resurrects the experimental HTTP 402 status code to create a payment system native to the internet, embedding stablecoin payments directly into web interactions. With the rise of machine-to-machine interactions and AI-driven services, the protocol aims to provide a payment layer that is instant, programmable, interoperable, and trust-minimized. [9]
The protocol is designed as an open standard to prevent reliance on any single party. It is chain
In the announcement of the protocol, Erik Reppel, Head of Engineering at Coinbase Developer Platform, stated: "Just like HTTPS secured the web, x402 could define the next era of the internet; one where value moves as freely and instantly as information. We’re laying the groundwork for an economy run not just by people, but by software—autonomous, intelligent, and always on.” [7] [8] The protocol emphasizes trust minimization, with payment schemes designed to prevent intermediaries from misusing a client's funds. It also prioritizes ease of use for developers, aiming for a "one-line" integration to abstract away crypto-related complexities like gas fees and RPC node management. [6]
The development of x402 was led by the Coinbase Developer Platform, with the project's whitepaper authored by Erik Reppel, Ronnie Caspers, Kevin Leffew, Danny Organ, Dan Kim, and Nemil Dalal. [2]
Key milestones in its early history include:
ROADMAP.md
and PROJECT-IDEAS.md
files were added to the repository, outlining the future direction and potential applications for the protocol.These events illustrate the project's progression from conception to a publicly launched, multi-chain protocol. [6] [7]
The x402 protocol is built directly into the existing HTTP framework, leveraging standard status codes and headers to facilitate payments without requiring a new communication layer.
The protocol's functionality is centered on the HTTP 402 Payment Required
status code, which was defined in early web standards but has remained largely unused for over 25 years. When a client requests a protected resource from an x402-enabled server, the server can respond with a 402 status. This response includes a JSON body containing the payment details, such as the required amount, recipient address, and the accepted token and blockchain network. The client then uses this information to construct, sign, and attach a payment payload to a subsequent request for the same resource. The server verifies this payload before granting access. This entire process occurs within a standard request-response cycle. [2] [3] [9]
The x402 architecture involves three primary actors:
This architecture allows for a separation of concerns, where the resource server focuses on providing its core service while the facilitator handles the complexities of blockchain interaction. [6]
The payment and resource access process follows a defined sequence of steps:
client
makes a standard HTTP request to a resource server
for a protected resource.402 Payment Required
status. The response body contains a JSON object detailing the accepted payment methods, including price, currency, and network.client
selects a payment method and uses its wallet to create and cryptographically sign a payment payload. This is often done using standards like EIP-712 to ensure the signing message is human-readable.client
sends a new HTTP request for the same resource, this time including the signed payment payload in a custom X-PAYMENT
header.resource server
receives the paid request and verifies the payment payload. It can do this locally or by sending the payload to a facilitator server
's /verify
endpoint.resource server
processes the request and generates the resource.resource server
settles the payment. This can be done by interacting with the blockchain directly or by sending the verified payload to the facilitator server
's /settle
endpoint.facilitator server
submits the transaction to the blockchain, waits for confirmation, and returns the result (including the transaction hash) to the resource server
.resource server
sends a 200 OK
response to the client
, delivering the requested resource. It may also include an X-PAYMENT-RESPONSE
header with details of the successful transaction.This flow integrates payment directly into the web's native communication protocol, using the custom headers to manage the transaction without altering how HTTP fundamentally works. [6] [7] [9]
exact
, used for transferring a specific, predefined amount. A future theoretical scheme, upto
, could be used for payments up to a certain amount based on resource consumption, such as for LLM token generation.(scheme, network)
pairs, such as an exact
payment on Ethereum or Solana.POST /verify
to validate a payment payload, POST /settle
to submit a payment to the blockchain, and GET /supported
to list the payment schemes and networks the facilitator supports.These concepts provide a flexible and extensible framework for internet-native payments. [6] [3]
The x402 Bazaar is the discovery layer for the protocol's ecosystem, described by Coinbase as a "search engine for agents" and the first discovery layer for agentic commerce. It functions as a decentralized, open network where servers advertise their paid services by hosting a machine-readable x402.json
manifest file, typically at a .well-known/x402.json
path. This file lists the available resources, API endpoints, pricing details, and accepted payment methods, creating a marketplace for AI agents to autonomously discover and pay for APIs without human intervention. The primary purpose of this system is to solve tool discovery for AI, allowing agents to dynamically find and use new services as they are added to the ecosystem. This unlocks a new class of self-improving, adaptive agents that can evolve in capability as the network of available tools grows, enabling them to perform complex, multi-step tasks like researching data, commissioning AI-generated art, or booking services automatically. [4] [5] [6]
The design of x402 presents a fundamental shift from traditional online payment systems like Visa, Stripe, and PayPal. While traditional systems are platform-first and human-centric—requiring logins, user accounts, and manual steps—x402 is protocol-first and optimized for machine-to-machine interactions. Key differences include:
This structure enables a backend-to-backend monetization model that is native to the internet's architecture. [9]
Major payment incumbents have also begun exploring AI-powered and stablecoin-based payments. Visa has announced initiatives for AI agents to make purchases, Stripe has introduced stablecoin financial accounts, and PayPal has launched its own stablecoin (PYUSD) with a rewards program. However, these efforts operate within centralized, "walled garden" ecosystems. Their services are permissioned, governed by corporate policies, and require onboarding and platform approval. In contrast, x402 is an open and permissionless protocol, allowing any developer to integrate it without needing a merchant account or approval. This distinction between a closed service and an open protocol is central to x402's goal of creating a more decentralized, agent-driven economy. [9]
The x402 protocol itself is an open standard and does not impose any fees on merchants or customers. It is free to implement and use. However, transactions conducted using the protocol are subject to the standard network fees (gas fees) of the underlying blockchain on which the payment is made. By leveraging low-cost Layer 2 networks, these fees can be nominal, making micropayments as low as $0.001 economically feasible. This model contrasts with traditional payment systems, which often include a fixed fee plus a percentage of the transaction value. [1] [2]
Stablecoins like USDC are central to the protocol's function. Their price stability allows agents and developers to transact in predictable units without exposure to crypto market volatility. Furthermore, stablecoins on high-speed chains like Base or other Layer 2s offer fast finality, with transfers confirming in seconds for minimal fees, making them ideal for the high-frequency, low-value transactions x402 is designed to handle. [9]
The protocol is designed to enable new monetization models for the digital economy, particularly for programmatic and automated systems.
A primary focus of x402 is to provide a payment layer for "agentic commerce," where autonomous AI agents can transact without human intervention. This allows agents to pay for resources on demand as they perform tasks, transforming them from tools that require constant human interaction into autonomous economic actors. [8]
Illia Polosukhin, co-founder of NEAR, commented on this potential: "Our vision merges x402’s frictionless payments with NEAR intents, allowing users to confidently buy anything through their AI agent, while agent developers collect revenue through cross-chain settlements that make blockchain complexity invisible.” [7]
The concept of "agentic payments" is central to the x402 use case. These are payments made automatically by software agents, not humans, and are characterized by being fast, programmatic, and often of low value. Traditional payment infrastructure was not designed for this, as it requires manual steps, has high fees, and features slow settlement times, making it unsuitable for autonomous, high-frequency transactions. Agentic payments are crucial for enabling a machine-first economy, allowing for real-time AI decision-making by removing friction from access to paid services and paving the way for composable services where agents can chain together paid APIs autonomously. [9]
x402 offers developers and creators an alternative to subscription-based or ad-supported revenue models.
These use cases are facilitated by the protocol's ability to handle small, frequent transactions efficiently and without the friction of user registration or credit card entry. [2] [3]
x402 was launched as an open-source project with backing from Coinbase and a number of collaborators from the technology and web3 industries.
The protocol is an initiative of the Coinbase Developer Platform, and its primary repository is maintained under the Coinbase organization on GitHub. The standard is licensed under Apache-2.0, encouraging broad adoption and community contributions. Official developer resources include documentation hosted on GitBook and a Vercel starter template for building AI applications with x402. [6] [3]
Official libraries and SDKs are provided to facilitate integration for both client and server applications in several programming languages:
These libraries aim to simplify the process of implementing the x402 payment flow. [6]
At its launch on May 6, 2025, the project was announced with support from several key organizations.
Gagan Mac, vice president of product management at Circle, commented that x402 “elegantly simplifies real-time monetization” and unlocks “exciting new use cases like micropayments for AI agents and apps.” [8] Rish Mukherji, founder of early adopter Neynar, noted the protocol's utility: "x402 turns Neynar’s Farcaster APIs into a pure on-demand utility—agents can pull exactly the data they need, settle in USDC on the same HTTP 402 round-trip, and skip API keys or pre-paid tiers entirely." [7]
In September 2025, Vercel announced x402-mcp
, a library designed to integrate the x402 payment protocol with the Model Context Protocol (MCP) and the Vercel AI SDK. This collaboration addresses the challenge of AI agents needing to access paid external services without manual setup, such as managing API keys and separate billing. The integration allows developers to define paidTool
s within their MCP servers, specifying a price for each tool call. When an AI agent needs to use one of these tools, the x402-mcp
library facilitates the payment on a per-call basis using x402. This creates a self-sustaining ecosystem where developers can monetize their tools directly, and AI agents can autonomously discover, authorize payment for, and utilize a growing range of capabilities without pre-existing commercial relationships. [7]