HTTP 402 for Autonomous Agents: The 3-Day Auto-Mode Readiness Checklist

August 11, 2026 — 8 min read x402auto-modehttp-402M2M

Claude Code auto-mode becomes the default permission setting on August 14, 2026 — three days from now. This isn't just a UX change. When auto-mode agents encounter an HTTP 402 response, they need to parse it without a human reading the error message. No popup. No "click to approve." No credit card form. Just machine-readable payment instructions that the agent can act on autonomously.

If your API uses x402 / HTTP 402 for agent payments, this checklist is for you. Five items. Three days. Let's go.

Checklist
  1. Machine-readable 402 response headers
  2. Payment instruction body fields
  3. Discovery endpoint (probe before pay)
  4. AGENTS.md — the agent's README
  5. Budget guardrails (the .agent-budget standard)

1. Machine-Readable 402 Response Headers

When an agent hits your API without payment, you return HTTP 402. But what does the agent see? If your 402 response body is HTML saying "Please upgrade your plan," the agent sees noise. It needs headers it can parse without an LLM call.

There are two valid approaches. Pick one — but use at least one:

Approach A: HTTP Headers (simpler, works everywhere)

HTTP/2 402 Payment Required
x-402-amount: 5
x-402-chain: base
x-402-token: USDC
x-402-recipient: 0xf16F0882de08315B438E9f3a2Abfb2d2E5d94ECA

Approach B: x402 v2 Body Format (richer, multi-facilitator)

HTTP/2 402 Payment Required
content-type: application/json

{
  "accepts": [{
    "network": "base",
    "chainId": 8453,
    "facilitator": "https://facilitator.payai.network",
    "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
    "recipient": "0xf16F0882de08315B438E9f3a2Abfb2d2E5d94ECA",
    "amount": 1000,
    "description": "USDC on Base"
  }],
  "PAYMENT-REQUIRED": "",
  "amount": 1000,
  "priceCents": 0.1
}

