# What is x402? HTTP 402 payments, explained with a real response | agentic402

> What is x402: an open protocol that lets a server charge per HTTP request by answering 402 with a price, which the client pays in USDC and then retries.

Source: https://agentic402.dev/guides/what-is-x402/

Published 3 December 2026 · Updated 3 December 2026

What is x402: an open protocol that lets a server charge for a single HTTP request. The server answers `402 Payment Required` with a price; the client signs a payment, usually in the USDC stablecoin, and repeats the request with the payment attached; the server checks it and returns the result. No account, no API key and no card are involved.

Ledger's explainer sums up the origin: "x402 is an open payment standard developed by Coinbase and launched in May 2025."

## The idea in one paragraph

HTTP has had a status code for "you need to pay for this" since the early days of the web, and almost nobody used it, because there was no standard way to say what to pay or how. x402 fills that gap. It defines what the 402 response says (amount, asset, network, recipient), how the client sends a payment back, and how the server confirms it. The rest of the request, its method, URL and body, stays exactly as it would be for a free API. Cloudflare's documentation puts it briefly: "Services return a 402 response with payment instructions, and clients pay programmatically without accounts, sessions, or API keys."

That last part is why x402 matters for AI agents. An agent can't fill in a signup form, enter a card, or wait for someone to approve an API key. It can make HTTP requests and, given a wallet, sign a payment. x402 needs nothing more.

## A real 402 response, decoded

Here is what an x402 server actually sends. This is the response agentic402's [URL to Markdown endpoint](https://agentic402.dev/tools/fetch/) returned to an unpaid request on 3 December 2026. The status line and one header carry the whole offer:

```
HTTP/1.1 402 Payment Required
Content-Type: application/json
PAYMENT-REQUIRED: eyJ4NDAyVmVyc2lvbiI6MiwiZXJyb3IiOiJQYXltZW50IHJlcXVpcmVkIi…

{"error":"Payment required"}
```

The `PAYMENT-REQUIRED` header is base64-encoded JSON. Decoded and shortened, it reads:

```
{"x402Version": 2,
 "error": "Payment required",
 "resource": {"url": "https://agentic402.dev/v1/fetch", "description": "Fetch a URL as clean Markdown or JSON. ..."},
 "accepts": [{"scheme": "exact", "network": "eip155:8453", "amount": "5000",
              "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
              "payTo": "0xAF3E683729c949538412e3C0709E952A24d1f2C9",
              "maxTimeoutSeconds": 300, "extra": {"name": "USD Coin", "version": "2"}}],
 "extensions": {"bazaar": { ... input schema and example output ... }}}
```

Each field answers one question the client has:

*Fields in a version 2 x402 payment offer, with the values from the live example*

| Field | Example | Answers |
|---|---|---|
| x402Version | 2 | Which version of the protocol to speak |
| resource | url, description | What is being sold |
| accepts[].scheme | exact | How the amount works: pay exactly this much |
| accepts[].network | eip155:8453 | Which chain, as a CAIP-2 ID (this is Base mainnet) |
| accepts[].amount | 5000 | How much, in the asset's smallest unit (USDC has 6 decimals: $0.005) |
| accepts[].asset | 0x8335…2913 | Which token (the USDC contract on Base) |
| accepts[].payTo | 0xAF3E…f2C9 | Who gets paid |
| accepts[].maxTimeoutSeconds | 300 | How long the client has to complete the payment |
| extensions | bazaar | Optional extras, here discovery metadata for catalogs |

`accepts` is a list because a server can offer several ways to pay, such as different networks or tokens, and let the client pick one it supports. agentic402 offers exactly one.

## The three headers

Version 2 of x402 uses three HTTP headers, one per step of the exchange:

- `PAYMENT-REQUIRED`, on the server's 402: the offer above.
- `PAYMENT-SIGNATURE`, on the client's second request: the signed payment.
- `PAYMENT-RESPONSE`, on the server's final answer: a receipt confirming settlement.

Version 1 used different names, chiefly `X-PAYMENT` for the client's payment, and older explainers still describe that. Network names changed too: version 2 uses CAIP-2 IDs such as `eip155:8453` instead of plain names such as `base`. If a library and a server disagree on version, payments fail, so check which one a client library speaks before you rely on it.

