HTTP's 402 Error Sat Dead for 29 Years — It Just Became a Cash Register for AI Agents
Author(s): Chew Loong Nian – AI ENGINEER
Originally published on Towards AI.
HTTP's 402 Error Sat Dead for 29 Years — It Just Became a Cash Register for AI Agents
There's a status code in the HTTP spec that has been reserved since 1997 and almost never used: 402 Payment Required. For 29 years it sat there as a placeholder, a joke among backend developers, the "we'll figure out internet money later" IOU of HTTP/1.1.
After the introduction, the article explains why x402 is arriving now: AI agents generate traffic that breaks the old ad/subscription/click-through monetization model, and blocking alone protects costs without earning revenue. x402 fixes this by turning HTTP into a payment flow where servers can respond with 402 plus a machine-readable price, then accept a signed payment proof in a follow-up request for edge verification and settlement (typically USDC stablecoins). It details the protocol handshake and how AWS CloudFront/WAF and Cloudflare’s Monetization Gateway implemented it at the edge with minimal overhead and optional outcome-based pricing, then shows how to wire x402 into an API and an agent using open-source SDKs. The piece also compares x402 to other “agents + money” standards (ACP/AP2) and addresses skeptics’ concerns—bot impersonation, accounting/tax invoicing, and attempts to route around paid access—before concluding who should adopt it (API/dataset/MCP sellers, Cloudflare users via the waitlist, and agent builders) and how to get started quickly with a testnet demo.
Read the full blog for free on Medium.
Join thousands of data leaders on the AI newsletter. Join over 80,000 subscribers and keep up to date with the latest developments in AI. From research to projects and ideas. If you are building an AI startup, an AI-related product, or a service, we invite you to consider becoming a sponsor.
Published via Towards AI
Towards AI Academy
We Build Enterprise-Grade AI. We'll Teach You to Master It Too.
15 engineers. 100,000+ students. Towards AI Academy teaches what actually survives production.
Start free — no commitment:
→ 6-Day Agentic AI Engineering Email Guide — one practical lesson per day
→ Agents Architecture Cheatsheet — 3 years of architecture decisions in 6 pages
Our courses:
→ AI Engineering Certification — 90+ lessons from project selection to deployed product. The most comprehensive practical LLM course out there.
→ Agent Engineering Course — Hands on with production agent architectures, memory, routing, and eval frameworks — built from real enterprise engagements.
→ AI for Work — Understand, evaluate, and apply AI for complex work tasks.
Note: Article content contains the views of the contributing authors and not Towards AI.