> ## Documentation Index
> Fetch the complete documentation index at: https://sonar-cf3aeac7.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Get token price history

> Average USD price and volume over time for the cross-chain asset a token belongs to, newest point first.

Returns a price history series for a token. The series is stored **per asset**, ChainQuery's cross-chain identity for a token (for example, one asset for USDC across every supported chain). The API looks up the token's `assetId` and returns that asset's history. Use it for line charts and sparklines. For candles, use [`GET /token/ohlcv`](https://sonar-cf3aeac7.mintlify.site/api-reference/token/get-token-ohlcv).

If you already know the asset ID, [`GET /asset/history`](https://sonar-cf3aeac7.mintlify.site/api-reference/asset/get-asset-history) returns the same data.

## Query parameters

**address** `string` *required*

Token contract address: `0x` followed by 40 hex characters. Case-insensitive.

**chain** `string` *required*

Chain ID, as a number (`8453`) or in `evm:<id>` form (`evm:8453`). See [Chains and identifiers](https://sonar-cf3aeac7.mintlify.site/concepts/chains-and-identifiers.md).

**period** `string`

Bucket size. One of `5m`, `15m`, `1h`, `6h`, `1d`. Leave it out for a mixed-resolution series (see below).

**from** `integer`

Start of the range, in Unix epoch **milliseconds**. Defaults to `to` minus the default range for the period (see the table below). Must not be after `to`.

**to** `integer`

End of the range, in Unix epoch milliseconds. Defaults to now.

There is no `limit` parameter. A response holds at most **2000 points**.

## Default ranges

When you leave out `from`, the range is:

| `period` | Default range (`from` omitted) |
| - | - |
| `5m` | 1 day |
| `15m` | 7 days |
| `1h` | 30 days |
| `6h` | 90 days |
| `1d` | 365 days |
| omitted | 365 days |

## Mixed resolution (no `period`)

Without `period`, each point's resolution depends on its age when you make the request:

| Age of the point | Resolution |
| - | - |
| Less than 24 hours | Individual price samples |
| 1 to 7 days | 15-minute averages |
| 7 days to 1 month | 1-hour averages |
| 1 to 3 months | 6-hour averages |
| Older than 3 months | 1-day averages |

This gives a detailed recent tail and a compact long-range series in one request.

## Response

**status** `string`

Always `"success"`.

**data** `object`

**properties**

**assetId** `number`

ID of the asset the history belongs to.

**period** `string | null`

The `period` you requested (`5m`, `15m`, `1h`, `6h` or `1d`), or `null` for the mixed-resolution series.

**history** `object[]`

Points, **newest first**. Empty when the asset has no data in the range.

**point**

**date** `string`

Bucket start (or sample time, for raw samples) as an ISO 8601 UTC string.

**priceUSD** `number`

**Average** USD price over the bucket. For raw samples, the sampled price.

**volumeUSD** `number | null`

USD volume for the bucket. Can be `null`.

## Behavior

* **Newest first.** Points are sorted by `date` **descending**. This is the opposite of the OHLCV endpoints, which return oldest first. Reverse the array before you draw a left-to-right chart.
* **2000-point cap.** If the range holds more than 2000 points, the **oldest** ones are dropped. A request without `period` over the default 365 days can lose its oldest part for a very active asset, because the last 24 hours are raw samples. Set `period`, or narrow the range, if you need the full span.
* **Averages, not closes.** `priceUSD` is the average over the bucket, so it won't match the `c` of an OHLCV candle for the same time.
* **Cross-chain.** Because the series belongs to the asset, the same token on two chains returns the same history.

> [!WARNING]
>
> **Tokens without an asset return 404.** If the token isn't linked to an asset (its `assetId` from [`GET /token`](https://sonar-cf3aeac7.mintlify.site/api-reference/token/get-token) is `null`), this endpoint returns `404 TOKEN_NOT_FOUND` with `Token or asset not found`, even though the token exists. Check `assetId` first, and for tokens without one use [`GET /token/ohlcv`](https://sonar-cf3aeac7.mintlify.site/api-reference/token/get-token-ohlcv) for those: it works for any token with a pool.

## Errors

| HTTP | `code` | When |
| - | - | - |
| 400 | `INVALID_ADDRESS` | `address` is not a valid 40-hex address, and that is the only problem. |
| 400 | `INVALID_PARAMETERS` | A required parameter is missing, `chain` is malformed, `period` is not in the list, `from` is after `to` (`from: from must be before to`), or several problems at once. |
| 404 | `TOKEN_NOT_FOUND` | `Token or asset not found`: the token is not indexed on that chain, or it has no linked asset. |
| 500 | `INTERNAL_ERROR` | Unexpected server error. |

```bash cURL theme={null}
curl "https://api.example.com/api/v1/token/history?address=0x4200000000000000000000000000000000000006&chain=8453&period=1h&from=1796288400000&to=1796295600000"
```

```javascript JavaScript theme={null}
const params = new URLSearchParams({
  address: "0x4200000000000000000000000000000000000006",
  chain: "8453",
  period: "1h",
});
const res = await fetch(`https://api.example.com/api/v1/token/history?${params}`);
const body = await res.json();
if (body.status !== "success") throw new Error(`${body.code}: ${body.message}`);

// Newest first: reverse for a left-to-right chart.
const points = [...body.data.history].reverse().map((p) => ({
  time: Date.parse(p.date),
  price: p.priceUSD,
}));
console.log(points.length, "points for asset", body.data.assetId);
```

```python Python theme={null}
import requests

res = requests.get(
    "https://api.example.com/api/v1/token/history",
    params={
        "address": "0x4200000000000000000000000000000000000006",
        "chain": "8453",
        "period": "1h",
    },
    timeout=10,
)
body = res.json()
if body["status"] != "success":
    raise RuntimeError(f'{body["code"]}: {body["message"]}')

for point in reversed(body["data"]["history"]):  # oldest first
    print(point["date"], point["priceUSD"], point["volumeUSD"])
```

```json 200 theme={null}
{
  "status": "success",
  "data": {
    "assetId": 2,
    "period": "1h",
    "history": [
      { "date": "2026-12-03T11:00:00.000Z", "priceUSD": 3412.57, "volumeUSD": 1840221.4 },
      { "date": "2026-12-03T10:00:00.000Z", "priceUSD": 3398.11, "volumeUSD": 2011873.92 },
      { "date": "2026-12-03T09:00:00.000Z", "priceUSD": 3405.02, "volumeUSD": null }
    ]
  }
}
```

```json 400 theme={null}
{
  "status": "error",
  "statusCode": 400,
  "code": "INVALID_PARAMETERS",
  "message": "from: from must be before to",
  "details": [{ "field": "from", "message": "from must be before to" }]
}
```

```json 404 theme={null}
{
  "status": "error",
  "statusCode": 404,
  "code": "TOKEN_NOT_FOUND",
  "message": "Token or asset not found"
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.