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. Send POST /api/token-price with the required field contract and pay $0.001 per call over x402 or MPP (there is no free tier). It returns a JSON object with contract, network, symbol, priceUsd and lastUpdated.
Sourced from Alchemy's aggregated price feed. Use this for portfolio-value calculations or to denominate a balance in fiat without depending on a separate market-data API.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
contract | string | yes | 0x-prefixed 40-char ERC-20 contract address. Also accepted as contractAddress, token, address. |
network | string | no | ethereum / base / polygon / arbitrum / optimism (default base). |
Example request
curl -i -X POST https://agent402.tools/api/token-price \
-H "Content-Type: application/json" \
-d '{"contract":"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913","network":"base"}'
Without payment this returns HTTP 402 Payment Required with the exact price for token-price; any x402 v2 or MPP client pays it and retries.
Example response
{
"contract": "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",
"network": "base",
"symbol": "USDC",
"priceUsd": 1.0001,
"lastUpdated": "2026-06-22T17:30:00Z"
}
| Field | Type | Always present | In the example |
|---|---|---|---|
contract | string | yes | 0x833589fcd6edb6e08f4c7c32d4f71b54bda02913 |
network | string | yes | base |
symbol | string | yes | USDC |
priceUsd | number | yes | 1.0001 |
lastUpdated | string | yes | 2026-06-22T17:30:00Z |
From an MCP client
catalog.call {
"slug": "token-price",
"params": {
"contract": "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",
"network": "base"
}
}
The hosted connector at https://agent402.tools/mcp needs a payment for token-price; the stdio package pays it from a wallet or from AGENT402_CREDITS_KEY. Local install: npx -y agent402-mcp.
Errors and behavior
contractis 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
GETorHEADto /api/token-price 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", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
"contract": "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",
"network": "base"
}),
});
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…
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…
CoinGecko spot price
POST /api/price-coingeckoLive spot price for up to 25 coins by CoinGecko id, one row per id in the order asked: prices[] of {id, price, change24h…
ERC-20 token metadata
POST /api/token-metadataResolve an ERC-20 contract address to its on-chain metadata: symbol, decimals, name, and logo URL where available. Use t…
Wallet balance (native + ERC-20)
POST /api/wallet-balanceLook up the native coin balance (ETH/MATIC) plus every ERC-20 holding for a wallet address on Ethereum, Base, Polygon, A…
Known-address label lookup
POST /api/address-labelLabel a known EVM address from a curated, committed dataset: major stablecoin + token contracts (the USDC and USDG contr…