> ## Documentation Index
> Fetch the complete documentation index at: https://api.docs.rocketfi.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Get candles

> OHLCV candles for an instrument over a time range.

### Parameters

| Parameter | Required | Type | Description |
| --------- | -------- | ---- | ----------- |
| instrumentId | yes | string (decimal) | Instrument ID to fetch candles for. |
| interval | yes | string | Candle timeframe (1m, 5m, 15m, 30m, 1h, 4h, 1d). |
| startTime | yes | integer (int64) | Start timestamp in milliseconds (optional, defaults to 24h ago). |
| endTime | yes | integer (int64) | End timestamp in milliseconds (optional, defaults to now). |
| limit | yes | integer | null | Maximum number of candles to return (optional, defaults to 500, max 1000). |

### Response fields

| Parameter | Required | Type | Description |
| --------- | -------- | ---- | ----------- |
| `candles` | yes | object[] | OHLCV candles for the requested time range. |
| `candles[].close` | yes | number (float) | — |
| `candles[].high` | yes | number (float) | — |
| `candles[].low` | yes | number (float) | — |
| `candles[].open` | yes | number (float) | — |
| `candles[].slot` | yes | integer (int64) | — |
| `candles[].timestamp` | yes | integer (int64) | — |
| `candles[].volume` | yes | number (float) | — |

### Response example

A sample **`200`** response body is attached to this operation as an OpenAPI **example** — see the **Example** panel on this page.



## OpenAPI

````yaml /specs/indexer-openapi.json get /candles
openapi: 3.1.0
info:
  title: Rocket Indexer API Documentation
  description: >-
    Welcome to the RocketChain Indexer API documentation!


    The indexer REST API serves historical and aggregated market data from
    ClickHouse. Endpoints cover candles, trades, order history, portfolio
    curves, funding events, bridge events, vault events, current/historical
    instruments, and live instrument details.
  license:
    name: MIT
    url: https://github.com/rocketfoundation/rocket-sdk-rust/blob/main/LICENSE
  version: '1.0'
  x-logo:
    altText: ROCKET
    backgroundColor: '#00000000'
    url: https://www.rocketfoundation.io/assets/rocket-logo.svg
servers:
  - url: https://beta.rocket-cluster-1.com/indexer
    description: Beta
  - url: https://testnet.rocket-cluster-1.com/indexer
    description: Testnet
  - url: https://devnet.rocket-cluster-1.com/indexer
    description: Devnet
security: []
tags:
  - name: Indexer REST-API
    description: >-
      Read-only REST endpoints backed by the RocketChain indexer. All routes are
      served over HTTP GET.
paths:
  /candles:
    get:
      tags:
        - Indexer REST-API
      summary: Get candles
      description: >-
        OHLCV candles for an instrument over a time range.


        ### Parameters


        | Parameter | Required | Type | Description |

        | --------- | -------- | ---- | ----------- |

        | instrumentId | yes | string (decimal) | Instrument ID to fetch candles
        for. |

        | interval | yes | string | Candle timeframe (1m, 5m, 15m, 30m, 1h, 4h,
        1d). |

        | startTime | yes | integer (int64) | Start timestamp in milliseconds
        (optional, defaults to 24h ago). |

        | endTime | yes | integer (int64) | End timestamp in milliseconds
        (optional, defaults to now). |

        | limit | yes | integer | null | Maximum number of candles to return
        (optional, defaults to 500, max 1000). |


        ### Response fields


        | Parameter | Required | Type | Description |

        | --------- | -------- | ---- | ----------- |

        | `candles` | yes | object[] | OHLCV candles for the requested time
        range. |

        | `candles[].close` | yes | number (float) | — |

        | `candles[].high` | yes | number (float) | — |

        | `candles[].low` | yes | number (float) | — |

        | `candles[].open` | yes | number (float) | — |

        | `candles[].slot` | yes | integer (int64) | — |

        | `candles[].timestamp` | yes | integer (int64) | — |

        | `candles[].volume` | yes | number (float) | — |


        ### Response example


        A sample **`200`** response body is attached to this operation as an
        OpenAPI **example** — see the **Example** panel on this page.
      operationId: getCandles
      parameters:
        - name: instrumentId
          in: path
          description: Instrument ID to fetch candles for.
          required: true
          schema:
            $ref: '#/components/schemas/InstrumentId'
          example: '0x85d55cb42a3e6b50'
        - name: interval
          in: path
          description: Candle timeframe (1m, 5m, 15m, 30m, 1h, 4h, 1d).
          required: true
          schema:
            $ref: '#/components/schemas/CandleTimeframe'
          example: 1h
        - name: startTime
          in: path
          description: Start timestamp in milliseconds (optional, defaults to 24h ago).
          required: true
          schema:
            oneOf:
              - type: 'null'
              - $ref: '#/components/schemas/u64'
          example: 1710000000000
        - name: endTime
          in: path
          description: End timestamp in milliseconds (optional, defaults to now).
          required: true
          schema:
            oneOf:
              - type: 'null'
              - $ref: '#/components/schemas/u64'
          example: 1710086400000
        - name: limit
          in: path
          description: >-
            Maximum number of candles to return (optional, defaults to 500, max
            1000).
          required: true
          schema:
            type:
              - integer
              - 'null'
            default: 500
            minimum: 0
          example: 500
      responses:
        '200':
          description: Candles
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetCandlesResponse'
              example:
                candles:
                  - close: 89.775
                    high: 89.849
                    low: 89.701
                    open: 89.701
                    slot: 29572677
                    timestamp: 1774360620000
                    volume: 0.5
                  - close: 89.646
                    high: 89.775
                    low: 89.646
                    open: 89.775
                    slot: 29572678
                    timestamp: 1774360680000
                    volume: 0.5
        '400':
          description: Invalid query parameters
          content:
            text/plain:
              schema:
                type: string
        '500':
          description: Internal server error
          content:
            text/plain:
              schema:
                type: string
components:
  schemas:
    InstrumentId:
      type: string
      format: decimal
      description: An instrument identifier (8-byte hash).
      example: '42'
    CandleTimeframe:
      type: string
      description: Candle timeframe/interval for aggregation
      enum:
        - 1m
        - 5m
        - 15m
        - 30m
        - 1h
        - 4h
        - 1d
      example: 1h
    u64:
      type: integer
      format: int64
      minimum: 0
    GetCandlesResponse:
      type: object
      required:
        - candles
      properties:
        candles:
          type: array
          items:
            $ref: '#/components/schemas/CandleResponseItem'
          description: OHLCV candles for the requested time range.
      examples:
        - candles:
            - close: 89.775
              high: 89.849
              low: 89.701
              open: 89.701
              slot: 29572677
              timestamp: 1774360620000
              volume: 0.5
            - close: 89.646
              high: 89.775
              low: 89.646
              open: 89.775
              slot: 29572678
              timestamp: 1774360680000
              volume: 0.5
    CandleResponseItem:
      type: object
      required:
        - slot
        - timestamp
        - open
        - high
        - low
        - close
        - volume
      properties:
        close:
          type: number
          format: float
        high:
          type: number
          format: float
        low:
          type: number
          format: float
        open:
          type: number
          format: float
        slot:
          type: integer
          format: int64
          minimum: 0
        timestamp:
          $ref: '#/components/schemas/u64'
        volume:
          type: number
          format: float

````