Coin snapshot on a date
GET /api/coin-historyPrice, market cap and 24h volume of a coin on ONE past date (00:00 UTC snapshot), in every currency at once plus your chosen one called out. Send GET /api/coin-history with the required field coin and pay $0.005 per call over x402 or MPP (there is no free tier). It returns a JSON object with source, fetchedAt, cached, id, symbol and 8 more.
Pass `date` (YYYY-MM-DD) or `daysAgo` (1-365). The point-in-time sibling of crypto-history (which returns a series): use it to value a position as of a date, compute a since-date return, or check a tax-lot basis. Historical range on this plan is the past 365 days, enforced before the call. Cached in-process for 5 minutes. Data provided by CoinGecko (https://www.coingecko.com/en/api).
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
coin | string | yes | Coin id (bitcoin, ethereum, ...). Also accepted as symbol, id, ticker, asset. |
date | string | no | Snapshot date YYYY-MM-DD (UTC), within the past 365 days. Alternative to daysAgo. |
daysAgo | number | no | Days before today, 1-365 (used when date is absent; default 30). |
currency | string | no | Currency to call out (default usd); all currencies are still returned under `allCurrencies`. |
Example request
curl -i "https://agent402.tools/api/coin-history?coin=bitcoin&daysAgo=30¤cy=usd"
Without payment this returns HTTP 402 Payment Required with the exact price for coin-history; any x402 v2 or MPP client pays it and retries.
Watch a call get paid
GET /api/coin-history$0.005 USDCPAYMENT-SIGNATUREon 14 chains200 OKAgent402-ReceiptEd25519Example response
{
"source": "coingecko",
"fetchedAt": "2026-08-22T13:20:00.000Z",
"cached": false,
"id": "bitcoin",
"symbol": "BTC",
"name": "Bitcoin",
"date": "2026-07-23",
"currency": "usd",
"price": 118412.55,
"marketCap": 2356000000000,
"volume24h": 41000000000,
"allCurrencies": {
"price": {
"usd": 118412.55,
"eur": 100812.3,
"btc": 1
},
"marketCap": {
"usd": 2356000000000
},
"volume24h": {
"usd": 41000000000
}
},
"credit": "Data provided by CoinGecko (https://www.coingecko.com/en/api)."
}| Field | Type | Always present | In the example |
|---|---|---|---|
source | string | yes | coingecko |
fetchedAt | string | yes | 2026-08-22T13:20:00.000Z |
cached | boolean | yes | false |
id | string | yes | bitcoin |
symbol | string | yes | BTC |
name | string | yes | Bitcoin |
date | string | yes | 2026-07-23 |
currency | string | yes | usd |
price | number | yes | 118412.55 |
marketCap | number | yes | 2356000000000 |
volume24h | number | yes | 41000000000 |
allCurrencies | object | yes | 3 fields: price, marketCap, volume24h |
credit | string | yes | Data provided by CoinGecko (https://www.coingecko.com/en/api). |
From an MCP client
catalog.call {
"slug": "coin-history",
"params": {
"coin": "bitcoin",
"daysAgo": 30,
"currency": "usd"
}
}The hosted connector at https://agent402.tools/mcp needs a payment for coin-history; the stdio package pays it from a wallet or from an AGENT402_CREDITS_KEY issued earlier. Local install: npx -y agent402-mcp@0.14.0.
Errors and behavior
coinis required. An input the tool rejects returns an HTTP 4xx whose body carrieserror,tool,expected,requiredandexample, so the caller can correct it.- A paid call that ends in any status of 400 or above is not charged over x402, MPP or a prepaid credits key: settlement runs after the tool and only on a successful response. The exception is a Tempo push credential, a transfer the buyer sent before the call: it settles before the tool runs, so if the tool then fails the payment is recorded as a refund owed to the paying wallet.
- Wallet-only: this tool reaches the network or stored state, so it has no proof-of-work tier. A prepaid card-credits key issued earlier (
Authorization: Bearer a402_...) also pays it. - A
POSTwith a JSON body to /api/coin-history is served as this GET, with the body as the input. - An
Idempotency-Keyheader makes a retried paid call replay the first 200 instead of charging again (an answer larger than 1 MB is not replayed).
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?.({ maxAmountPerPayment: "$0.005" }); // refuse any quote above this tool's price
registerExactEvmScheme(client, { signer: privateKeyToAccount(KEY) });
const payFetch = wrapFetchWithPayment(fetch, client);
const res = await payFetch("https://agent402.tools/api/coin-history?coin=bitcoin&daysAgo=30¤cy=usd");Related tools
Token price history (USD)
Historical USD price series for a token, by ticker symbol (ETH, BTC, SOL, ...) or by ERC-20 contract + network.
Wallet token transfers (filtered)
Recent token transfers for a wallet on Base, Ethereum and other EVM chains, newest first.
Chain info snapshot
Chain info in one call: chain id, gas price (wei and gwei) and the current block for Ethereum, Base, Polygon, Arbitrum.
Crypto categories by market cap
Coin categories (Layer 1, Meme, AI, DeFi, Stablecoins, RWA, ...) ranked by market cap, with 24h market cap change %, 24h.
Coin market chart for a time window
Price, market cap and volume series for a coin over an ARBITRARY time window: `from`/`to` as unix seconds or ISO dates.
Token price by contract address
Live price, market cap, 24h volume and 24h change for ERC-20 / SPL / other chain tokens looked up by CONTRACT ADDRESS.