Skip to main content
The x402 HTTP flow is the simplest way to interact with Key0. Plan discovery uses GET /discover, and the POST /x402/access endpoint handles challenge and settlement:
  1. DiscoveryGET /discover returns all available plans (HTTP 200). POST /x402/access without planId returns HTTP 400.
  2. ChallengeplanId present, no payment-signature header, creates a PENDING record.
  3. Settlement (subscription)planId + payment-signature, settles on-chain, returns an AccessGrant (JWT).
  4. Settlement (per-request standalone)planId + resource + payment-signature, settles on-chain, proxies to the backend, returns a ResourceResponse (API data, no token).
For a full sequence diagram of the Discovery → Challenge → Settlement flow, see How It Works.

Four Cases

Use GET /discover to browse all available plans. No PENDING record is created — this is a pure pricing query.Note: POST /x402/access without planId returns HTTP 400 with a pointer to this endpoint.

Request

curl https://api.example.com/discover

Response

HTTP/1.1 200 OK
Content-Type: application/json
{
  "agentName": "My Agent",
  "description": "Payment-gated API",
  "plans": [
    {
      "planId": "basic",
      "unitAmount": "$0.10",
      "description": "Basic plan - $0.10 USDC"
    }
  ],
  "routes": []
}
The discovery response contains one entry per plan configured in SellerConfig.plans, plus any route metadata when per-request routes are enabled.
For the complete HTTP headers reference, see API Reference → Overview.

EIP-3009 Authorization

The payment-signature header carries a signed EIP-3009 transferWithAuthorization. This means the client signs an off-chain authorization that permits a specific USDC transfer, but never sends a transaction directly and never pays gas. The server (or a facilitator like Coinbase CDP) executes the transferWithAuthorization call on-chain, paying the gas fees. The USDC moves from the client’s wallet to the seller’s wallet in a single atomic transaction.

Decoded payment-signature Structure

{
  "x402Version": 2,
  "network": "eip155:84532",
  "scheme": "exact",
  "payload": {
    "signature": "0xSignedEIP3009...",
    "authorization": {
      "from": "0xBuyer...",
      "to": "0xSeller...",
      "value": "100000",
      "validAfter": "0",
      "validBefore": "1741180560",
      "nonce": "0xRandomNonce..."
    }
  },
  "accepted": {
    "scheme": "exact",
    "network": "eip155:84532",
    "asset": "0x036CbD53842c5426634e7929541eC2318f3dCF7e",
    "amount": "100000",
    "payTo": "0xSeller...",
    "maxTimeoutSeconds": 900,
    "extra": { "name": "USDC", "version": "2" }
  }
}
Key fields:
  • payload.signature — the EIP-3009 signature authorizing the USDC transfer.
  • payload.authorization — the transfer parameters: sender, recipient, amount (in USDC base units, 6 decimals), validity window, and a random nonce.
  • accepted — echoes the PaymentRequirements from the 402 response, so the server can verify the client accepted the correct terms.

Next Steps

Paying for Access

Step-by-step client guide: discover plans, sign EIP-3009, and use the access token.

A2A Flow

The JSON-RPC based agent-to-agent payment flow for native A2A clients.

Settlement Strategies

Facilitator vs. gas wallet settlement and how EIP-3009 is executed on-chain.

State Machine

The full PENDING / PAID / DELIVERED / EXPIRED / REFUNDED lifecycle.