> For the complete documentation index, see [llms.txt](https://docs.kaiko.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.kaiko.com/rest-api/cefi-spot-markets/market-data/trade-aggregations/batch-ohlcv.md).

# Batch OHLCV

{% hint style="info" %}

### This data is included in the following Kaiko packages:

* Level 1 & Level 2 Data \[Level 1 Aggregations Tier]
* Level 1 & Level 2 Data \[Level 1 Tick-Level Tier]
* Level 1 & Level 2 Data \[Level 2 Aggregations Tier]
* Level 1 & Level 2 Data \[Level 2 Tick-Level Tier]

*Subscriptions with "CeFi Spot" as the market type.*
{% endhint %}

## What is this endpoint for?

> Returns historical OHLCV candles (open, high, low, close, volume) for up to 50 instruments of one exchange and one class (spot, futures, perpetual futures or options) in a single call, over the date range and interval you choose.\
> \*\*Window.\*\* There is no maximum window: every page is bounded by \`page\_size\`. The window is limited to the instruments' trading range; an instrument outside its own range gets empty candles.\
> \*\*Interval.\*\* Whole minutes below one hour and whole hours from one hour (e.g. \`45m\`, \`3h\`); values such as \`90m\` or \`1h30m\` are a 400.\
> \*\*Rows.\*\* One row per instrument per interval bucket, stamped with the bucket's open time. A row carries \`instrument\` but not \`exchange\` or \`class\`, which are given once in \`meta.url\`. A bucket in which an instrument did not trade has \`null\` prices and a \`volume\` of \`"0"\`.\
> \*\*Order and pagination.\*\* Newest bucket first unless \`sort=asc\`, then by \`instrument\` ascending within a bucket. \`page\_size\` counts buckets, not rows: a page holds up to \`page\_size\` buckets for every requested instrument, i.e. up to \`page\_size\` × the number of instruments rows. Follow \`meta.next\_url\` for the next page.<br>

```json
{"openapi":"3.1.1","info":{"title":"Kaiko API","version":"2026-10-01"},"tags":[{"name":"Trades","description":"Datasets built from executed trades: candles per instrument and the block-traded volume of option instruments."}],"servers":[{"url":"https://api.kaiko.io","description":"Production"}],"security":[{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"X-Api-Key","description":"Your Kaiko API key. Sent on every request. Never in a query parameter.\n"}},"parameters":{"ExchangeQuery":{"name":"exchange","in":"query","required":true,"description":"Exchange code, the first part of an instrument's identity. With `class` and `instrument` it names exactly one instrument; an unknown combination is a 404 `unknown_instrument` naming it, never an empty page.","schema":{"type":"string","pattern":"^[a-z0-9]{2,8}$"}},"ClassQuery":{"name":"class","in":"query","required":true,"description":"Instrument class, the second part of an instrument's identity.","schema":{"$ref":"#/components/schemas/InstrumentClass"}},"InstrumentListQuery":{"name":"instrument","in":"query","required":true,"description":"Venue instrument codes, 1 to 50, comma-separated, all on `exchange` and of `class`. No wildcard. A repeated code is served once.","style":"form","explode":false,"schema":{"type":"array","minItems":1,"maxItems":50,"items":{"type":"string","pattern":"^[a-z0-9][a-z0-9._-]*$"}}},"StartTimeTradesQuery":{"name":"start_time","in":"query","required":false,"description":"Inclusive start of the window, ISO 8601 UTC, millisecond precision (finer is a 400). Defaults to `end_time` minus 30 days.","schema":{"type":"string","format":"date-time"}},"EndTimeTradesQuery":{"name":"end_time","in":"query","required":false,"description":"Exclusive end of the window, ISO 8601 UTC, millisecond precision (finer is a 400). Defaults to now. Must be after `start_time`.","schema":{"type":"string","format":"date-time"}},"OhlcvIntervalQuery":{"name":"interval","in":"query","required":false,"description":"Candle width, from `1m` to `1d`, dividing a day. Defaults to `1d`.","schema":{"$ref":"#/components/schemas/OhlcvInterval"}},"SortQuery":{"name":"sort","in":"query","required":false,"description":"Order on the time axis.","schema":{"$ref":"#/components/schemas/Sort"}},"PageSizeBatchOhlcvQuery":{"name":"page_size","in":"query","required":false,"description":"Buckets per page, each holding a row for every requested instrument (one day of `1m` candles at the maximum). A value above the maximum returns 400, never a silent cap.","schema":{"type":"integer","minimum":1,"maximum":1440,"default":100}},"ApiVersionQuery":{"name":"api_version","in":"query","required":false,"description":"Contract version to serve, as a date. Each endpoint serves its newest version released on or before it, so one date pins the whole API. When omitted, the endpoint's oldest version still served is used, so breaking changes only reach clients that raise their date. Append `-preview` (`2027-02-01-preview`) to also be served preview versions, which carry no stability promise. A date in the future, or one resolving to a retired version, returns 400 `unsupported_api_version`. The version served is echoed in `meta.api_version`, and `meta.url` and `meta.next_url` always carry this parameter. No `default` here on purpose: it differs per endpoint, and the request validator would otherwise fill in one date for all of them.","schema":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}(-preview)?$"}}},"schemas":{"InstrumentClass":{"type":"string","enum":["spot","future","perpetual-future","option","future_combo","option_combo"],"description":"Instrument class, part of an instrument's identity. `future_combo` and `option_combo` are venue-listed combinations of futures or options traded as one instrument."},"OhlcvInterval":{"type":"string","pattern":"^([1-9][0-9]*d|([1-9][0-9]*h)?([1-9][0-9]*m)?([1-9][0-9]*s)?)$","minLength":2,"default":"1d","description":"Candle width, as a duration (`1m`, `45m`, `3h`, `1d`): from `1m` to `1d`, dividing a day, in whole minutes below an hour and whole hours from an hour. Not an enum, to accept every interval nicole's batch-ohlcv accepts (a recorded exception, rule 14); the handler enforces the bounds."},"Sort":{"type":"string","enum":["asc","desc"],"default":"desc","description":"Order on the time axis."},"ListTradeBatchOhlcvResponse":{"type":"object","description":"One page of candles, by bucket `timestamp` then `instrument`.","required":["data","meta"],"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/BatchOhlcv"}},"meta":{"$ref":"#/components/schemas/Meta"}}},"BatchOhlcv":{"type":"object","description":"One instrument's candle for one `interval` bucket; unique on (`instrument`, `timestamp`) within a response (one `exchange` and `class` per request). Nicole's batch-ohlcv record, `timestamp` aside: see the operation description.","required":["instrument","timestamp","open","high","low","close","volume"],"properties":{"instrument":{"type":"string","description":"Venue instrument code, one of the requested `instrument` list."},"timestamp":{"type":"string","format":"date-time","description":"Open of the bucket, ISO 8601 UTC, millisecond precision. The bucket is `[timestamp, timestamp + interval)`."},"open":{"type":["string","null"],"format":"decimal","pattern":"^-?(0|[1-9][0-9]*)(\\.[0-9]+)?$","description":"Price of the bucket's first trade, in the quote asset. `null` when the instrument did not trade in the bucket."},"high":{"type":["string","null"],"format":"decimal","pattern":"^-?(0|[1-9][0-9]*)(\\.[0-9]+)?$","description":"Highest trade price in the bucket, in the quote asset. `null` when the instrument did not trade in the bucket."},"low":{"type":["string","null"],"format":"decimal","pattern":"^-?(0|[1-9][0-9]*)(\\.[0-9]+)?$","description":"Lowest trade price in the bucket, in the quote asset. `null` when the instrument did not trade in the bucket."},"close":{"type":["string","null"],"format":"decimal","pattern":"^-?(0|[1-9][0-9]*)(\\.[0-9]+)?$","description":"Price of the bucket's last trade, in the quote asset. `null` when the instrument did not trade in the bucket."},"volume":{"type":"string","format":"decimal","pattern":"^-?(0|[1-9][0-9]*)(\\.[0-9]+)?$","description":"Traded amount in the bucket, in the base asset. `\"0\"` when the instrument did not trade in it."}}},"Meta":{"type":"object","description":"Metadata of a collection response.","required":["api_version","url","count","next_url"],"properties":{"api_version":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}(-preview)?$","description":"Version this endpoint served: its version released on or before the requested `api_version`, or its oldest version still served when the request omitted it. Suffixed `-preview` when a preview version served it."},"url":{"type":"string","format":"uri","description":"Absolute URL of the request that produced this response, as received: path and query string unchanged, defaults not filled in, except `api_version`, which is always present (the version served when the request omitted it). Lets a stored response say what it answers, in the shape it was answered."},"count":{"type":"integer","minimum":0,"description":"Number of items in `data` on this page."},"next_url":{"type":["string","null"],"format":"uri","description":"Absolute URL of the next page, `null` on the last page. It holds only public parameters: the original query with every default made explicit (`api_version` included) and the time bound moved past the last row, plus the dataset's tie-breaker (`after_<key>`) where timestamps can tie. An operation that pages on another keyset (a block position, a snapshot) says so in its description, and its `next_url` carries that keyset's parameters instead."}}},"Problem":{"type":"object","description":"RFC 9457 problem details. Served as application/problem+json.","required":["type","title","status","code"],"properties":{"type":{"type":"string","format":"uri-reference","const":"about:blank","description":"Always `about:blank`; the reason is carried by `code`."},"title":{"type":"string","description":"HTTP reason phrase."},"status":{"type":"integer","minimum":400,"maximum":599,"description":"HTTP status code, repeated for clients that lose the status line."},"detail":{"type":"string","description":"Human-readable explanation specific to this occurrence. Do not parse it."},"instance":{"type":"string","format":"uri-reference","description":"Request path and request id, to quote to support."},"code":{"type":"string","pattern":"^[a-z][a-z0-9_]*$","description":"Stable machine-readable reason. Clients branch on this. New values are additive; renaming one is breaking. Values in use: invalid_parameter, unsupported_api_version, missing_api_key, invalid_api_key, not_entitled, history_out_of_entitlement, unknown_instrument, pair_not_covered, unknown_asset, unknown_index, unsupported_blockchain, chain_capability_unsupported, token_not_found, unknown_contract, unknown_protocol, unknown_pool, query_too_large, snapshot_expired, resource_not_found, method_not_allowed, not_acceptable, rate_limited, internal_error, service_unavailable."},"errors":{"type":"array","description":"On 400, one entry per invalid parameter.","items":{"$ref":"#/components/schemas/ParameterError"}}}},"ParameterError":{"type":"object","description":"One invalid parameter in a 400 response.","required":["parameter","detail"],"properties":{"parameter":{"type":"string","description":"Name of the offending parameter."},"detail":{"type":"string","description":"What is wrong with it."}}}},"responses":{"BadRequest":{"description":"Invalid parameter, window or API version.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"Unauthorized":{"description":"Missing or unknown X-Api-Key.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"Forbidden":{"description":"The key is valid but not entitled to this product, instrument or history depth.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"NotFound":{"description":"An identity value (instrument, asset, index, chain) or a /reference id does not exist.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"NotAcceptable":{"description":"The Accept header excludes application/json.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"TooManyRequests":{"description":"Rate limited. Retry after the delay in Retry-After.","headers":{"Retry-After":{"$ref":"#/components/headers/Retry-After"}},"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"InternalError":{"description":"Unexpected server failure.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"ServiceUnavailable":{"description":"A dependency is down or the data is not available yet.","headers":{"Retry-After":{"$ref":"#/components/headers/Retry-After"}},"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}},"headers":{"Retry-After":{"description":"Seconds to wait before retrying.","schema":{"type":"integer","minimum":0}}}},"paths":{"/market-data/trades/batch-ohlcv":{"get":{"operationId":"ListTradeBatchOhlcv","tags":["Trades"],"summary":"What is this endpoint for?","description":"Returns historical OHLCV candles (open, high, low, close, volume) for up to 50 instruments of one exchange and one class (spot, futures, perpetual futures or options) in a single call, over the date range and interval you choose.\n**Window.** There is no maximum window: every page is bounded by `page_size`. The window is limited to the instruments' trading range; an instrument outside its own range gets empty candles.\n**Interval.** Whole minutes below one hour and whole hours from one hour (e.g. `45m`, `3h`); values such as `90m` or `1h30m` are a 400.\n**Rows.** One row per instrument per interval bucket, stamped with the bucket's open time. A row carries `instrument` but not `exchange` or `class`, which are given once in `meta.url`. A bucket in which an instrument did not trade has `null` prices and a `volume` of `\"0\"`.\n**Order and pagination.** Newest bucket first unless `sort=asc`, then by `instrument` ascending within a bucket. `page_size` counts buckets, not rows: a page holds up to `page_size` buckets for every requested instrument, i.e. up to `page_size` × the number of instruments rows. Follow `meta.next_url` for the next page.\n","parameters":[{"$ref":"#/components/parameters/ExchangeQuery"},{"$ref":"#/components/parameters/ClassQuery"},{"$ref":"#/components/parameters/InstrumentListQuery"},{"$ref":"#/components/parameters/StartTimeTradesQuery"},{"$ref":"#/components/parameters/EndTimeTradesQuery"},{"$ref":"#/components/parameters/OhlcvIntervalQuery"},{"$ref":"#/components/parameters/SortQuery"},{"$ref":"#/components/parameters/PageSizeBatchOhlcvQuery"},{"$ref":"#/components/parameters/ApiVersionQuery"}],"responses":{"200":{"description":"One page of candles, `page_size` buckets of every requested instrument at most.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListTradeBatchOhlcvResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"406":{"$ref":"#/components/responses/NotAcceptable"},"429":{"$ref":"#/components/responses/TooManyRequests"},"500":{"$ref":"#/components/responses/InternalError"},"503":{"$ref":"#/components/responses/ServiceUnavailable"}}}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.kaiko.com/rest-api/cefi-spot-markets/market-data/trade-aggregations/batch-ohlcv.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