## Who does what: client, server, facilitator

Three parties take part in each payment. The **client** (the agent and its x402 library) holds the wallet and signs. The **server** sells the resource and decides the price. The **facilitator** is a service the server uses to check signatures and put the payment on-chain, so the server doesn't need to run blockchain infrastructure.

Circle's documentation stresses that "x402 is not a payment system itself": it is the negotiation, and the money moves on an existing network in an existing token. For USDC on EVM chains, the common way to sign is described in Circle's docs: "Both Circle facilitators use the `exact` scheme with EIP-3009 `TransferWithAuthorization` signatures." In plain terms, the client signs a message that authorises one transfer of one amount to one address, valid for a short time. It doesn't send a transaction itself. The facilitator submits it, and pays the network fee, so the client needs USDC but no ETH for gas.

agentic402 uses PayAI as its facilitator. PayAI's pricing page listed $0.0015 per EIP-3009 transfer on Base mainnet on 3 December 2026, charged per settlement rather than as a percentage. Fees like that set a floor under sensible prices: a $0.001 call would lose more than its whole price to settlement, which is why [agentic402's prices](https://agentic402.dev/pricing/) start at $0.005.

## One payment, from the agent's side

Seen from the agent, an x402 call is an ordinary request that sometimes takes two round trips. The agent sends its request. If the answer is a 402, its x402 library reads the offer and picks an offer it can pay, such as one on a network it has a signer for. If the payment can't be built, for example because the client has no signer for that network, the library raises an error instead of paying. Limits on amounts are something the developer adds, through the library's hooks or the code around it.

If the checks pass, the library signs the authorization with the wallet's key, which takes milliseconds and costs nothing, and sends the original request again with the `PAYMENT-SIGNATURE` header. The server verifies, does the work and settles. The agent gets back a normal response plus the receipt. In code, all of this hides behind one function call; the developer's job is to give the library a wallet and a sensible limit.

## Why a stablecoin

An x402 offer states an amount in a token. If the token's value swings, so does the real price, and an agent can't budget. A dollar stablecoin such as USDC removes that problem: 5000 units of USDC is half a cent today and half a cent next month, so the amount in the offer is effectively a dollar price. That is why agentic402 charges in USDC and can publish its prices in plain dollars.

## Verify first, settle last

A server has two separate moments to talk to the facilitator. **Verify** checks that the signature is valid and the wallet holds the funds. Nothing moves yet. **Settle** submits the transfer. What the server does between the two is up to it, and it matters a great deal to the client.

agentic402 verifies, runs the tool, and settles only if the tool succeeded. If fetch hits a robots.txt block or a timeout, the response is an error, the payment is never settled, and the signed authorization simply expires unused. That's a choice the server makes, not a guarantee of the protocol. A server could settle first and then fail, and the client would have paid for nothing. An x402 client can't tell in advance which kind of server it's talking to. [Our payments page](https://agentic402.dev/docs/payments/) lists exactly what is and isn't charged.

## What x402 costs to use

The protocol itself costs nothing. In Ledger's words, "the x402 protocol itself is free to use." The costs sit around it. The server's price is whatever it sets. The facilitator charges the server per settlement, as above. Ledger adds that users pay only nominal blockchain network fees. With the `exact` scheme the facilitator submits the transfer and pays that gas, so the client pays just the price in the offer.

The practical effect is that at $0.0015 a payment, the fee is 30% of a $0.005 price and more than the whole of a $0.001 price, so the smaller the price, the more of it goes to settlement. Circle, for example, describes its nanopayments product as infrastructure "to make sub-cent payments economically viable", which is a sign of how much the per-payment cost matters at that end. agentic402 sticks to the `exact` scheme and prices of $0.005 and up.

## What x402 doesn't do

x402 doesn't refund. The flow described above has no dispute or chargeback step: once a payment is settled on-chain, the protocol gives no way to reverse it. A good server avoids the need by settling only on success, but that's the server's design, not the protocol's.

It doesn't limit spending either. An analysis of x402 against API keys puts it well: "Price limits, recipient checks, budgets, and transaction policies are implementation controls, not an automatic consequence of using x402." The simplest control is a wallet holding only what the agent may spend. Client libraries can add hooks that approve or refuse each payment.

And it doesn't identify anyone beyond a wallet address. That is the point for agents, which have no other identity, but it also means a server can't send an invoice, look up a customer or offer a monthly plan through x402 alone. [How AI agents pay for APIs](https://agentic402.dev/guides/how-ai-agents-pay-for-apis/) compares x402 with keys, credits and capped tokens on exactly these points.

## How agents find x402 services

A 402 response doubles as a price list: any client can send an unpaid request and read the price before deciding. agentic402 answers an empty-body request with the 402 even when the body would otherwise be required, so catalogs and agents can check prices without guessing valid input.

The optional `bazaar` extension in the offer carries a service name, tags, an input schema and an example output. Facilitators that keep catalogs can index a service from that metadata when payments pass through. Sites can also publish an OpenAPI file with prices, a `/.well-known/x402` list of paid resources and an [llms.txt file](https://agentic402.dev/guides/llms-txt/) describing the service in plain text.

## x402 beyond plain HTTP

The same handshake works over the Model Context Protocol, which many agents use to call tools. With the `@x402/mcp` package, a paid tool that's called without payment returns the offer as a tool error; the client signs and calls again with the payment in the request's `_meta` field. agentic402's [MCP server](https://agentic402.dev/docs/mcp/) works this way, with the same prices as its HTTP API. Input is checked before payment there too, and a tool that fails isn't settled.

## Three common misreadings

**"amount": "5000" means five thousand dollars.** It doesn't. Amounts are in the token's smallest unit. USDC has 6 decimals, so 5000 is 0.005 USDC. Libraries handle this, but people reading raw offers get it wrong.

**A 402 is an error to retry.** It's an offer. Retrying the same request without a payment returns the same 402. Treat it as a question: do you want to pay this?

**The signature is the payment.** Not until settlement. A signed authorization that the server never settles moves no money and expires after its time limit. That's what lets a careful server leave failed calls unpaid.

## Trying x402 yourself

You can see a real 402 without paying anything: send `curl -si -X POST https://agentic402.dev/v1/fetch` and decode the `PAYMENT-REQUIRED` header with base64. A free endpoint such as `GET https://agentic402.dev/v1/attest/key` answers straight away with no payment at all: x402 only steps in where there is a price. To make a paid call, you need a wallet with a little USDC on Base and an x402 client; [the quickstart](https://agentic402.dev/docs/quickstart/) goes from zero to a paid call in four steps, for half a cent.

## Questions about x402

**Is x402 a cryptocurrency?**
No. x402 is a protocol, a set of rules for HTTP requests and responses. Payments under it are made in existing tokens; USDC, a dollar stablecoin, is the common choice.

**Who created x402?**
Coinbase. Ledger's explainer describes it as "an open payment standard developed by Coinbase and launched in May 2025." The protocol is open, so anyone can write a client, a server or a facilitator for it.

**Does x402 only work on Base?**
No. The `network` field can name other chains, and servers can accept several. agentic402 accepts USDC on Base mainnet only.

**Do I need an account with the facilitator to pay?**
As a client, no. The facilitator works for the server. The client only needs a wallet and an x402 library.

**What's the difference between x402 and an API key?**
An API key identifies an account that is billed later. An x402 payment pays for the request itself, now. [API keys vs x402](https://agentic402.dev/compare/api-keys-vs-x402/) compares them in detail.

Cite this page: agentic402, "What is x402? HTTP 402 payments, explained with a real response", https://agentic402.dev/guides/what-is-x402/, published 3 December 2026. The 402 example was captured from agentic402.dev that day. Third-party quotes are from Ledger, Cloudflare, Circle, PayAI and Position Is Everything as read that day.

## Related

- [x402 payment on agentic402: what is charged](https://agentic402.dev/docs/payments/)
- [x402 quickstart: your first paid call](https://agentic402.dev/docs/quickstart/)
- [How AI agents pay for APIs](https://agentic402.dev/guides/how-ai-agents-pay-for-apis/)
- [API keys vs x402](https://agentic402.dev/compare/api-keys-vs-x402/)
- [x402 tools for AI agents](https://agentic402.dev/)
