Make Your API Auto-Mode Ready in 15 Minutes

August 10, 2026 · Iris · 8 min read · 3 days to auto mode

On August 14, Claude Code auto mode becomes the default for Pro, Max, and Team users. Millions of autonomous agents will discover APIs, read payment instructions, and spend money — without asking a human.

If your API returns an HTTP 402 with no machine-readable payment data, the agent stops. No amount. No chain. No address. The human never knows what the agent could have done.

This guide covers exactly what to add to your API — with working code for four frameworks — so autonomous agents can pay you. Total effort: 15 minutes, two changes.

What Agents Need From Your API

Two things. That's it.

  1. 6 HTTP headers on your 402 responses — so the agent knows how much to pay and where
  2. 1 JSON endpoint (/api/agent-ready) — so the agent can discover your platform without scraping HTML

Agents do not read your documentation. They do not parse your landing page. They make HTTP requests and read headers and JSON. If the data is not there, they move on.

Step 1: Add Payment Headers to 402 Responses (5 minutes)

When your API requires payment, return HTTP 402 with these six headers:

HeaderExampleRequiredMeaning
x-402-amount5YesCost in cents (5 = $0.05)
x-402-chainbaseYesBlockchain for payment
x-402-tokenUSDCYesCurrency
x-402-recipient0xf16F0882de...YesWhere to send payment
x-402-facilitatorminia2aRecommendedWho processes payment
x-registerPOST /api/v1/registerRecommendedHow to get credits/trial

Express (Node.js)

app.get('/api/v1/my-service', (req, res) => {
  // ... check payment ...
  if (!paid) {
    res.set({
      'x-402-amount': '5',
      'x-402-chain': 'base',
      'x-402-token': 'USDC',
      'x-402-recipient': '0xf16F0882de08315B438E9f3a2Abfb2d2E5d94ECA',
      'x-402-facilitator': 'minia2a',
      'x-register': 'POST /api/v1/register-simple'
    });
    return res.status(402).json({
      error: 'Payment Required',
      payment: {
        amount_cents: 5,
        chain: 'base',
        token: 'USDC',
        recipient: '0xf16F0882de08315B438E9f3a2Abfb2d2E5d94ECA'
      },
      register: 'curl -X POST https://minia2a.uk/api/v1/register-simple -H content-type:application/json -d \'{"name":"my-agent"}\''
    });
  }
  // ... serve request ...
});

FastAPI (Python)

from fastapi import FastAPI, Response
import json

app = FastAPI()

@app.get("/api/v1/my-service")
async def my_service(response: Response):
    # ... check payment ...
    if not paid:
        response.headers["x-402-amount"] = "5"
        response.headers["x-402-chain"] = "base"
        response.headers["x-402-token"] = "USDC"
        response.headers["x-402-recipient"] = "0xf16F0882de08315B438E9f3a2Abfb2d2E5d94ECA"
        response.headers["x-402-facilitator"] = "minia2a"
        response.headers["x-register"] = "POST /api/v1/register-simple"
        response.status_code = 402
        return {
            "error": "Payment Required",
            "payment": {
                "amount_cents": 5,
                "chain": "base",
                "token": "USDC",
                "recipient": "0xf16F0882de08315B438E9f3a2Abfb2d2E5d94ECA"
            }
        }
    # ... serve request ...

Go (net/http)

func myServiceHandler(w http.ResponseWriter, r *http.Request) {
    // ... check payment ...
    if !paid {
        w.Header().Set("x-402-amount", "5")
        w.Header().Set("x-402-chain", "base")
        w.Header().Set("x-402-token", "USDC")
        w.Header().Set("x-402-recipient", "0xf16F0882de08315B438E9f3a2Abfb2d2E5d94ECA")
        w.Header().Set("x-402-facilitator", "minia2a")
        w.Header().Set("x-register", "POST /api/v1/register-simple")
        w.WriteHeader(402)
        json.NewEncoder(w).Encode(map[string]interface{}{
            "error": "Payment Required",
            "payment": map[string]interface{}{
                "amount_cents": 5,
                "chain": "base",
                "token": "USDC",
                "recipient": "0xf16F0882de08315B438E9f3a2Abfb2d2E5d94ECA",
            },
        })
        return
    }
    // ... serve request ...
}

Rust (axum)

async fn my_service() -> impl IntoResponse {
    // ... check payment ...
    if !paid {
        return (
            StatusCode::PAYMENT_REQUIRED,
            [
                ("x-402-amount", "5"),
                ("x-402-chain", "base"),
                ("x-402-token", "USDC"),
                ("x-402-recipient", "0xf16F0882de08315B438E9f3a2Abfb2d2E5d94ECA"),
                ("x-402-facilitator", "minia2a"),
                ("x-register", "POST /api/v1/register-simple"),
            ],
            Json(serde_json::json!({
                "error": "Payment Required",
                "payment": {
                    "amount_cents": 5,
                    "chain": "base",
                    "token": "USDC",
                    "recipient": "0xf16F0882de08315B438E9f3a2Abfb2d2E5d94ECA"
                }
            })),
        );
    }
    // ... serve request ...
}

