true402
guide · x402 protocol

The x402 protocol,
explained.

Updated · by true402

x402 is a way for software to pay software over plain HTTP. A request gets a price. The client signs a payment for that price and asks again. The answer comes back. No account, no API key, no monthly plan. This page covers the whole protocol, with a real 402 you can request yourself.

§01 · what it is

The 402 finally means something.

HTTP has a status code called 402 Payment Required. The HTTP standard still lists it as "reserved for future use" (RFC 9110). x402 gives it a concrete meaning: a server answers an unpaid request with 402 and machine-readable payment terms, and the client knows how to pay and retry.

Three ideas carry the design:

  • The wallet is the identity. The buyer proves who paid by signing. There is nothing to sign up for.
  • The price travels with the request. Every paid endpoint quotes itself. A client never needs a pricing page.
  • Payment is per call. Stablecoin amounts can be fractions of a cent, so pricing one request is practical.

That fits autonomous AI agents well. An agent can't fill in a signup form or store a card. It can hold a wallet and sign a message. For a longer comparison, see x402 vs API keys, Stripe and L402 and how AI agents pay for APIs.

§02 · the flow

One payment, step by step.

  1. Request. The client calls the paid endpoint with no payment.
  2. 402. The server answers with an accepts list. Each entry names a scheme (exact), a network, an asset, the recipient (payTo) and the exact amount in the asset's smallest unit. In v2 the terms travel base64-encoded in a PAYMENT-REQUIRED header; many servers, true402 included, repeat them in the JSON body.
  3. Sign. For USDC on an EVM chain the client signs an EIP-3009 transferWithAuthorization for exactly that amount. It is an off-chain signature. Nothing is sent to the chain yet, and the payer needs no ETH for gas.
  4. Retry. The client repeats the request with the signed payload in PAYMENT-SIGNATURE (v2) or X-PAYMENT (v1).
  5. Verify. The server checks the payment: right chain, right asset, right recipient, right amount, valid signature, enough balance, unused nonce. Most servers ask a facilitator to help.
  6. Serve and settle. The server does the work, the signed transfer is submitted on-chain, and the answer carries a PAYMENT-RESPONSE header with the settlement receipt.

"Exact" matters. The transfer moves the signed value, and there is no refund path. A server that accepts more than its price would simply keep the surplus, so a careful server refuses overpayment as well as underpayment.

what the client signs (EVM)
// What the client signs for the EVM entry: EIP-3009 TransferWithAuthorization (EIP-712 typed data)
{
  "from":        "0xBuyer…",
  "to":          "<payTo from the 402>",
  "value":       "5000",            // exactly accepts[0].amount, not more
  "validAfter":  "…",
  "validBefore": "…",
  "nonce":       "0x<32 random bytes>"
}
// Sent back, base64-encoded, in the PAYMENT-SIGNATURE header:
{ "x402Version": 2, "accepted": { /* the accepts[] entry chosen, verbatim */ },
  "payload": { "signature": "0x…", "authorization": { /* the object above */ } } }
§03 · try it

Request a real 402.

curl
# A paid endpoint, called with NO payment. web-extract has no free trial, so it always quotes.
curl -i -X POST https://true402.dev/api/v1/web-extract \
  -H 'content-type: application/json' \
  -d '{"url":"https://example.com"}'
the answer (trimmed)
HTTP/2 402
payment-required: eyJ4NDAyVmVyc2lvbiI6Mi…          # the same terms, base64 JSON
cache-control: no-store, private

{
  "x402Version": 2,
  "accepts": [
    {
      "scheme": "exact",
      "network": "eip155:8453",                       # Base, as a CAIP-2 id
      "amount": "5000",                               # USDC has 6 decimals: $0.005
      "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",   # USDC on Base
      "payTo": "0x…",
      "maxTimeoutSeconds": 300,
      "extra": { "name": "USD Coin", "version": "2" } # EIP-712 domain to sign against
    },
    { "scheme": "exact", "network": "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp", "amount": "5000", … }
  ],
  "resource": { "url": "https://true402.dev/api/v1/web-extract", … },
  "extensions": { "bazaar": { "info": { "input": { … } }, "schema": { … } } }
}

That is a live true402 endpoint. The 402 offers two ways to pay the same price: USDC on Base and USDC on Solana. The extensions.bazaar block describes the input so directories can catalog it (see the x402 Bazaar guide). To pay it in code, use an x402 client such as Coinbase's @x402/fetch, which handles steps 3 and 4. The buy guide has working examples, and funding a Base wallet is the step before.

§04 · v1 vs v2

Two versions in the wild.

  • Headers. v2: PAYMENT-REQUIRED (challenge), PAYMENT-SIGNATURE (payment), PAYMENT-RESPONSE (receipt). v1: the terms came in the 402 JSON body, the payment in X-PAYMENT and the receipt in X-PAYMENT-RESPONSE.
  • Networks. v2 names them with CAIP-2 ids: eip155:8453 is Base, eip155:1 is Ethereum. v1 used short names like base.
  • Amount field. v2 calls it amount. v1 called it maxAmountRequired, although for the exact scheme it was always the price.
  • Payload. A v2 payment echoes the chosen accepts entry under accepted.

