Skip to main content
The Vaults.fyi API supports the x402 payment protocol for keyless, pay-per-request access using USDC on Base. Instead of managing API keys, your agent pays for each request directly from its onchain wallet. This makes x402 ideal for autonomous agents and systems that already hold assets onchain.

How it works

  1. Send a request with the x-402-auth: true header — no API key needed.
  2. Receive a 402 Payment Required response containing payment details, including the current maxAmountRequired.
  3. Sign a USDC payment on Base using your agent’s wallet.
  4. Resend the original request with the X-Payment proof header attached.
  5. Receive a 200 response with the requested data.
The x402 JavaScript and Python libraries handle this payment flow automatically, so you don’t need to implement the handshake manually.

Quick start

Install the x402 client library and make your first request:
import { wrapAxios } from "x402/axios";
import axios from "axios";
import { createWalletClient, http } from "viem";
import { privateKeyToAccount } from "viem/accounts";
import { base } from "viem/chains";

const account = privateKeyToAccount(process.env.PRIVATE_KEY);
const walletClient = createWalletClient({
  account,
  chain: base,
  transport: http(),
});

const client = wrapAxios(axios, walletClient);

const response = await client.get("https://api.vaults.fyi/v2/vaults", {
  headers: { "x-402-auth": "true" },
});
For a complete working example, see the Agentic DeFi repo.

Pricing

All prices are in USDC on Base, charged per request. Payment is in USDC raw units (6 decimals) — for example, 5000 = $0.005 USDC. The 402 response always contains the current maxAmountRequired. Prices are subject to change.
PriceEndpoints
$0.005/v2/networks, /v2/vaults, /v2/tags, /v2/assets, /v2/curators
$0.01/v2/vaults/{network}/{address}, /v2/vaults/{network}/{address}/performance
$0.02/v2/detailed-vaults/{network}/{address}, /v2/positions/{address}
$0.025/v2/deposit-options/{address}, /v2/idle-assets/{address}, /v2/best-vault/{address}
$0.05/v2/transactions/*, /v2/transactions/rewards/claim/{address}
$0.75/v2/detailed-vaults (paginated list of all vaults)
Free/v2/health
/v2/historical/* endpoints are not available via x402 and require an API key. Request access to use historical data endpoints.