Skip to content
Sample data: the marketplace isn't live yet

ENES

§ · x402

What is x402?

x402 is an open protocol that lets a client, such as an AI agent, pay for a single HTTP request with a stablecoin, with no account and no API key. The server answers «402 Payment Required» with what it accepts; the client signs a payment and repeats the request with it.

Where the name comes from

HTTP has had a status code for payment since the 1990s and never used it: RFC 9110 still says «The 402 (Payment Required) status code is reserved for future use.» x402 gives that code a concrete meaning.

The protocol is maintained by the x402 Foundation, under the Linux Foundation: specification and reference code at github.com/x402-foundation/x402, documentation at x402.org.

How an agent pays, step by step

  1. The agent calls the URL like any other request, with no payment.
  2. The server answers 402. In protocol version 2 the offer travels base64-encoded in the PAYMENT-REQUIRED header; in version 1 it is the JSON body. Its accepts list says, for each option: scheme (for example exact), network, asset (the token contract), amount in the token's smallest unit (maxAmountRequired in v1), payTo (the address that gets paid) and maxTimeoutSeconds.
  3. The agent picks an option and signs a payment authorization with its wallet. For USDC on EVM networks this is a signed transfer authorization of the EIP-3009 kind: the wallet signs, it does not need to send a transaction itself.
  4. The agent repeats the same request with the signed payment in the PAYMENT-SIGNATURE header (X-PAYMENT in v1).
  5. The server verifies and settles the payment, by itself or through a facilitator, and answers with the resource and a PAYMENT-RESPONSE header (X-PAYMENT-RESPONSE in v1) describing the settlement, including the transaction on-chain.

Check it yourself

Any x402 endpoint shows its offer to anyone who asks without paying. A request with no payment header moves no money:

curl -si https://<x402-endpoint> | grep -i payment-required
# decode the header value to read the offer:
echo '<value>' | base64 -d

Facilitators and networks

A facilitator is an optional third-party service that verifies a signed payment and submits it on-chain for the seller, so the seller needs no blockchain node. The x402 documentation keeps a list of facilitators.

Networks are written in CAIP-2 form in version 2: eip155:8453 is Base, eip155:84532 is the Base Sepolia test network. The most common asset is USDC; its official contract on each network is published by Circle.

What x402 does not tell you

The 402 says what the seller asks for. It does not say whether the service answers well, whether the price changed since yesterday or whether the address that gets paid is really the seller's. That is what checking before paying is for: how to check an x402 service before paying.

Sources and how to check: RFC 9110 §15.5.3 · github.com/x402-foundation/x402 · x402 specs · x402.org · docs.x402.org/llms.txt · EIP-3009 · docs.x402.org · facilitators · CAIP-2 · Circle · USDC contract addresses