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 7 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.
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.
Example 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
}
}
}
| 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 |
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 AGENT402_CREDITS_KEY. Local install: npx -y agent402-mcp.
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 is cancelled when the tool fails. 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?.(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/coin-history?coin=bitcoin&daysAgo=30¤cy=usd");
Related tools
Token price history (USD)
POST /api/token-price-historyHistorical USD price series for a token, by ticker symbol (ETH, BTC, SOL, ...) or by ERC-20 contract + network, at 5-min…
Wallet token transfers (filtered)
POST /api/asset-transfersRecent token transfers for a wallet on Base, Ethereum and other EVM chains, newest first. Filtered transfer log for an E…
Chain info snapshot
GET /api/chain-infoOne-call chain state snapshot: chain id, latest block number, and current gas price (wei + gwei) for Ethereum, Base, Pol…
Crypto categories by market cap
GET /api/coin-categoriesCoin 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
GET /api/coin-market-chart-rangePrice, 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
GET /api/coin-price-by-contractLive price, market cap, 24h volume and 24h change for ERC-20 / SPL / other chain tokens looked up by CONTRACT ADDRESS on…