Token Price History

GET/gateway/v1/market/price

Returns historical price data points for a token over a specified time range.

Time range options: - Predefined: `1d`, `7d`, `14d`, `30d`, `90d`, `180d`, `365d`, `max` - Custom: use `from` / `to` (Unix seconds or `YYYY-MM-DD`)

Granularity is automatic based on range: - `1d` → 5-minute intervals - `7d`–`90d` → hourly - `180d`+ → daily

Query Parameters

symbolstringrequired

Single token ticker symbol like `BTC`, `ETH`, or `SOL` (multi-symbol not supported)

Example: BTC
time_rangeenum<string>

Window of historical data to return: `1d`, `7d`, `14d`, `30d`, `90d`, `180d`, `365d`, or `max`. Ignored when `from`/`to` are set. This endpoint uses `time_range` only — it does NOT accept `interval`; bucket granularity is chosen server-side based on the window size.

Available options:1d7d14d30d90d180d365dmax
Example: 30d
fromstring

Start of custom date range (Unix timestamp or YYYY-MM-DD). Must be used together with `to`. Overrides `time_range` when set.

Example: 2025-01-01
tostring

End of custom date range (Unix timestamp or YYYY-MM-DD). Must be used together with `from`. Overrides `time_range` when set.

Example: 2025-03-01
currencystring

Quote currency like `usd`, `eur`, or `btc`

Example: usd
Token Price History
const options = {method: 'GET'};

fetch('https://api.asksurf.ai/gateway/v1/market/price?symbol=BTC&time_range=30d&from=2025-01-01&to=2025-03-01&currency=usd', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
OK
{
  "$schema": "https://example.com/schemas/MarketPriceResponse.json",
  "data": [
    {
      "exchange": "<string>",
      "exchange_name": "<string>",
      "metric": "<string>",
      "project_id": "<string>",
      "symbol": "<string>",
      "timestamp": 123,
      "value": 123
    }
  ],
  "meta": {
    "cached": true,
    "credits_used": 123,
    "empty_reason": "<string>"
  },
  "project_id": "<string>",
  "summary": {
    "change_abs": 123,
    "change_pct": 123,
    "first": 123,
    "high": 123,
    "last": 123,
    "latest_dt": 123,
    "low": 123,
    "n_points": 123
  },
  "symbol": "<string>"
}