What is x402? The HTTP payment protocol for AI agents
x402 is an open payment protocol that lets any HTTP endpoint charge for a request, and lets any client (a person, a script or an AI agent) pay for it on the spot. It was introduced by Coinbase in 2025 and is now stewarded by the x402 Foundation together with Cloudflare and others. The name comes from the HTTP status code 402 Payment Required, which was reserved in the original HTTP spec "for future use" and sat unused for almost 30 years.
Why it matters for AI agents
Agents are good at calling APIs, but bad at signing up for them. Every paid API today wants an account, an email, a credit card, an API key and usually a monthly plan. x402 removes all of that:
- No accounts or API keys. The payment is the authentication.
- Pay per call. Prices are often a fraction of a cent, so an agent only pays for what it uses.
- Instant settlement. Payments are made in stablecoins (mostly USDC) and settle in seconds.
- Machine-readable. The price, network and payment address are in the 402 response, so an agent can decide by itself whether a call is worth it.
How a payment works
- The client calls an endpoint as normal, for example
GET https://api.example.com/weather?city=Amsterdam. - The server answers 402 Payment Required with a description of what it accepts: the amount, the asset (for example USDC), the network (for example Base) and the address to pay.
- The client signs a payment authorization with its wallet and repeats the request with the signed payment attached in a header.
- The server (usually through a facilitator service) verifies the payment, settles it onchain, and returns the actual response, plus a receipt header.
From the agent's point of view this is one extra round trip. Client libraries such as the official x402 fetch and axios wrappers handle steps 2 to 4 automatically.
Key terms
- Resource server: the API that charges for a request.
- Client / buyer: whoever pays. Increasingly an AI agent with its own wallet.
- Facilitator: a service that verifies and settles payments so the API does not need to run blockchain infrastructure. Coinbase's CDP facilitator is the best known; others exist and you can self-host one.
- Scheme: how the payment is made. The common one is
exact, a fixed price per request. - Bazaar: a discovery layer where x402 endpoints can be listed so agents can find them. x402-tools.com indexes it daily.
Where to go next
- Browse the x402 tool directory to see what agents can already buy.
- How AI agents pay with x402: give your agent a wallet and let it use paid tools.
- How to charge for your API with x402: turn any endpoint into a paid one.