When an AI agent needs a tool, it shouldn't have to fill out a form, wait for API key approval, and manage a monthly subscription. It should just pay $0.001 and get what it needs.
The Problem With APIs Today
Every time an AI agent needs to call an external API, someone has to:
- Create an account with the API provider
- Enter a credit card (sometimes go through KYC)
- Buy credits or a subscription plan — prepaying for a commitment
- Store and manage an API key (security risk)
- Handle billing, renewals, rate limits
This was fine when humans were the ones integrating. But AI agents don't have credit cards. They can't click "Agree to Terms." They can't manage a rotating key in a vault.
The internet was built for humans. But agents are using it now.
Enter HTTP 402: The Status Code That Was Waiting for Its Moment
HTTP 402 "Payment Required" was defined in 1991 as a reserved status code — "for future use." It sat unused for over three decades.
Then in 2024, Coinbase released the x402 protocol: an open standard that finally gives HTTP 402 its purpose.
Here's the entire x402 flow:
1. Agent sends HTTP request → server responds 402 with payment requirements
2. Agent signs a gasless USDC authorization (EIP-3009, no gas needed)
3. Agent retries with X-Payment header
4. Server verifies → settles on Base → returns 200 OK
No accounts. No API keys. No subscriptions. The agent carries a wallet, pays per call, and gets the resource. It's a vending machine for the internet.
HTTP/1.1 402 Payment Required
{
"x402Version": 1,
"error": "X-Payment header is required",
"accepts": [{
"scheme": "exact",
"network": "base",
"maxAmountRequired": "1000",
"resource": "https://api.iteratools.com/qrcode",
"description": "QR code generation",
"payTo": "0xa81Dbd562436511dE5268BF70cF124C2689Ab11a",
"asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"
}]
}
The payment amount is machine-readable. The wallet address is in the response. The agent doesn't need to ask anyone — it just pays.
Why x402 Was Made for AI Agents
Traditional APIs were designed for human developers who:
- Can read terms of service
- Have credit cards
- Can wait for approval emails
- Manage credentials in
.envfiles
AI agents are different:
- They can execute code autonomously
- They can hold crypto wallets (via CDP, viem, etc.)
- They need to pay for tools inside a reasoning loop — in milliseconds
- They shouldn't require human intervention to access a $0.001 API call
x402 matches the agent mental model perfectly: "I need this resource. How much does it cost? Here's the payment. Give me the resource."
It's the same logic as a vending machine. Put money in, get product out. No account. No subscription. No paperwork.
IteraTools: 41 Pay-Per-Use Tools Ready for Agents
Try it:
curl -s -X POST https://api.iteratools.com/qrcode -H 'Content-Type: application/json' -d '{"text":"test"}'MCP package:
npx @iteratools/mcpx402 protocol:
GitHub (x402):
IteraTools is built by Iterasoft. If you're building AI agents, we'd love to hear from you.
SOCIAL SHARE CARD GENERATOR