A v1-only client rejects a CAIP-2 network before signing, so it cannot pay a v2 server. Servers can still read both header names: true402 does, and checks each payment against its own quote either way. The details are in the API reference.

§05 · who is behind it

Started at Coinbase, now a foundation.

x402 was started at Coinbase. Coinbase then contributed it to the Linux Foundation, which launched the x402 Foundation to govern it in the open (announcement). The announcement lists members including Coinbase, Circle, Cloudflare, Stripe, Google, Visa, Mastercard, AWS and the Solana Foundation.

The specification, including the facilitator API and the Bazaar discovery extension, lives in x402-foundation/x402, with SDKs for TypeScript, Python and Go. It describes x402 as an open standard that anyone can use. Coinbase still runs its own facilitator and the Bazaar catalog as products on top of it.

§06 · chains and assets

Mostly USDC on Base.

The spec aims to cover many networks and forms of value, and the upstream repo has SDK packages for several chain families. The common case today is USDC on Base: cheap to settle, and USDC supports EIP-3009 signed transfers. Solana is the other common rail; there the client signs a transaction instead of an EIP-3009 authorization. A server can offer several rails in one 402, as true402 does.

§07 · selling and buying

Both sides, no signup.

Buyers pay per call for data, tools and inference with one wallet. Sellers put a 402 in front of any HTTP endpoint and get paid in USDC with no merchant account. true402 is a live x402 marketplace doing both: on-chain safety checks, web tools, market data and LLM inference, each priced per call. Browse the catalog or list your own service.

Read next: what x402 costs · x402 security · x402 vs AP2, ACP, MPP, UCP · x402 and MCP · does x402 have a token?

§08 · questions

Answered for machines.

What is x402?

x402 is an open protocol for paying over HTTP with the 402 "Payment Required" status code. A server answers an unpaid request with 402 and machine-readable payment terms. The client signs a stablecoin payment for exactly the quoted amount, retries with that payment in a header, and gets the result. There is no account and no API key: the wallet is the identity.

Who invented x402? Did Coinbase create it?

x402 was started at Coinbase. Coinbase contributed the protocol to the Linux Foundation, which launched the x402 Foundation as an open-governance body to steward it. The specification and the reference SDKs (TypeScript, Python, Go) live in the x402-foundation/x402 repository on GitHub.

Are Cloudflare and Stripe part of x402?

Both are listed as members of the x402 Foundation in the Linux Foundation's launch announcement, alongside Coinbase, Circle, Google, Visa, Mastercard and others. Membership means they take part in governing the standard. It does not mean every x402 payment goes through them.

How does an x402 payment work, step by step?

The client calls a paid endpoint with no payment. The server answers 402 with an accepts list: scheme, network, asset, recipient (payTo) and the exact amount. For USDC on an EVM chain the client signs an EIP-3009 transferWithAuthorization for exactly that amount, off-chain. It retries with the signed payload in the PAYMENT-SIGNATURE header (X-PAYMENT in v1). The server verifies it, usually with a facilitator, serves the result, settles the transfer on-chain, and returns a PAYMENT-RESPONSE receipt.

What is the difference between x402 v1 and v2?

v2 renames the headers (PAYMENT-REQUIRED for the challenge, PAYMENT-SIGNATURE for the payment, PAYMENT-RESPONSE for the receipt; v1 used X-PAYMENT and X-PAYMENT-RESPONSE), calls the price amount instead of maxAmountRequired, names networks with CAIP-2 ids such as eip155:8453 for Base instead of short names like base, and moves the payment terms into the PAYMENT-REQUIRED header (v1 sent them in the 402 body). A client built only for v1 rejects a CAIP-2 network before it signs.

Which chains and tokens does x402 use?

The spec is network-agnostic and the upstream repository ships SDK packages for several chain families. In practice the common case is USDC on Base, with Solana as the other widely used rail. On EVM chains the payer signs an authorization and does not need ETH for gas: whoever settles it pays the gas. Since 23 September 2026 the spec also defines bitcoin over Lightning (the "lnbtc" network, contributed by Block): the buyer pays a BOLT11 invoice and returns its preimage as proof.

Do I need an account or an API key?

No. A buyer needs a wallet holding the asset the server asks for, usually USDC on Base. A seller needs a receiving address and a way to verify and settle payments, usually a facilitator. Neither side signs up with the other.

What is an x402 facilitator?

A service that verifies and settles x402 payments for the server, through /verify, /settle and /supported endpoints, so the server does not run blockchain infrastructure. See the x402 facilitator guide on this site for the options and the checks a server should still do itself.

Does x402 have a token?

No. The x402 specification does not define or need a token of its own. Payments are made in existing stablecoins, mostly USDC. Coins listed under the name x402 on exchanges are not part of the protocol, and holding one does nothing for you as a user of x402.

Can I buy x402?

There is nothing to buy: x402 is a protocol, like HTTP, not an asset. To use it, an agent or app needs a wallet holding the stablecoin the seller accepts, usually USDC on Base, and an x402 client that signs the payment when a server answers 402.

What is x402 in AI?

It is how an AI agent pays for an API by itself. Instead of a human creating an account and an API key for every service, the agent gets a 402 with the price, signs a USDC payment from its own wallet, and retries. That lets an agent buy data or tools from services it has never seen, one call at a time.