x402

Pay-per-request API access using USDC on Base — no API key required

The Vaults.fyi API supports the x402 payment protocolarrow-up-right for keyless, pay-per-request access using USDC on Base. This is ideal for AI agents and autonomous systems that need programmatic access without managing API keys.

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 with payment details

  3. Sign a USDC payment on Base using your wallet

  4. Resend the request with the X-Payment proof header

  5. Receive a 200 response with data

circle-info

Use the x402arrow-up-right Python or JS library to handle the payment flow automatically.

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 repoarrow-up-right.

Pricing

All prices are in USDC on Base, charged per request.

Price
Endpoints

$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

circle-exclamation

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.

Last updated