API Documentation

Programmatically search and discover x402 endpoints. Free tier available.

Base URL: https://theagentindex.app/api

All endpoints return JSON. Free endpoints require no authentication. Premium endpoints require x402 payment (USDC on Base).

๐Ÿ“‹ Endpoints

Free Endpoints

GET /stats FREE

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
}
GET /categories FREE

List all categories with endpoint counts.

{
  "categories": {
    "ai/ml": 89,
    "crypto-data": 76,
    "defi": 54,
    "content/ipfs": 38,
    "news": 31,
    "weather": 12,
    "other": 223
  }
}
GET /verify/:wallet FREE

Check USDC balance for any wallet on Base. Useful for verifying agent wallets before transactions.

URL Parameters

walletaddressEthereum address (0x...) required

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"
}
POST /submit FREE

Submit a new x402 endpoint for indexing. We verify it returns 402 before adding.

Request Body (JSON)

urlstringFull endpoint URL required
descriptionstringWhat the endpoint does
emailstringContact email (optional)

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.

GET /premium/analytics $0.02

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
}
GET /premium/compare $0.01

Compare multiple endpoints side-by-side.

Query Parameters

urlsstringComma-separated endpoint URLs required
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" }
  ]
}
GET /premium/recommend $0.03

AI-powered endpoint recommendations. Describe what you need in plain language.

Query Parameters

needstringWhat you need (e.g., "real-time crypto prices") required
maxPricenumberMaximum price per call
requireHealthybooleanOnly return healthy endpoints
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"
    }
  ]
}
GET /premium/reputation $0.02

Detailed reputation and reliability history for a specific endpoint.

Query Parameters

urlstringEndpoint URL to check required
{
  "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 /premium/leaders $0.02

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" }
  }
}
GET /premium/budget $0.01

Find highest quality endpoints within your budget. Optimizes for quality-per-dollar (value score).

Query Parameters

maxPricePerCallnumberMaximum price per call in USD required
categorystringFilter by category
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:

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.