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

# OHLCV Candlesticks



## OpenAPI

````yaml openapi.json GET /gateway/v1/exchange/klines
openapi: 3.1.0
info:
  title: Hermod
  version: 0.0.1
servers:
  - url: https://api.asksurf.ai
security: []
paths:
  /gateway/v1/exchange/klines:
    get:
      tags:
        - Exchange
      summary: Exchange OHLCV Candlesticks
      description: >-
        Returns OHLCV candlestick data with period summary stats (high, low,
        total volume).


        **Intervals:** 15 options from `1m` to `1M`.


        **Pagination:** use `from` to set the start time and `limit` to control
        candle count. For longer ranges, pass the last returned candle's
        timestamp as the next `from` value. Exchange-side limits vary (200–1000
        per request).


        Set `type=swap` to query perpetual contract candles instead of spot.
      operationId: exchange-klines
      parameters:
        - description: Trading pair (e.g. BTC/USDT)
          explode: false
          in: query
          name: pair
          required: true
          schema:
            description: Trading pair (e.g. BTC/USDT)
            examples:
              - BTC/USDT
            type: string
        - description: 'Market type: spot for spot trading, swap for perpetual contracts'
          explode: false
          in: query
          name: type
          schema:
            default: spot
            description: 'Market type: spot for spot trading, swap for perpetual contracts'
            enum:
              - spot
              - swap
            examples:
              - spot
            type: string
        - description: Candle interval
          explode: false
          in: query
          name: interval
          schema:
            default: 1h
            description: Candle interval
            enum:
              - 1m
              - 3m
              - 5m
              - 15m
              - 30m
              - 1h
              - 2h
              - 4h
              - 6h
              - 8h
              - 12h
              - 1d
              - 3d
              - 1w
              - 1M
            examples:
              - 1h
            type: string
        - description: >-
            Start of time range. Accepts Unix seconds or date string
            (YYYY-MM-DD, ISO8601)
          explode: false
          in: query
          name: from
          schema:
            description: >-
              Start of time range. Accepts Unix seconds or date string
              (YYYY-MM-DD, ISO8601)
            examples:
              - '2026-03-01'
            type: string
        - description: >-
            Max number of candles to return. Exchange may cap lower (e.g.
            200-1000). For longer ranges, paginate using the last returned
            timestamp as the next from value.
          explode: false
          in: query
          name: limit
          schema:
            default: 100
            description: >-
              Max number of candles to return. Exchange may cap lower (e.g.
              200-1000). For longer ranges, paginate using the last returned
              timestamp as the next from value.
            examples:
              - 100
            format: int64
            maximum: 1000
            minimum: 1
            type: integer
        - description: Exchange identifier
          explode: false
          in: query
          name: exchange
          schema:
            default: binance
            description: Exchange identifier
            enum:
              - binance
              - okx
              - bybit
              - bitget
              - coinbase
              - kraken
              - gate
              - htx
              - kucoin
              - mexc
              - upbit
              - bitfinex
              - bitstamp
              - deribit
              - bitmex
              - bithumb
            examples:
              - binance
            type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SimpleListResponseExchangeKlineResponse'
          description: OK
        default:
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DataAPIError'
          description: Error
      security:
        - AccessToken: []
components:
  schemas:
    SimpleListResponseExchangeKlineResponse:
      additionalProperties: false
      properties:
        $schema:
          description: A URL to the JSON Schema for this object.
          examples:
            - >-
              https://example.com/schemas/SimpleListResponseExchangeKlineResponse.json
          format: uri
          readOnly: true
          type: string
        data:
          items:
            $ref: '#/components/schemas/ExchangeKlineResponse'
          type:
            - array
            - 'null'
        meta:
          $ref: '#/components/schemas/ObjectResponseMeta'
      required:
        - data
        - meta
      type: object
    DataAPIError:
      additionalProperties: false
      properties:
        $schema:
          description: A URL to the JSON Schema for this object.
          examples:
            - https://example.com/schemas/DataAPIError.json
          format: uri
          readOnly: true
          type: string
        error:
          $ref: '#/components/schemas/DataAPIErrorDetail'
      required:
        - error
      type: object
    ExchangeKlineResponse:
      additionalProperties: false
      properties:
        candles:
          description: OHLCV candles
          items:
            $ref: '#/components/schemas/ExchangeKlineItem'
          type:
            - array
            - 'null'
        count:
          description: Number of candles
          format: int64
          type: integer
        exchange:
          description: Exchange identifier
          type: string
        interval:
          description: Candle interval
          type: string
        pair:
          description: Trading pair
          type: string
        period_end:
          description: Last candle datetime
          type:
            - string
            - 'null'
        period_high:
          description: Highest price in period
          format: double
          type:
            - number
            - 'null'
        period_low:
          description: Lowest price in period
          format: double
          type:
            - number
            - 'null'
        period_start:
          description: First candle datetime
          type:
            - string
            - 'null'
        period_volume:
          description: Total volume in period
          format: double
          type:
            - number
            - 'null'
      required:
        - exchange
        - pair
        - interval
        - candles
        - count
        - period_high
        - period_low
        - period_volume
        - period_start
        - period_end
      type: object
    ObjectResponseMeta:
      additionalProperties: false
      properties:
        cached:
          description: Whether this response was served from cache
          type: boolean
        credits_used:
          description: Credits deducted for this request
          format: int64
          type: integer
      required:
        - credits_used
        - cached
      type: object
    DataAPIErrorDetail:
      additionalProperties: false
      properties:
        code:
          type: string
        message:
          type: string
      required:
        - code
        - message
      type: object
    ExchangeKlineItem:
      additionalProperties: false
      properties:
        close:
          description: Closing price
          format: double
          type: number
        high:
          description: Highest price during the interval
          format: double
          type: number
        low:
          description: Lowest price during the interval
          format: double
          type: number
        open:
          description: Opening price
          format: double
          type: number
        timestamp:
          description: Candle open time in Unix seconds
          format: int64
          type:
            - integer
            - 'null'
        volume:
          description: Trading volume in base currency units
          format: double
          type: number
      required:
        - timestamp
        - open
        - high
        - low
        - close
        - volume
      type: object

````