You built an API. It's good. Developers use it. But there's a new type of customer knocking on your door — and they can't sign up.
AI agents are the fastest-growing consumer of APIs right now. They browse documentation, discover endpoints, and try to call them. But when they hit your signup page — account creation, email verification, credit card form — they can't continue. They leave. You never know they were there.
This isn't a future problem. It's happening today, on your API, right now.
AI agents already spend millions on API calls every month. Coinbase's x402 protocol has settled over 75 million transactions. The agent economy isn't theoretical — it's real, and it's growing fast.
Here's some quick math.
10,000 agents call your API once a day at $0.01 each. That's $100/day. Or $36,500/year. From traffic you're currently losing because agents can't get past your paywall.
The agents are already there. The only question is whether you're collecting the revenue.
HTTP 402 is a standard status code that's been in the HTTP spec since 1997. It means "Payment Required." For decades, nobody used it. Now it's the foundation of agent-to-API payments.
Here's how it works in plain English:
An agent sends a normal HTTP request to your API.
Your server responds with HTTP 402 Payment Required. The response includes: how much it costs, which token (USDC), and which wallet to pay.
The agent reads this, signs a USDC payment, and retries the request with a payment header.
The x402 facilitator verifies the payment, settles it on-chain, and your API responds with HTTP 200 and the data.
No accounts. No API keys. No invoices. No signup forms. Just HTTP.
The agent doesn't need to know anything about you. Your API doesn't need to know anything about the agent. The payment is embedded in the protocol itself.
Install the SDK:
npm install @monapi/sdk @x402/express
Add the middleware to your Express app:
import express from "express";
import { monapi } from "@monapi/sdk";
const app = express();
app.use(monapi({
wallet: process.env.WALLET,
price: 0.01,
}));
app.get("/api/weather", (req, res) => {
res.json({ temp: 22, city: "Berlin" });
});
app.listen(3000);
That's it. Every route now requires payment. When an agent hits your API without paying, here's what it sees:
$ curl -i localhost:3000/api/weather
HTTP/1.1 402 Payment Required
X-Payment-Price: 0.01
X-Payment-Token: USDC
X-Payment-Network: base
X-Payment-Wallet: 0x83...913
Any x402-compatible agent reads this response, pays automatically, and retries. Your API responds normally.
Not every endpoint is worth the same. Charge differently based on what you're serving:
app.use(monapi({
wallet: process.env.WALLET,
routes: {
"/api/weather": 0.01, // simple lookup
"/api/forecast": 0.05, // more compute
"/api/search": 0.10, // expensive query
},
}));
monapi also supports Next.js and MCP (Model Context Protocol). Same SDK, different entry points. Check the docs for framework-specific examples.
When an agent pays your API, here's the full sequence:
Request. The agent calls your endpoint. No payment header attached.
402. monapi intercepts, returns payment terms: price, wallet, token, network.
Payment. The agent signs a USDC transfer using EIP-3009 and retries with the payment in the header.
200. The x402 facilitator verifies and settles the payment on-chain. Your API responds with the data.
A few things worth knowing:
The x402 ecosystem is live and growing. Agents built with Coinbase AgentKit, Cloudflare Workers, and the Vercel AI SDK already support x402 payments out of the box.
This isn't a whitepaper promise. The infrastructure exists today. Agents are making payments today. The question is whether your API is set up to receive them.
You have three options:
npx monapi init — it detects your framework, configures your wallet, and generates starter code.The SDK is free, open source, and MIT licensed. No monapi account needed. No fees from us.
Your API is already getting traffic from agents.
The only question is whether you're getting paid for it.