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

# Historical candles for a pool

> Returns OHLCV bars for `pair_address` between `start` and `end`. Bars are built from real swap events — see [Swap-event OHLCV](/concepts/swap-event-ohlcv).

**Requires `pair_address`.** Sending `mint`, `pair`, or `protocol` returns 400 with a pointer to /api/v1/pairs.



## OpenAPI

````yaml /api-reference/openapi.json get /api/v1/candles
openapi: 3.1.0
info:
  title: Dexploit API
  version: 1.0.0
  description: Real-time and historical Solana DEX swap and OHLCV data.
servers:
  - url: https://api.dexploit.dev
    description: Production
security:
  - ApiKeyHeader: []
  - BearerAuth: []
  - ApiKeyQuery: []
paths:
  /api/v1/candles:
    get:
      tags:
        - Candles (OHLCV)
      summary: Historical candles for a pool
      description: >-
        Returns OHLCV bars for `pair_address` between `start` and `end`. Bars
        are built from real swap events — see [Swap-event
        OHLCV](/concepts/swap-event-ohlcv).


        **Requires `pair_address`.** Sending `mint`, `pair`, or `protocol`
        returns 400 with a pointer to /api/v1/pairs.
      operationId: listCandles
      parameters:
        - name: pair_address
          in: query
          required: true
          schema:
            type: string
        - name: timeframe
          in: query
          required: true
          schema:
            type: string
            enum:
              - 1s
              - 30s
              - 1m
              - 5m
              - 15m
              - 1h
              - 4h
              - 1d
        - name: start
          in: query
          required: false
          schema:
            type: string
            format: date-time
        - name: end
          in: query
          required: false
          schema:
            type: string
            format: date-time
          description: Defaults to a 30s-aligned 'now'.
        - name: limit
          in: query
          required: false
          schema:
            type: integer
            default: 1000
            minimum: 1
            maximum: 10000
      responses:
        '200':
          description: Array of candles
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - true
                  data:
                    type: array
                    items:
                      $ref: '#/components/schemas/Candle'
        '400':
          description: Missing pair_address or sent legacy mint/pair/protocol
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
              example:
                success: false
                error:
                  code: INVALID_PARAM
                  message: >-
                    use pair_address; see /api/v1/pairs?token_address=X to
                    discover pools
        '401':
          description: Missing or invalid API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
        '404':
          description: Unknown pair_address
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
        '429':
          description: Quota or rate limit exceeded
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
components:
  schemas:
    Candle:
      type: object
      properties:
        timestamp:
          type: string
          format: date-time
          description: Bar open time (UTC).
        pair_address:
          type: string
        token_address:
          type: string
        base_mint:
          type: string
          example: So11111111111111111111111111111111111111112
          description: Base side of the pool — almost always wrapped SOL.
        timeframe:
          type: string
          enum:
            - 1s
            - 30s
            - 1m
            - 5m
            - 15m
            - 1h
            - 4h
            - 1d
        open:
          type: number
          description: SOL per 1 token, decimals-adjusted.
        high:
          type: number
        low:
          type: number
        close:
          type: number
        volume_sol:
          type: integer
          format: int64
          description: '**Lamports**, despite the field name. Divide by 1e9 to get SOL.'
        volume_token:
          type: integer
          format: int64
          description: Token base units. Divide by 10**`quote_decimals` for human-readable.
        trade_count:
          type: integer
        buy_count:
          type: integer
        sell_count:
          type: integer
        unique_traders:
          type: integer
    ErrorEnvelope:
      type: object
      required:
        - success
        - error
      properties:
        success:
          type: boolean
          enum:
            - false
        error:
          type: object
          required:
            - code
            - message
          properties:
            code:
              type: string
              example: INVALID_PARAM
            message:
              type: string
              example: >-
                use pair_address; see /api/v1/pairs?token_address=X to discover
                pools
  securitySchemes:
    ApiKeyHeader:
      type: apiKey
      in: header
      name: X-API-Key
      description: >-
        Preferred for swaps-api endpoints (`/swaps/*`, `/stats/*`, `/trending`,
        `/pool-events`).
    BearerAuth:
      type: http
      scheme: bearer
      description: >-
        Required by the OHLCV endpoints (`/api/v1/*`) and accepted by every
        other endpoint. Send `Authorization: Bearer ohlcv_live_sk_<your_key>`.
    ApiKeyQuery:
      type: apiKey
      in: query
      name: api_key
      description: >-
        Browser-friendly alternative to the Bearer header — accepted by every
        endpoint and required for WebSocket from the browser.

````