The x402 protocol is a new open-source payment standard designed by Coinbase to bring seamless, on-chain payments to the fabric of the internet.

The protocol allows applications, APIs, and autonomous agents to request and process payments directly over HTTP by utilizing the long-dormant 402 Payment Required status code.

đź’ˇ
HTTP status codes are standard responses used by web servers to communicate the result of a client’s request. Common codes include 200 (OK), 404 (Not Found), and 403 (Forbidden). The 402 Payment Required code was reserved in the original HTTP specification as a placeholder for future use in digital payment systems, but it was never officially implemented due to the lack of a widely accepted web-native payment mechanism.

With x402, services can charge per request, per download, or per interaction without requiring user accounts, credit cards, or third-party payment gateways. The goal is to enable machine-native, interoperable payments that are lightweight, fast, and decentralized.

X402 is a project from Coinbase’s Developer Platform team, led by contributors including Erik Reppel, Nemil Dalal, and Dan Kim. It was publicly launched in May 2025 and is released under the Apache 2.0 license, making it fully open source.

The protocol is chain-agnostic and token-flexible, and its GitHub repository is actively maintained by Coinbase engineers. The project is open to contributions and integrations by the broader developer community, reflecting Coinbase’s push toward more open infrastructure in Web3.

For decades, payment on the web relied on centralized services like PayPal, Stripe, or credit card processors, which operated outside the scope of the HTTP protocol itself. As a result, the 402 code remained unused—until now.

402 Payment Required - 200 OK

x402 works by letting websites or online services ask for a payment before giving access to something—like data, an API, or content. If a user or application tries to access something that requires payment, the server replies with a message saying, “Payment Required,” and includes instructions on how to pay. The user then makes the payment using cryptocurrency (for example, USDC on Ethereum or Base). After paying, they try again, this time including proof that the payment was made.

The payment request carries a reference to a specific on-chain transaction. Once used, that transaction hash cannot be reused (or will be rejected by the server if it is).

If the server verifies that the payment is valid, it grants access to the resource with a 200 OK response. This is fundamentally different from conventional web payments, which involve redirects, cookies, session state, and third-party SDKs. The whole communication is at the protocol level, not tied to any specific gateway like Stripe or PayPal.

The revival of HTTP 402 by the team through the x402 protocol can be seen both as a clever branding strategy and a genuinely appropriate implementation of its original intent. While the HTTP spec left 402 undefined, the idea of a payment-required response fits precisely with the use case x402 enables: a resource that will be served only after a verifiable payment has been made.

Although the original internet visionaries didn’t have blockchain or smart contracts in mind, the spirit of a native, decentralized payment layer aligns well with x402’s ambitions.

L402 and Lightning Network

Coinbase is not the only team that noticed the HTTP 402 feature. The L402 protocol, developed by Lightning Labs, was introduced in 2020 as an innovative approach to integrate native payments into the web's architecture.

L402's mechanism combines macaroons—flexible, cryptographically secure authorization tokens—with Lightning Network payments, allowing for seamless, decentralized authentication and payment processes without the need for traditional user accounts or centralized databases. The protocol's design facilitates machine-to-machine transactions, making it particularly suitable for applications like API monetization and autonomous agent interactions.

The integration of L402 with the Lightning Network was pivotal to its functionality and success. The Lightning Network provides a scalable, low-latency payment infrastructure that supports microtransactions, which are essential for the per-request payment model that L402 promotes.

Since its inception, L402 has seen growing adoption within the developer community, particularly among projects aiming to monetize APIs and integrate payment functionalities into AI applications. For instance, Sulu, a platform focused on API monetization, has implemented L402 to enable pay-per-use access to its services, reporting efficient integration and positive user engagement. Additionally, Lightning Labs has developed tools like Aperture, a reverse proxy that facilitates L402 implementation, and LangChainBitcoin, which allows AI agents to interact with the Lightning Network, further broadening L402's applicability.

x402 is still in early stages but has begun attracting attention from AI and Web3 developers. Use cases include:

  • AI agents paying per-query to access data, models, or APIs
  • Pay-per-download content platforms
  • Decentralized API marketplaces where access is monetized in real time
  • Cloud services or compute billed per call without account management overhead

Partners such as Circle, AWS, Anthropic, and NEAR have shown interest or early-stage integration plans.

If x402 gains traction, it could become a foundational payment layer for the machine internet—enabling permissionless monetization of digital services across chains and platforms. Its adoption could also signal a shift from platform-based business models toward protocol-native economies, where payments are open, programmable, and ubiquitous.

Share this article
The link has been copied!