API Documentation
Programmatically search and discover x402 endpoints. Free tier available.
https://theagentindex.app/api
All endpoints return JSON. Free endpoints require no authentication. Premium endpoints require x402 payment (USDC on Base).
๐ Endpoints
- FREE โ GET /search โ Search endpoints
- FREE โ GET /stats โ Index statistics
- FREE โ GET /categories โ List categories
- FREE โ GET /verify/:wallet โ Check wallet USDC balance
- FREE โ POST /submit โ Submit new endpoint
- $0.02 โ GET /premium/analytics โ Deep analytics
- $0.01 โ GET /premium/trending โ Trending endpoints
- $0.01 โ GET /premium/compare โ Compare endpoints
- $0.03 โ GET /premium/recommend โ AI recommendations
- $0.02 โ GET /premium/reputation โ Endpoint reputation
- $0.02 โ GET /premium/leaders โ Category leaders
- $0.01 โ GET /premium/budget โ Budget optimizer
Free Endpoints
Search indexed x402 endpoints by keyword, category, price, or health status.
Query Parameters
Example
GET /api/search?q=crypto&maxPrice=0.05&healthyOnly=true
{
"count": 12,
"results": [
{
"id": "aHR0cHM6Ly9hcGk...",
"url": "https://api.example.com/prices",
"domain": "api.example.com",
"description": "Real-time crypto prices for BTC, ETH, SOL",
"priceUsd": 0.001,
"category": "crypto-data",
"health": "healthy",
"tier": "A",
"score": 87
}
]
}
Get aggregate statistics about all indexed endpoints.
{
"indexed": "2026-01-29T14:30:00.000Z",
"total": 523,
"healthy": 312,
"healthRate": "59.7%",
"avgPriceUsd": "0.0156",
"uniqueDomains": 127
}
List all categories with endpoint counts.
{
"categories": {
"ai/ml": 89,
"crypto-data": 76,
"defi": 54,
"content/ipfs": 38,
"news": 31,
"weather": 12,
"other": 223
}
}
Check USDC balance for any wallet on Base. Useful for verifying agent wallets before transactions.
URL Parameters
Example
GET /api/verify/0xf5b62393d8e26c8ae2f8074adc6f6aec8b1d1bc1
{
"wallet": "0xf5b62393d8e26c8ae2f8074adc6f6aec8b1d1bc1",
"usdcBalance": 12.45,
"basescanUrl": "https://basescan.org/address/0xf5b...#tokentxns",
"usdcContract": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
"network": "Base (eip155:8453)",
"verifiedAt": "2026-01-29T14:30:00.000Z"
}
Submit a new x402 endpoint for indexing. We verify it returns 402 before adding.
Request Body (JSON)
Example
POST /api/submit
Content-Type: application/json
{
"url": "https://myapi.com/data",
"description": "Real-time market data feed"
}
// Success
{ "success": true, "message": "Verified and added to index!" }
// Error
{ "error": "Not a valid x402 endpoint (got HTTP 200, expected 402)" }
Premium Endpoints (x402)
These endpoints require x402 payment in USDC on Base. They return 402 Payment Required with payment instructions. Use the @x402/fetch SDK to pay automatically.
Deep analytics: most reliable endpoints, best value services, price distribution stats.
{
"mostReliable": [
{ "url": "https://...", "domain": "api.example.com", "ms": 142, "score": 95 }
],
"bestValue": [
{ "url": "https://...", "price": 0.001, "score": 88 }
],
"priceDistribution": { "min": 0.0001, "max": 0.5, "avg": 0.0156 },
"totalIndexed": 523
}
Discover newest endpoints and top-tier rated services.
{
"newest": [
{ "url": "https://...", "domain": "...", "price": 0.01, "category": "ai/ml" }
],
"topTier": [
{ "url": "https://...", "domain": "...", "score": 95, "price": 0.005 }
]
}
Compare multiple endpoints side-by-side.
Query Parameters
GET /api/premium/compare?urls=https://api1.com/data,https://api2.com/data
{
"compared": [
{ "url": "https://api1.com/data", "found": true, "price": 0.01, "health": "healthy", "score": 85, "tier": "A" },
{ "url": "https://api2.com/data", "found": true, "price": 0.02, "health": "degraded", "score": 62, "tier": "B" }
]
}
AI-powered endpoint recommendations. Describe what you need in plain language.
Query Parameters
GET /api/premium/recommend?need=I need real-time BTC prices&maxPrice=0.01
{
"need": "I need real-time BTC prices",
"found": 5,
"recommendations": [
{
"url": "https://...",
"domain": "crypto-oracle.xyz",
"description": "Live BTC/USD prices updated every second",
"matchScore": 85,
"quality": "A",
"score": 92,
"price": 0.001,
"health": "healthy"
}
]
}
Detailed reputation and reliability history for a specific endpoint.
Query Parameters
{
"url": "https://api.example.com/data",
"domain": "api.example.com",
"description": "Market data API",
"reputation": {
"overallScore": 87,
"tier": "A",
"uptimePercent": "99.2",
"avgResponseTime": 156,
"checksTotal": 10,
"checksPassed": 10,
"lastCheck": "2026-01-29T14:25:00.000Z",
"trend": "stable",
"healthStatus": "healthy"
},
"breakdown": {
"uptimeScore": 100,
"speedScore": 100,
"documentationScore": 70,
"freshnessScore": 100
}
}
Get the top-rated endpoint in each category. Find the best service across all categories in one call.
{
"totalCategories": 11,
"leaders": {
"ai/ml": { "url": "https://...", "domain": "ai-oracle.xyz", "score": 95, "tier": "A", "price": 0.02, "health": "healthy" },
"crypto-data": { "url": "https://...", "domain": "crypto-feed.io", "score": 92, "tier": "A", "price": 0.001, "health": "healthy" },
"defi": { "url": "https://...", "domain": "defi-api.com", "score": 88, "tier": "A", "price": 0.005, "health": "healthy" }
}
}
Find highest quality endpoints within your budget. Optimizes for quality-per-dollar (value score).
Query Parameters
GET /api/premium/budget?maxPricePerCall=0.01&category=crypto-data
{
"budget": 0.01,
"category": "crypto-data",
"found": 23,
"optimized": [
{ "url": "https://...", "domain": "...", "price": 0.001, "quality": 92, "tier": "A", "health": "healthy", "valueScore": 92000 },
{ "url": "https://...", "domain": "...", "price": 0.002, "quality": 85, "tier": "A", "health": "healthy", "valueScore": 42500 }
]
}
Using The Layer SDK
The easiest way to work with x402 endpoints is through @agentindex/core โ it handles discovery, routing, payments, and failover automatically:
npm install @agentindex/core
import { AgentIndexClient } from '@agentindex/core';
const client = new AgentIndexClient({
privateKey: process.env.WALLET_KEY,
budgetLimit: 10.00 // Max $10 spend
});
// Call any endpoint by capability - we handle everything
const weather = await client.call({ capability: 'weather' });
const prices = await client.call({ capability: 'crypto-price', maxPrice: 0.01 });
// Or search and call directly
const endpoints = await client.search({ query: 'crypto' });
const result = await client.callEndpoint(endpoints[0].url);
MCP Server for Claude Desktop
Add x402 endpoint discovery to Claude Desktop or Cursor:
// Add to ~/Library/Application Support/Claude/claude_desktop_config.json
{
"mcpServers": {
"agentindex": {
"command": "npx",
"args": ["-y", "@agentindex/mcp-server"]
}
}
}
Then ask Claude: "Find me x402 endpoints for weather data"
Using x402 Payments Directly
If you prefer direct API calls, use the @x402/fetch SDK:
import { wrapFetchWithPayment } from '@x402/fetch';
import { privateKeyToAccount } from 'viem/accounts';
const account = privateKeyToAccount(process.env.PRIVATE_KEY);
const fetchWithPayment = wrapFetchWithPayment(fetch, account, {
network: 'base-mainnet' // or 'base-sepolia' for testnet
});
const response = await fetchWithPayment(
'https://theagentindex.app/api/premium/analytics'
);
const data = await response.json();
Rate Limits
Free endpoints: 100 requests/minute per IP
Premium endpoints: Unlimited (payment required per call)
Network Info
Chain: Base Mainnet (eip155:8453)
Asset: USDC (0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913)
Facilitator: Coinbase CDP
Deploy Your Own x402 Endpoint
Want to monetize your API with x402 payments? Here's how to get started:
1. Choose a Hosting Provider
Your x402 service needs reliable, low-latency hosting. Recommended options:
- Railway โ One-click deploys from GitHub. Free tier + pay-as-you-go. Perfect for Node.js x402 services.
- DigitalOcean โ $200 free credit for new users. App Platform or Droplets for full control.
2. Add x402 Payment Handling
Use the official x402 middleware to add payment verification:
import { x402Middleware } from '@x402/server';
app.use('/api/premium/*', x402Middleware({
price: 0.01, // $0.01 per call
network: 'base-mainnet',
wallet: '0xYourWallet...'
}));
3. Submit to Agent Index
Once deployed, submit your endpoint to get discovered by AI agents worldwide.