Crypto price history

$0.015 per call · USDC via x402 · GET /api/crypto-history

Historical price, market cap, and volume time series for a coin. Send GET /api/crypto-history with the required field coin and pay $0.015 per call over x402 or MPP (there is no free tier). It returns a JSON object with coin, currency, days, count and bars.

Granularity is automatic per CoinGecko: <=1 day = 5-min bars, 2-90 days = hourly, >90 days = daily. Days: 1, 7, 14, 30, 90, 180, 365, or "max". Returns aligned arrays of {time, price, marketCap, volume}.

Category: Live public data · Tags: crypto history chart backtest timeseries

TRY IN PLAYGROUND →

Parameters

NameTypeRequiredDescription
coinstringyesSymbol (BTC) or id (bitcoin) Also accepted as symbol, id, ticker, asset.
daysstringno1, 7, 14, 30, 90, 180, 365, or "max" (default 7)
currencystringnovs_currency (default: usd)

Example request

curl -i "https://agent402.tools/api/crypto-history?coin=BTC&days=7&currency=usd"

Without payment this returns HTTP 402 Payment Required with the exact price for crypto-history; any x402 v2 or MPP client pays it and retries.

Example response

{
  "coin": "bitcoin",
  "currency": "usd",
  "days": "7",
  "count": 1,
  "bars": [
    {
      "time": "2026-06-13T00:00:00Z",
      "price": 66120.45,
      "marketCap": 1298000000000,
      "volume": 27400000000
    }
  ]
}
FieldTypeAlways presentIn the example
coinstringyesbitcoin
currencystringyesusd
daysstringyes7
countnumberyes1
barsarray of objectsyes1 item in the example

From an MCP client

catalog.call {
  "slug": "crypto-history",
  "params": {
    "coin": "BTC",
    "days": "7",
    "currency": "usd"
  }
}

The hosted connector at https://agent402.tools/mcp needs a payment for crypto-history; the stdio package pays it from a wallet or from AGENT402_CREDITS_KEY. Local install: npx -y agent402-mcp.

Errors and behavior

Paid call (JavaScript agent)

import { wrapFetchWithPayment } from "@x402/fetch";
import { x402Client } from "@x402/core/client";
import { registerExactEvmScheme } from "@x402/evm/exact/client";
import { privateKeyToAccount } from "viem/accounts";

const client = new x402Client();
client.setSpendControls?.(false); // keep your own spending ceiling in code
registerExactEvmScheme(client, { signer: privateKeyToAccount(KEY) });
const payFetch = wrapFetchWithPayment(fetch, client);

const res = await payFetch("https://agent402.tools/api/crypto-history?coin=BTC&days=7&currency=usd");

Part of these workflows

Crypto price history is one step in these 3 skill packs, each sold as a single call:

Related tools

Coin market chart for a time window

$0.008 · GET /api/coin-market-chart-range

Price, market cap and volume series for a coin over an ARBITRARY time window: `from`/`to` as unix seconds or ISO dates, …

Token price history (USD)

$0.004 · POST /api/token-price-history

Historical USD price series for a token, by ticker symbol (ETH, BTC, SOL, ...) or by ERC-20 contract + network, at 5-min…

Coin OHLC candles

$0.008 · GET /api/coin-ohlc

OHLC candles for a coin: days 1 (30-min candles), 7 or 14 (4-hour), 30 / 90 / 180 / 365 (daily), in any vs currency. Ret…

DeFi chain TVL history

$0.002 · POST /api/defi-chain-tvl-history

Daily TVL history for one chain (Ethereum, Base, Solana, Arbitrum...) or for all of DeFi (chain "all") from DefiLlama's …

DeFi yield pool history

$0.002 · POST /api/defi-yield-history

Daily APY and TVL history for one DeFi yield pool (DefiLlama pool id from defi-yields): per-day total/base/reward APY an…

Stablecoin supply history

$0.002 · POST /api/stablecoin-supply-history

Daily total stablecoin circulating supply (in USD) over time from DefiLlama's free stablecoin charts, for all chains or …