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-minute (up to 2 days), hourly (up to 30 days) or daily (up to 365 days) resolution. Send POST /api/token-price-history with no required fields (7 optional) and pay $0.004 per call over x402 or MPP (there is no free tier). It returns a JSON object with symbol, contract, network, currency, interval and 11 more.
Returns the points plus first/last/high/low and the percent change over the window - the data behind 'how did this token move over the last N days' without a separate market-data subscription. 404 (not charged) when the token is not in the price feed.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
symbol | string | no | Ticker symbol (e.g. ETH, BTC). Use this OR contract+network. |
contract | string | no | 0x-prefixed 40-char ERC-20 contract address (with `network`). |
network | string | no | ethereum / base / polygon / arbitrum / optimism (default ethereum). |
interval | string | no | 5m, 1h, or 1d (default 1d). |
days | number | no | Shortcut: window length in days ending now (default 1 for 5m, 7 for 1h, 30 for 1d). |
startTime | string | no | ISO-8601 or unix seconds. Overrides `days`. |
endTime | string | no | ISO-8601 or unix seconds (default now). |
Example request
curl -i -X POST https://agent402.tools/api/token-price-history \
-H "Content-Type: application/json" \
-d '{"contract":"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48","network":"ethereum","interval":"1d","days":7}'
Without payment this returns HTTP 402 Payment Required with the exact price for token-price-history; any x402 v2 or MPP client pays it and retries.
Example response
{
"symbol": null,
"contract": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
"network": "ethereum",
"currency": "usd",
"interval": "1d",
"startTime": "2026-08-15T12:00:00.000Z",
"endTime": "2026-08-22T12:00:00.000Z",
"count": 7,
"first": 0.99966,
"last": 0.99971,
"high": 0.99982,
"low": 0.99951,
"changePct": 0.005,
"points": [
{
"t": "2026-08-16T00:00:00Z",
"price": 0.99966
}
],
"source": "alchemy",
"fetchedAt": "2026-08-22T12:00:00.000Z"
}
| Field | Type | Always present | In the example |
|---|---|---|---|
symbol | null | no | null |
contract | string | yes | 0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48 |
network | string | yes | ethereum |
currency | string | yes | usd |
interval | string | yes | 1d |
startTime | string | yes | 2026-08-15T12:00:00.000Z |
endTime | string | yes | 2026-08-22T12:00:00.000Z |
count | number | yes | 7 |
first | number | yes | 0.99966 |
last | number | yes | 0.99971 |
high | number | yes | 0.99982 |
low | number | yes | 0.99951 |
changePct | number | yes | 0.005 |
points | array of objects | yes | 1 item in the example |
source | string | yes | alchemy |
fetchedAt | string | yes | 2026-08-22T12:00:00.000Z |
From an MCP client
catalog.call {
"slug": "token-price-history",
"params": {
"contract": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
"network": "ethereum",
"interval": "1d",
"days": 7
}
}
The hosted connector at https://agent402.tools/mcp needs a payment for token-price-history; the stdio package pays it from a wallet or from AGENT402_CREDITS_KEY. Local install: npx -y agent402-mcp.
Errors and behavior
- Every field is optional. An input the tool rejects returns an HTTP 4xx whose body carries
error,tool,expected,requiredandexample. - 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 (
Authorization: Bearer a402_...) also pays it. - A
GETorHEADto /api/token-price-history returns the same 402 quote, so the price can be read without a body. - 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/token-price-history", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
"contract": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
"network": "ethereum",
"interval": "1d",
"days": 7
}),
});
Related tools
Token spot price (USD)
POST /api/token-priceReturn the current USD spot price for an ERC-20 token, identified by its contract address and network. Sourced from Alch…
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, …
Coin OHLC candles
GET /api/coin-ohlcOHLC candles for a coin: days 1 (30-min candles), 7 or 14 (4-hour), 30 / 90 / 180 / 365 (daily), in any vs currency. Ret…
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…
Stablecoin supply history
POST /api/stablecoin-supply-historyDaily total stablecoin circulating supply (in USD) over time from DefiLlama's free stablecoin charts, for all chains or …
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…