Author(s): Chew Loong Nian – AI ENGINEER
Originally published on Towards AI.
HTTP Error 402 Has Been Dead for 29 Years – It Has Become a Cash Register for AI Agents
There is a status code in the HTTP specification 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 back-end developers, the “we’ll figure out Internet money later” IOU of HTTP/1.1.
The digital landscape is transforming, and HTTP Error 402 is making a comeback. AI agents are driving a surge in traffic that outpaces the traditional ad, subscription, and click monetization models. Simply blocking this traffic only safeguards costs without generating revenue.
The revival of HTTP Error 402 addresses this issue by converting HTTP into a payment flow. Servers can now respond with a 402 status code plus a machine-readable price. They can then accept a signed proof of payment in a subsequent request for verification and settlement. Typically, this payment is done using USDC stablecoins.
Protocol Implementation at the Edge
This article details the handshake of the protocol and explains how AWS CloudFront/WAF and Cloudflare’s Monetization Gateway have implemented it at the edge with minimal overhead. It also discusses optional outcome-based pricing and demonstrates how to connect x402 to an API and agent using open-source SDKs.
Comparisons are drawn between x402 and other “agents + money” (ACP/AP2) standards. The article also addresses concerns from skeptics, such as bot impersonation, tax accounting/billing, and attempts to circumvent paid access. It concludes by identifying who should adopt it, including API/dataset/MCP vendors, Cloudflare waitlist users, and agent builders, and provides guidance on getting started quickly with a testnet demo.
Read the full blog for free on Medium Here.
We Are Building Enterprise-Grade AI. We Will Also Teach You How to Master It.
15 engineers. More than 100,000 students. Towards AI Academy teaches what actually survives production.
Start for free – no obligation:
→ 6-Day Agentic AI Engineering Email Guide — One Practical Lesson Per Day
→ Agents Architecture Cheatsheet — 3 years of architectural decisions in 6 pages
Our courses:
→ AI Engineering Certification — 90+ lessons from project selection to deployed product. The most comprehensive practical LLM course available.
→ Agent Engineering Course — Hands-on with production agent architectures, memory, routing, and evaluation frameworks — built from real enterprise engagements.
→ AI for Work — Understand, evaluate and apply AI for complex work tasks.
Note: The content of the article contains the views of the contributing authors and not of Towards AI.
“`

