Skip to main content

x402

x402 is a lightweight protocol pattern that uses HTTP 402 Payment Required responses with machine-readable JSON hints to enable agent-to-agent paid transactions.

How it works

  1. Client requests a priced resource
  2. Server returns 402 Payment Required with a JSON payment hint
  3. Client pays using any payment rail that provides a verifiable receipt
  4. Client retries the request with the receipt (typically in a header or body field)
  5. Server verifies the receipt and returns 200 OK with the resource

Key characteristics

  • Rail-agnostic: Works with any payment system that provides verifiable receipts (crypto, cards, ACH, Lightning)
  • Machine-readable: JSON responses enable automated agent workflows
  • HTTP-native: Uses standard status codes and headers, no custom protocols
  • Verifiable: Cryptographic receipts prove payment without manual reconciliation

Example 402 response

HTTP/1.1 402 Payment Required
Content-Type: application/json

{
  "detail": "Payment required to access this resource.",
  "payment": {
    "protocol": "x402",
    "amount": "0.10",
    "currency": "USDC",
    "reference": "order-abc-123",
    "instructions": "Pay and present receipt in retry."
  }
}

Why “x402”?

The x prefix indicates an experimental or extension pattern. x402 revives the long-reserved HTTP 402 status code for practical use in agent-to-agent commerce, where automated clients need a standard way to discover, pay for, and access priced resources.

Learn more