
I Built a DeFi Data API Where AI Agents Pay Per Call — Here's How
Last week I deployed something I've wanted to build for a while: a crypto/DeFi data API where the client pays per call in USDC, with no API keys, no accounts, and no subscriptions . The payment happens as part of the HTTP request itself. It's live at https://x402-api.fly.dev and it already has an on-chain identity: Agent #18763 on Base via ERC-8004. Here's what it does, how the payment flow works, and what surprised me along the way. Why x402? If you haven't heard of x402 , the short version: it's a protocol built on top of the long-forgotten HTTP 402 Payment Required status code. The idea is simple — a server responds with a 402 and tells the client exactly how much to pay and where. The client sends the payment as a header on the next (or retried) request. The server verifies it and responds with the actual data. No OAuth dance. No rate-limit tiers. No billing portal. Just: "this costs 0.003 USDC, pay here, get data." Why does this matter for AI agents specifically? Because agents ar
Continue reading on Dev.to Webdev
Opens in a new tab



![[MM’s] Boot Notes — The Day Zero Blueprint — Test Smarter on Day One](/_next/image?url=https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F1368%2F1*AvVpFzkFJBm-xns4niPLAA.png&w=1200&q=75)