x402 – Mangrove

GlossaryAgents and tools

x402

Definition: x402 is an open protocol that uses the Hypertext Transfer Protocol (HTTP) status code 402 Payment Required so a client can pay for a request.

HTTP is the protocol that browsers and other programs use to request web pages and data, and each response carries a three-digit status code, such as 404 when nothing was found at the address requested. Under x402, a paid request works in four steps. The client, which may be an AI agent, requests a resource. The server answers with status 402 and a PAYMENT-REQUIRED header, a labeled field attached to the response. The header states the price, the network, the address to pay and the schemes the server accepts, meaning the ways it charges, such as a fixed price. The client signs a payment and sends the same request again with the signed payment in a PAYMENT-SIGNATURE header. The server can pass the payment to a facilitator, a service that verifies the payment and settles it on the payment network, and then returns the resource with a PAYMENT-RESPONSE header that reports the outcome (x402 documentation; Coinbase documentation). These header names are from version 2 of the protocol. The client needs no account or API key with the server, though it does need a wallet that holds the payment asset, and the server needs no checkout page.

x402 is not tied to one blockchain or currency. Its site says it supports all EVM-compatible chains, meaning blockchains that run the Ethereum Virtual Machine, the environment that runs programs on Ethereum, as well as Solana and other blockchains. The site names stablecoin payments as the primary use case. A stablecoin is a cryptocurrency designed to keep a steady value. Coinbase’s documentation names USDC as the most common asset, and Circle, which issues USDC, says it is “redeemable 1:1 for US dollars” (Circle). The site also says the protocol itself charges no fee. A facilitator may charge for its service: Coinbase’s facilitator, for example, charges a fee for each transaction it records on a blockchain beyond a monthly free allowance (Coinbase). For example, an agent that needs data from a paid API may receive a 402 response with the price, pay from its own wallet and retry the request.

Some Mangrove workflows support x402 payments, and a fresh x402 installation of the open-source Mangrove Agent pays in USDC on Base mainnet, the live network of the Base blockchain, where payments spend real USDC.

The status code is older than the protocol. A 1992 list of HTTP status codes, which the World Wide Web Consortium (W3C) keeps as a historic document, included “PaymentRequired 402” and said the client “may retry the request with a suitable ChargeTo header” (W3C). RFC 2068 (January 1997), the internet standards document, or Request for Comments, that defined HTTP/1.1, said of 402: “This code is reserved for future use.” RFC 9110, HTTP Semantics (June 2022), still describes it as “reserved for future use”. Coinbase introduced x402 on 6 May 2025 in a post by Erik Reppel, Nemil Dalal and Dan Kim. On 2 April 2026 the Linux Foundation announced the x402 Foundation as “the neutral home for x402”, with the protocol contributed by Coinbase. The protocol’s site is x402.org.