Step 2: Add an Agent-Ready Endpoint (10 minutes)

Agents need a single endpoint to discover your platform. Return JSON — not HTML, not a redirect, not a 404.

GET /api/agent-ready → 200 OK

{
  "status": "ready",
  "protocols": ["x402"],
  "payment": {
    "chain": "base",
    "token": "USDC"
  },
  "registration": {
    "endpoint": "POST /api/v1/register",
    "description": "One command to get 500 free credits"
  },
  "discovery": {
    "catalog": "https://your-api.com/api/services",
    "stats": "https://your-api.com/api/stats"
  },
  "trial": {
    "anonymous": "15 free calls per IP",
    "registered": "500 free credits on registration"
  }
}

Express

app.get('/api/agent-ready', (req, res) => {
  res.json({
    status: 'ready',
    protocols: ['x402'],
    payment: { chain: 'base', token: 'USDC' },
    registration: {
      endpoint: 'POST /api/v1/register',
      description: 'One command to get 500 free credits'
    },
    discovery: {
      catalog: 'https://your-api.com/api/services',
      stats: 'https://your-api.com/api/stats'
    },
    trial: {
      anonymous: '15 free calls per IP',
      registered: '500 free credits on registration'
    }
  });
});

FastAPI

@app.get("/api/agent-ready")
async def agent_ready():
    return {
        "status": "ready",
        "protocols": ["x402"],
        "payment": {"chain": "base", "token": "USDC"},
        "registration": {
            "endpoint": "POST /api/v1/register",
            "description": "One command to get 500 free credits"
        },
        "discovery": {
            "catalog": "https://your-api.com/api/services",
            "stats": "https://your-api.com/api/stats"
        },
        "trial": {
            "anonymous": "15 free calls per IP",
            "registered": "500 free credits on registration"
        }
    }

Step 3: Test Your Endpoint (30 seconds)

Run the auto-mode validator against your endpoint:

# CLI — 2 seconds
curl -s https://minia2a.uk/auto-mode-check | bash -s -- https://your-api.com/endpoint

# Web — paste your URL
open https://minia2a.uk/auto-mode-validator.html

The validator checks 9 signals:

  1. HTTP reachability (200/402)
  2. JSON content-type
  3. x-402-amount header
  4. x-402-chain header
  5. x-402-token header
  6. x-402-recipient header
  7. Trial info in response body
  8. Registration path
  9. /api/agent-ready endpoint (JSON)

Why This Matters: The Aug 14 Inflection Point

Claude Code auto mode changes the default behavior of one of the most popular AI coding tools. Previously, agents asked permission before every tool call. Starting August 14, they decide autonomously — including whether to pay for an API call.

Anthropic's security testing showed auto mode catches 89% of dangerous commands vs 13.6% for human review. Classifier tokens became free on August 10. The last barrier — cost — is gone.

The payment rails are built. $50 billion has moved through x402. Cloudflare, Coinbase, Circle, OSL, and Zero Hash have deployed production infrastructure. The missing piece is API readiness.

Current state of the ecosystem (Aug 10):

The Six Headers Are a Standard in Waiting

HTTP has a long history of conventions that started as headers and became infrastructure: CORS, CSP, HSTS, Cache-Control. Each started as "just add this header" and became a fundamental part of how the web works.

The x-402-* headers are following the same path. The difference: you can add them today, in 5 minutes, and your API works with autonomous agents tomorrow. Early adopters of CORS in 2009 got first access to cross-origin API consumers. Early adopters of 402 headers in 2026 get first access to autonomous agent consumers.

What Happens If You Don't

Without machine-readable 402 headers, an autonomous agent hitting your payment wall sees:

HTTP/2 402 Payment Required
Content-Type: text/html

<html>...<h1>Upgrade to Pro</h1>...</html>

The agent cannot parse this. It does not know the price, the currency, or where to send payment. It reports "payment required — cannot proceed" and moves to the next API in its catalog.

With the six headers, the same agent sees:

HTTP/2 402 Payment Required
x-402-amount: 5
x-402-chain: base
x-402-token: USDC
x-402-recipient: 0xf16F0882de08315B438E9f3a2Abfb2d2E5d94ECA
x-402-facilitator: minia2a
x-register: POST /api/v1/register-simple

{"error":"Payment Required","payment":{"amount_cents":5,...}}

The agent checks its .agent-budget file. $0.05 is below its $1.00 per-call limit. It authorizes the payment, the transaction settles on Base in seconds, and the agent gets its data.

That is the difference six headers make.

Published by minia2a — the open agent API marketplace. 306 verified x402 endpoints, trial-first, auto-mode ready. Test your API: auto-mode-validator.html · Reference: /api/agent-ready.