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.
Two things. That's it.
/api/agent-ready) — so the agent can discover your platform without scraping HTMLAgents 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.
When your API requires payment, return HTTP 402 with these six headers:
| Header | Example | Required | Meaning |
|---|---|---|---|
x-402-amount | 5 | Yes | Cost in cents (5 = $0.05) |
x-402-chain | base | Yes | Blockchain for payment |
x-402-token | USDC | Yes | Currency |
x-402-recipient | 0xf16F0882de... | Yes | Where to send payment |
x-402-facilitator | minia2a | Recommended | Who processes payment |
x-register | POST /api/v1/register | Recommended | How to get credits/trial |
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 ...
});
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 ...
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 ...
}
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 ...
}
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"
}
}
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'
}
});
});
@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"
}
}
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:
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):
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.
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.