Klines
Candlestick (OHLCV) data for a symbol over a given time range and interval.
Endpoint
GET /v1/market/klines
Weight:
limit | Weight |
|---|---|
| ≤ 100 | 1 |
| 101 – 500 | 2 |
| 501 – 1000 | 5 |
| 1001 – 1500 | 10 |
Authentication: Public (optional signing).
Query parameters
| Name | Type | Mandatory | Description |
|---|---|---|---|
symbol | string | Yes | Trading pair, uppercase, e.g. BTCUSDT. |
interval | enum | Yes | One of 1m, 3m, 5m, 15m, 30m, 1h, 2h, 4h, 6h, 8h, 12h, 1d, 3d, 1w, 1M. |
startTime | integer | No | Start of range, Unix milliseconds, inclusive. |
endTime | integer | No | End of range, Unix milliseconds, inclusive. |
limit | integer | No | Number of klines to return. Default 500, maximum 1500. |
If neither startTime nor endTime is provided, the most recent limit klines are returned. If only startTime is provided, limit klines starting at or after startTime are returned. Klines are returned in ascending open_time order.
Response
Each kline is an array. The response is a 2D array of klines:
[
[
1745920800000,
"67310.00",
"67450.50",
"67280.20",
"67432.15",
"182.4521",
1745920859999,
"12298745.33",
1842,
"98.3211",
"6628412.10"
],
[
1745920860000,
"67432.15",
"67510.00",
"67410.00",
"67498.80",
"201.7710",
1745920919999,
"13612498.55",
2014,
"112.4421",
"7588321.42"
]
]
Response fields
Each row is an array; values are positional:
| Index | Field | Type | Description |
|---|---|---|---|
| 0 | open_time | integer | Bar open time, Unix milliseconds. |
| 1 | open | string (decimal) | Open price. |
| 2 | high | string (decimal) | High price during the bar. |
| 3 | low | string (decimal) | Low price during the bar. |
| 4 | close | string (decimal) | Close price. |
| 5 | volume | string (decimal) | Total traded volume in base asset. |
| 6 | close_time | integer | Bar close time, Unix milliseconds (last ms of the bar). |
| 7 | quote_volume | string (decimal) | Total traded volume in quote asset. |
| 8 | trades | integer | Number of trades in the bar. |
| 9 | taker_buy_volume | string (decimal) | Volume bought by takers (base asset). |
| 10 | taker_buy_quote_volume | string (decimal) | Volume bought by takers (quote asset). |
Errors
| HTTP | Code | Meaning |
|---|---|---|
| 400 | INVALID_PARAMETER | Missing symbol/interval, unknown interval, or limit out of range. |
| 400 | UNKNOWN_SYMBOL | Symbol does not exist. |
| 400 | INVALID_TIME_RANGE | startTime greater than endTime. |
| 429 | RATE_LIMITED | Per-key request weight exceeded. |
Example
curl -s "https://api.pipai.io/v1/market/klines?symbol=BTCUSDT&interval=1m&limit=500"
curl -s "https://api.pipai.io/v1/market/klines?symbol=BTCUSDT&interval=1h&startTime=1745846400000&endTime=1745923200000"