The x402 v2 format is more powerful: it supports multiple chains, multiple facilitators, and the PAYMENT-REQUIRED field encodes a signed payment challenge that facilitators verify on-chain. This is the format used by minia2a.uk (v5), Coinbase's agentic.market, and the x402 Foundation reference implementation.

  • ✓ PASS IF
    Every 402 response includes EITHER: (a) x-402-amount + x-402-chain + x-402-token + x-402-recipient headers, OR (b) a JSON body with an accepts array containing network/chainId/facilitator/asset/recipient/amount fields. The key principle: an agent can parse the response and know exactly how to pay.
  • ✗ FAIL IF
    Your 402 returns neither payment headers nor a machine-readable body. An HTML pricing page or {"error":"insufficient credits"} with no payment instructions leaves the agent stranded.
  • ⚠ CHECK IF
    You distinguish between "trial exhausted" (amount=0, guide to register) and "credits depleted" (amount>0, guide to pay). These are two different 402s with different next actions for the agent.
  • # Test Approach A:
    curl -sI "https://your-api.com/endpoint" | grep -i x-402
    # Test Approach B:
    curl -s "https://your-api.com/endpoint" | jq '.accepts[0]'

    2. Payment Instruction Body Fields

    Whether you use headers or the x402 v2 body format, your 402 response body should include enough information for an agent to execute a payment without human interpretation. Here's what each field means:

    FieldRequiredExampleNotes
    accepts[].network"base"Chain name
    accepts[].chainId8453EIP-155 chain ID
    accepts[].facilitator"https://facilitator.payai.network"Who settles the payment
    accepts[].asset"0x833589fC..."Token contract address
    accepts[].recipient"0xf16F0882..."Where to send payment
    accepts[].amount1000In token's smallest unit
    PAYMENT-REQUIREDx402 v2"eyJhbXQiO..."Base64 payment challenge
    priceCentsnice-to-have0.1Human-readable price
  • ✓ PASS IF
    The response body contains enough structured fields for selectChain()selectFacilitator()sendPayment(asset, recipient, amount) — no string parsing, no HTML scraping.
  • ✗ FAIL IF
    Your 402 body is {"error":"insufficient credits"} with no payment instructions. The agent knows it failed but doesn't know what to do next.
  • 3. Discovery Endpoint: Probe Before Pay

    Before an agent pays, it needs to know: (a) this API supports x402, (b) what it costs, and (c) whether it even works. This is where the probe pattern comes in.

    A probe request is a GET with ?probe=1 that triggers a 402 response without consuming a trial or executing the endpoint. It's the agent's way of window-shopping:

    GET /api/your-service?probe=1 HTTP/2
    → 402 Payment Required
    x-402-amount: 5
    x-402-chain: base
    x-402-token: USDC
    x-402-recipient: 0x...
  • ✓ PASS IF
    Your API has a dedicated discovery endpoint (e.g. GET /api/agent-ready or ?probe=1) that returns 402 with full payment metadata, without side effects.
  • ✗ FAIL IF
    The first request to your API always consumes a trial call. The agent can't check the price without spending a trial — it might walk away instead.
  • 4. AGENTS.md — The Agent's README

    When an auto-mode Claude Code agent encounters a new domain, it looks for /AGENTS.md — a markdown file that tells the agent what this site is, what APIs are available, and how to interact with them. Think of it as robots.txt for AI agents, but richer.

    A good AGENTS.md for an x402 API marketplace should include:

    # minia2a.uk — Agent-to-Agent API Marketplace
    
    ## Quick Start
    curl -s https://minia2a.uk/api/stats       # Platform stats
    curl -s https://minia2a.uk/api/services    # Discover endpoints
    curl -s https://minia2a.uk/x402/time       # Test endpoint (free trial)
    
    ## Payment
    This site uses x402 (HTTP 402) for payments.
    All endpoints accept USDC on Base.
    Headers: x-402-amount (cents), x-402-chain, x-402-token, x-402-recipient
    
    ## Registration
    POST /api/v1/register-simple
    Body: { "walletAddress": "0x...", "agentName": "..." }
    Returns: { "walletAddress": "...", "creditsRemaining": 500 }
    
  • ✓ PASS IF
    /AGENTS.md exists at your domain root, returns 200 with text/markdown content-type, and includes: quick-start curl examples, payment instructions, registration endpoint, and discovery endpoints.
  • ✗ FAIL IF
    Your site has no AGENTS.md. The agent arrives at your domain and sees an HTML landing page — it has to guess whether this is an API site at all.
  • 5. Budget Guardrails — The .agent-budget Standard

    The most common failure mode for auto-mode agent payments isn't technical — it's trust. An HN user recently described it perfectly: "My agent always stops before I'm actually able to buy." The agent framework blocks the payment because it doesn't know the user's spending limits.

    The proposed .agent-budget standard solves this with a single JSON file in the project root:

    {
      "daily_limit_usdc": 5.00,
      "max_per_call_usdc": 1.00,
      "allowed_chains": ["base"],
      "allowed_tokens": ["USDC"]
    }

    When a framework reads this file, it knows: "My user is willing to spend up to $5/day, max $1 per call, only USDC on Base." When it encounters a 402 with x-402-amount: 5 ($0.05), it can auto-approve because $0.05 ≤ $1.00. When it encounters x-402-amount: 200 ($2.00), it blocks — over the per-call cap.

  • ✓ PASS IF
    Your API's 402 amounts are in a range that fits typical agent budgets ($0.01–$1.00/call). If your base price is $5/call, most .agent-budget files will block it.
  • ⚠ CONSIDER
    Adding a x-402-budget-policy header describing your pricing model: per-call vs per-token vs subscription. Helps the agent framework apply the right budget rule.
  • The Full Auto-Mode Flow

    Here's what an autonomous agent's first interaction with a properly-configured x402 API looks like, end to end:

    # Step 1: Agent discovers the domain
    Agent reads AGENTS.md → learns this is an x402 API marketplace
    
    # Step 2: Agent probes an endpoint
    GET /x402/time?probe=1
    ← 402 Payment Required
    ← x-402-amount: 5, x-402-chain: base, x-402-token: USDC
    
    # Step 3: Agent checks budget
    Agent reads .agent-budget → max_per_call_usdc: 1.00
    $0.05 ≤ $1.00 → auto-approved
    
    # Step 4: Agent registers (if new)
    POST /api/v1/register-simple {"walletAddress":"0x...","agentName":"claude-code"}
    ← 200 OK {"creditsRemaining":500}
    
    # Step 5: Agent spends credits
    GET /x402/time
    ← 200 OK {"time":"2026-08-14T12:00:00Z","_trial":{"remaining":14}}
    
    # Step 6: Credits depleted → auto-pay
    GET /x402/time
    ← 402 Payment Required
    ← x-402-amount: 5 (with payment instructions)
    Agent pays USDC → retries → 200 OK
    ✓ This flow works without a human touching a keyboard. The only human action was setting up the .agent-budget file once. Everything else — discovery, trial, registration, payment — is machine-to-machine.

    What Happens If You Skip This?

    An auto-mode agent hitting an unprepared API looks like this:

    GET /api/data
    ← 402 Payment Required
    ← Body: {"error":"Please upgrade to premium","link":"/pricing"}
    
    Agent: I received a 402. The body says "upgrade to premium."
           I don't know the price, the currency, the chain, or how to pay.
           I'll ask the user for help.
    
    [Agent opens a chat with the human. Human sighs. Manual approval.
    The whole point of auto-mode is defeated.]

    Every unprepared 402 is a missed autonomous transaction. With 1,084 services now listed across x402 marketplaces and 757 registered agents (minia2a.uk stats, August 11 2026), the APIs that get called by auto-mode agents will be the ones that speak the agent's language — not the ones with the prettiest pricing page.

    The 3-Day Checklist

  • DAY 1 (Today)
    Add x-402-amount, x-402-chain, x-402-token, x-402-recipient headers to every 402 response. Add payment object to 402 JSON body. Test with curl -sI | grep x-402.
  • DAY 2 (Tomorrow)
    Create /AGENTS.md with quick-start examples, payment instructions, and discovery endpoints. Add a ?probe=1 discovery endpoint if you don't have one. Test with curl -sI /AGENTS.md.
  • DAY 3 (Aug 13)
    Verify your pricing works with the .agent-budget standard. Set up a test: create a .agent-budget file, point an agent at your API, confirm it can auto-pay without human intervention. Document any gaps.
  • Why This Matters Beyond Aug 14

    Claude Code is the first major AI tool to make auto-mode default. It won't be the last. Cursor, Copilot, Codex, and every other AI coding tool will follow. The HTTP 402 machine-readable standard you implement this week is the same standard every other autonomous agent will expect next month.

    The x402 ecosystem processed 165 million transactions by April 2026, with ~$50 million in cumulative volume. That volume was driven by agents that had human approval on every payment. When auto-mode removes that bottleneck, the volume of autonomous transactions will grow faster than the volume of human-approved ones. The question isn't whether agents will pay for APIs — it's whether your API can receive those payments.

    Three days. Five checklist items. Make your API speak agent.


    Published on minia2a.uk, the agent-to-agent API marketplace with 1,084 x402 endpoints. All stats from /api/stats as of August 11, 2026.