#!/bin/sh
# getCandles: Get a market's price history bars. Needs TRENDLINE_API_KEY; TRENDLINE_API_BASE overrides the base.
curl -sS "${TRENDLINE_API_BASE:-https://systems.trendlinelabs.ai}/public/v1/markets/mk-btc-100k-2026/candles?resolution=1h&start=1791266400000&end=1791270000000&venue=kalshi" \
-H "Authorization: Bearer $TRENDLINE_API_KEY""""getCandles: Get a market's price history bars. Needs TRENDLINE_API_KEY; TRENDLINE_API_BASE overrides the base."""
import os
import requests
BASE = os.environ.get("TRENDLINE_API_BASE", "https://systems.trendlinelabs.ai")
KEY = os.environ["TRENDLINE_API_KEY"]
r = requests.get(f"{BASE}/public/v1/markets/mk-btc-100k-2026/candles", params={"resolution": "1h", "start": "1791266400000", "end": "1791270000000", "venue": "kalshi"},
headers={"Authorization": f"Bearer {KEY}"}, timeout=10)
r.raise_for_status()
print(r.json())
// getCandles: Get a market's price history bars. Needs TRENDLINE_API_KEY; TRENDLINE_API_BASE overrides the base.
const BASE = process.env.TRENDLINE_API_BASE ?? "https://systems.trendlinelabs.ai";
const KEY = process.env.TRENDLINE_API_KEY;
const r = await fetch(`${BASE}/public/v1/markets/mk-btc-100k-2026/candles?resolution=1h&start=1791266400000&end=1791270000000&venue=kalshi`, { headers: { Authorization: `Bearer ${KEY}` } });
console.log(r.status, await r.json());
{
"as_of_ms": 1791270100000,
"cached": false,
"end_ms": 1791270000000,
"resolution": "1h",
"series": {
"kalshi": {
"bars": [
{
"close": 0.42,
"high": 0.43,
"low": 0.4,
"open": 0.41,
"ts_ms": 1791266400000,
"volume_usd": 1250
},
{
"close": 0.41,
"high": 0.42,
"low": 0.41,
"open": 0.42,
"ts_ms": 1791270000000,
"volume_usd": 310
}
],
"basis": "yes_ask",
"exists": true,
"last_bar_ts_ms": 1791270000000,
"venue_market_id": "KXBTC-26DEC31-B100000"
}
},
"start_ms": 1791266400000,
"universal_id": "mk-btc-100k-2026"
}{
"error": {
"code": "<string>",
"message": "<string>",
"request_id": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"request_id": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"request_id": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"request_id": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"request_id": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"request_id": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"request_id": "<string>"
}
}Get a market's price history bars
Price history bars (open, high, low, close) for a window you choose, at 1m to 1d.
The window
startandendare unix milliseconds, inclusive, and must span fewer than 1000 bars at the chosenresolution.
The bars
- Prices are 0..1.
volume_usdis null where the venue has no trade tape.basisnames the price each venue’s bars are built from. - Bars before 2026-10-05 23:42:28Z may pair one side’s new quote with the other’s old one.
Freshness
as_of_msandcached: when this answer was built, and whether it came from the cache.last_bar_ts_msis information, not a freshness signal: a quiet market adds no bars.
Errors
| Status | Code | When |
|---|---|---|
| 422 | invalid_request | Missing, non-integer, seconds or after-9999-12-30 bounds; start >= end; a span of 1000 bars or more; an unknown resolution. |
| 422 | venue_unsupported | A venue whose price history is not served yet. Every venue has price history today. |
| 404 | not_found | Unknown market. |
| 404 | venue_not_listed | The market has no leg on that venue. |
| 503 | upstream_unavailable | History unavailable for a venue, the market or history lookup failing or timed out, or busy (with Retry-After). |
| 503 | upstream_unavailable | A bar failed our checks: a bar beyond the window’s neighbouring grid points or not a finite number, a price outside 0..1, a malformed series or bar, a bar with no readable time, a bar with no price, a negative volume. |
Any route can also answer 401, 403, 429, 500 or 503 dependency_unavailable, described on the Errors page.
A failing venue is never dropped from a partial 200: the whole request is refused.
#!/bin/sh
# getCandles: Get a market's price history bars. Needs TRENDLINE_API_KEY; TRENDLINE_API_BASE overrides the base.
curl -sS "${TRENDLINE_API_BASE:-https://systems.trendlinelabs.ai}/public/v1/markets/mk-btc-100k-2026/candles?resolution=1h&start=1791266400000&end=1791270000000&venue=kalshi" \
-H "Authorization: Bearer $TRENDLINE_API_KEY""""getCandles: Get a market's price history bars. Needs TRENDLINE_API_KEY; TRENDLINE_API_BASE overrides the base."""
import os
import requests
BASE = os.environ.get("TRENDLINE_API_BASE", "https://systems.trendlinelabs.ai")
KEY = os.environ["TRENDLINE_API_KEY"]
r = requests.get(f"{BASE}/public/v1/markets/mk-btc-100k-2026/candles", params={"resolution": "1h", "start": "1791266400000", "end": "1791270000000", "venue": "kalshi"},
headers={"Authorization": f"Bearer {KEY}"}, timeout=10)
r.raise_for_status()
print(r.json())
// getCandles: Get a market's price history bars. Needs TRENDLINE_API_KEY; TRENDLINE_API_BASE overrides the base.
const BASE = process.env.TRENDLINE_API_BASE ?? "https://systems.trendlinelabs.ai";
const KEY = process.env.TRENDLINE_API_KEY;
const r = await fetch(`${BASE}/public/v1/markets/mk-btc-100k-2026/candles?resolution=1h&start=1791266400000&end=1791270000000&venue=kalshi`, { headers: { Authorization: `Bearer ${KEY}` } });
console.log(r.status, await r.json());
{
"as_of_ms": 1791270100000,
"cached": false,
"end_ms": 1791270000000,
"resolution": "1h",
"series": {
"kalshi": {
"bars": [
{
"close": 0.42,
"high": 0.43,
"low": 0.4,
"open": 0.41,
"ts_ms": 1791266400000,
"volume_usd": 1250
},
{
"close": 0.41,
"high": 0.42,
"low": 0.41,
"open": 0.42,
"ts_ms": 1791270000000,
"volume_usd": 310
}
],
"basis": "yes_ask",
"exists": true,
"last_bar_ts_ms": 1791270000000,
"venue_market_id": "KXBTC-26DEC31-B100000"
}
},
"start_ms": 1791266400000,
"universal_id": "mk-btc-100k-2026"
}{
"error": {
"code": "<string>",
"message": "<string>",
"request_id": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"request_id": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"request_id": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"request_id": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"request_id": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"request_id": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"request_id": "<string>"
}
}Authorizations
Authorization: Bearer tl_live_…
Path Parameters
no control, format, private-use, unassigned, line or paragraph separator character
1 - 256Query Parameters
the bar width
1m, 5m, 15m, 1h, 6h, 1d window start, unix milliseconds, inclusive
window end, unix milliseconds, inclusive
one venue's series only; omit for every venue that lists the market
kalshi, polymarket, limitless, predictfun Response
Successful Response
when the history was read, unix milliseconds
true when served from a recent identical read
the window end, unix milliseconds
the bar width
1m, 5m, 15m, 1h, 6h, 1d one series per venue that lists the market
Show child attributes
Show child attributes
the window start, unix milliseconds
the market universal id