Getting Started
Monetize your API for AI agents in under 5 minutes. AgentGate wraps your existing endpoints with x402 payment protection — agents discover, pay, and call your API automatically.
1Install
npx @dkerpal/agent-gate initThe CLI auto-detects your framework (Express, Hono, or Next.js), prompts for your wallet address, registers you on the marketplace, and generates a .agentgate.json config file.
2Add the Middleware
server.ts
import express from 'express';
import { agentgate } from '@agent-gate/middleware/express';
const app = express();
// Reads config from .agentgate.json
app.use(agentgate());
// Your routes — now payment-protected
app.get('/api/data', (req, res) => {
res.json({ result: 'your data here' });
});
app.listen(3000);3Deploy & Earn
Deploy your app as usual. AgentGate handles everything:
- ✅ Your endpoints appear in the marketplace
- ✅ Agents discover them via the Discovery API
- ✅ x402 payment verification happens automatically
- ✅ USDC settles to your wallet on Base or Solana
🔍 Discovery API
Browse available endpoints programmatically:
# List all endpoints
curl https://api.agentgate.online/v1/discover
# Filter by category
curl https://api.agentgate.online/v1/discover?category=code
# List categories
curl https://api.agentgate.online/v1/discover/categories