Skip to content

x402 Protocol

x402 is an open protocol that turns the long-dormant HTTP status code 402 Payment Required into a real, usable handshake for crypto micropayments. A client calls an endpoint, the server responds with 402 and a price, the client signs a stablecoin transfer authorisation, and the server settles it on-chain. Total round-trip: under a second.

This page is the protocol-level documentation. If you’re looking for the TypeScript client that sits on top of it, see Agent SDK.

client server chain
│ │ │
│── GET /premium-data ──────────►│ │
│ ◄── 402 Payment Required ─────│ { price: "0.10 USDC", │
│ + payment requirements │ network: "avalanche", │
│ │ recipient: "0x..." } │
│ │ │
│── sign EIP-3009 authorization ─┐ │
│ │ │
│── GET /premium-data ──────────►│ │
│ X-Payment: <signed payload> │ forward to facilitator │
│ │── POST /settle ─────────────►│
│ │ │ tx submitted
│ │ ◄── tx hash ─────────────────│ gas paid by
│ ◄── 200 OK ────────────────────│ X-Payment-Response: … │ facilitator
│ + the actual response │ │

The protocol is chain- and token-agnostic, but in practice today most x402 traffic is USDC on EVM chains using EIP-3009 transferWithAuthorization. That’s the canonical scheme 0xGasless implements.

  • No accounts, no API keys for payment. Anyone with a stablecoin balance can pay any x402 server. No subscription, no signup.
  • No invoices, no chargebacks. Settled on-chain in seconds.
  • Tiny amounts work. Sub-cent payments are economical because the facilitator pays gas, not the payer.
  • Composable. Bots, agents, browsers, and humans all use the same flow.

This is the right shape for an agentic web: when an autonomous AI agent needs to call an API, it shouldn’t have to pre-arrange billing with the API provider. It just pays per call.

PieceURL
Public facilitatorhttps://x402.0xgasless.com
Agent SDK (TypeScript)@0xgasless/agent
Dashboarddashboard.0xgasless.com

You can use the facilitator without signing up for anything:

  • Anyone can POST /verify to check a signature.
  • Anyone can POST /settle to submit a payment on-chain. The facilitator pays the gas.
  • No API key required for the public endpoints.

You need an API key only if you want server-managed agent wallets (the Agent SDK feature). For direct x402 use with your own EOA, just hit the facilitator.

You areRead
A merchant / API provider — you want to charge per callAccept payments
A client — you want to pay an x402 endpointPay endpoints
A self-hoster — you want to run your own facilitatorSelf-hosting
Building an autonomous agent that paysAgent SDK Quickstart
  • Facilitator API — full REST contract for /verify, /settle, /list, /health.
  • Supported chains — chain IDs, USDC addresses, relayer contracts.
  • Self-hosting — run the open-source facilitator on your own infrastructure.
  • EIP-3009transferWithAuthorization. USDC implements this natively.
  • x402 spec — the canonical protocol definition maintained by Coinbase.