curl "https://api.metastreams.io/v1/tokens/solana/DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263/ohlcv?timeframe=1h&metric=price&countBack=24" \
-H "Authorization: Bearer $API_KEY"
const url = new URL(
"https://api.metastreams.io/v1/tokens/solana/DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263/ohlcv",
);
url.searchParams.set("timeframe", "1h");
url.searchParams.set("metric", "price");
url.searchParams.set("countBack", "24");
const response = await fetch(url, {
headers: { Authorization: `Bearer ${process.env.API_KEY}` },
});
if (!response.ok) throw new Error(`HTTP ${response.status}`);
const { candles } = await response.json();
{
"candles": [
{ "time": 1789545600000, "open": 0.0000221, "high": 0.0000224, "low": 0.0000219, "close": 0.0000222, "volume": 2104410.5 },
{ "time": 1789549200000, "open": 0.0000222, "high": 0.0000223, "low": 0.0000215, "close": 0.0000216, "volume": 2981337.2 }
]
}
{
"error": {
"code": "VALIDATION_ERROR",
"message": "One or more parameters are invalid.",
"details": [{ "field": "from", "message": "Must not be greater than `to`." }]
}
}
OHLCV candles
Read one token’s candle series at any timeframe, priced or by market cap.
curl "https://api.metastreams.io/v1/tokens/solana/DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263/ohlcv?timeframe=1h&metric=price&countBack=24" \
-H "Authorization: Bearer $API_KEY"
const url = new URL(
"https://api.metastreams.io/v1/tokens/solana/DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263/ohlcv",
);
url.searchParams.set("timeframe", "1h");
url.searchParams.set("metric", "price");
url.searchParams.set("countBack", "24");
const response = await fetch(url, {
headers: { Authorization: `Bearer ${process.env.API_KEY}` },
});
if (!response.ok) throw new Error(`HTTP ${response.status}`);
const { candles } = await response.json();
{
"candles": [
{ "time": 1789545600000, "open": 0.0000221, "high": 0.0000224, "low": 0.0000219, "close": 0.0000222, "volume": 2104410.5 },
{ "time": 1789549200000, "open": 0.0000222, "high": 0.0000223, "low": 0.0000215, "close": 0.0000216, "volume": 2981337.2 }
]
}
{
"error": {
"code": "VALIDATION_ERROR",
"message": "One or more parameters are invalid.",
"details": [{ "field": "from", "message": "Must not be greater than `to`." }]
}
}
Choosing the window
countBack asks for a bar count and supersedes from, while to and timeframe still apply. A request that names neither countBack nor from returns the most recent 500 buckets, and a window holding more than 5000 candles keeps the newest. This matches what TradingView’s charting library expects.
Paging through candles
The series has no cursor.from is inclusive and to is exclusive, both in milliseconds; leave to out to read up to now. To read further back, repeat the request with to set to the time of the oldest candle you received. Because to is exclusive, that candle is not repeated.
curl "https://api.metastreams.io/v1/tokens/solana/DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263/ohlcv?timeframe=1m&countBack=5000&to=1789545600000" \
-H "Authorization: Bearer $API_KEY"
Reading the response
Candle values are JSON numbers, not the decimal strings the token and trade objects carry. They feed charting libraries, which take numbers.Errors
| Code | When |
|---|---|
UNSUPPORTED_CHAIN | chain is not a supported slug |
VALIDATION_ERROR | A malformed address, an unknown timeframe, from greater than to, a countBack outside 1–5000, or an unknown parameter |
404.
curl "https://api.metastreams.io/v1/tokens/solana/DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263/ohlcv?timeframe=1h&metric=price&countBack=24" \
-H "Authorization: Bearer $API_KEY"
const url = new URL(
"https://api.metastreams.io/v1/tokens/solana/DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263/ohlcv",
);
url.searchParams.set("timeframe", "1h");
url.searchParams.set("metric", "price");
url.searchParams.set("countBack", "24");
const response = await fetch(url, {
headers: { Authorization: `Bearer ${process.env.API_KEY}` },
});
if (!response.ok) throw new Error(`HTTP ${response.status}`);
const { candles } = await response.json();
{
"candles": [
{ "time": 1789545600000, "open": 0.0000221, "high": 0.0000224, "low": 0.0000219, "close": 0.0000222, "volume": 2104410.5 },
{ "time": 1789549200000, "open": 0.0000222, "high": 0.0000223, "low": 0.0000215, "close": 0.0000216, "volume": 2981337.2 }
]
}
{
"error": {
"code": "VALIDATION_ERROR",
"message": "One or more parameters are invalid.",
"details": [{ "field": "from", "message": "Must not be greater than `to`." }]
}
}
Authorizations
Send the API key as Authorization: Bearer <key>.
Path Parameters
Chain the resource lives on. Chain slug. One spelling per chain, in paths and bodies alike. Only a chain with spot data is published.
solana, base, bsc, robinhood, arc Token mint or contract address.
Query Parameters
Candle bucket size; defaults to 1m.
1s, 5s, 15s, 30s, 1m, 3m, 5m, 15m, 30m, 1h, 4h, 6h, 12h, 1d, 7d OHLC metric, price or marketCap; defaults to marketCap.
OHLC denomination; defaults to usd.
Window start, inclusive; ignored when countBack is set. A window holding
more candles than the cap keeps the newest.
An instant, as milliseconds since the Unix epoch.
Window end, exclusive. An instant, as milliseconds since the Unix epoch.
TradingView bar count: the most recent N buckets at or before to.
Takes priority over from.
1 <= x <= 5000Response
One candle per bucket that traded, oldest first. The most recent 500 buckets when the request names neither countBack nor from.
GET /v1/tokens/{chain}/{address}/ohlcv response.
Buckets, oldest first.
Show child attributes
Show child attributes