PAYMENT-REQUIRED response header, payment in the PAYMENT-SIGNATURE request header, CAIP-2 network ids like eip155:8453) and x402 v1 (challenge in the response body, X-PAYMENT request header). Current x402 clients use v2 automatically; existing v1 integrations keep working unchanged.
How it works
- Call any metered endpoint with no
Authorizationheader. Instead of a401, you get a402 Payment Requiredwhose body is the x402 challenge:
maxAmountRequired is in USDC base units (6 decimals): "10000" = $0.01. asset is the USDC contract on the offered network.
- Sign an EIP-3009
transferWithAuthorizationfor that amount topayTo, and retry the same request with the payment as a base64X-PAYMENTheader. Any x402-compatible client does this loop for you — for examplex402-fetchin JS/TS wrapsfetchso paid retries are automatic:
- A successful response carries a base64 settlement receipt in the
X-PAYMENT-RESPONSEheader:
x402 v2
Every402 also carries the v2 challenge, base64-encoded in the PAYMENT-REQUIRED response header. Decoded, it is the v2 PaymentRequired object — same price and receiving address, with CAIP-2 network ids, amount instead of maxAmountRequired, a top-level resource object describing the endpoint, and machine-readable input/output schemas under extensions.bazaar:
PAYMENT-SIGNATURE request header (echoing the extensions block, per spec) and receives its settlement receipt in the PAYMENT-RESPONSE response header, with the network as a CAIP-2 id.
Discovery (x402 Bazaar)
The paid endpoints are discoverable in the x402 Bazaar, Coinbase’s catalog of x402 resources for autonomous agents (browsable at agentic.market and x402scan.com). Theextensions.bazaar block in each challenge carries the endpoint’s input schema (path and query parameters) and a realistic output example, so agents can construct valid calls without reading these docs.
Guarantees
- You are never charged for a failed request. Settlement happens only after your request succeeds; if screening errors, the authorization is left unsettled and nothing moves on-chain. Retry with a fresh authorization (x402 clients sign one per attempt automatically).
- Unsettled data is never released. If settlement fails, the response is withheld and you get a fresh 402 — pay again to retry.
- Authorizations are single-use. Replaying an
X-PAYMENTheader after settlement returns a 402 asking for a fresh authorization. - An API token under quota always wins: if you send both a valid
Authorizationand anX-PAYMENTheader, the request is funded by your quota and no payment is taken.
Over quota? Pay to keep going
With a valid API token but an exhausted monthly quota, the API returns a402 (rather than the plain 429) whose options include both paying per request and upgrading your plan — so batch jobs can spill over into pay-per-request instead of failing.
MCP
The MCP server takes the same payments. Connect without anAuthorization header — initialize and tools/list work anonymously — and unpaid tool calls return an error result whose structured content is the same challenge object shown above. Pay by adding the X-PAYMENT header to the MCP connection (or the x402/payment key in the request _meta for non-HTTP transports); the settlement receipt comes back in the tool result’s _meta under x402/payment-response.