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

# /binance/klines

> Get historical candlestick (OHLCV) data for a trading pair

**Price:** 1 credit

**💡 AI Hint:** Get native exchange candlestick (OHLCV) data for a Binance spot trading pair (e.g. 'BTCUSDT'). Each candle carries its open time, open/high/low/close prices, base-asset volume, close time, quote-asset volume, number of trades, and taker buy base/quote volumes. The interval ranges from one second to one month. By default the most recent candles are returned; pass start_time and/or end_time (unix milliseconds) to fetch a specific historical range. Candles are ordered oldest to newest.

**⚠️ Common errors:** 412: Trading pair not found or no data in the requested range



## OpenAPI

````yaml /openapi-filtered.json post /api/binance/klines
openapi: 3.1.0
info:
  title: Any Site API
  description: >+
    Any Site API provides programmatic access to data from LinkedIn, Instagram,
    Twitter, and other platforms.


    ## Authentication


    All API endpoints require an `access-token` header with a valid API token.
    Tokens can be created in the [dashboard](https://app.anysite.io/).


    ## Pricing


    Each endpoint has a credit cost listed in its description. Credits are
    deducted from your token balance per request.

  version: 0.0.1
servers: []
security:
  - AccessToken: []
paths:
  /api/binance/klines:
    post:
      tags:
        - /binance
      summary: /binance/klines
      description: >-
        Get historical candlestick (OHLCV) data for a trading pair


        **Price:** 1 credit


        **💡 AI Hint:** Get native exchange candlestick (OHLCV) data for a
        Binance spot trading pair (e.g. 'BTCUSDT'). Each candle carries its open
        time, open/high/low/close prices, base-asset volume, close time,
        quote-asset volume, number of trades, and taker buy base/quote volumes.
        The interval ranges from one second to one month. By default the most
        recent candles are returned; pass start_time and/or end_time (unix
        milliseconds) to fetch a specific historical range. Candles are ordered
        oldest to newest.


        **⚠️ Common errors:** 412: Trading pair not found or no data in the
        requested range
      operationId: __api_binance_klines_post
      parameters:
        - name: access-token
          in: header
          required: true
          schema:
            anyOf:
              - type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BinanceKlinesPayload'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/BinanceKline'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    BinanceKlinesPayload:
      properties:
        timeout:
          type: integer
          maximum: 1500
          minimum: 20
          description: Max scrapping execution timeout (in seconds)
          default: 300
        symbol:
          type: string
          description: Trading pair symbol, uppercase, no separator
          examples:
            - BTCUSDT
            - ETHUSDT
        interval:
          $ref: '#/components/schemas/BinanceKlineInterval'
          description: Candlestick interval
        count:
          type: integer
          minimum: 1
          description: Number of candles to return
        start_time:
          anyOf:
            - type: integer
              minimum: 0
            - type: 'null'
          description: Start of the range, unix milliseconds
        end_time:
          anyOf:
            - type: integer
              minimum: 0
            - type: 'null'
          description: End of the range, unix milliseconds
        time_zone:
          type: string
          description: >-
            Time zone offset for interpreting interval boundaries, e.g. '0',
            '+08:00'
          default: '0'
      type: object
      required:
        - symbol
        - interval
        - count
    BinanceKline:
      properties:
        '@type':
          type: string
          default: BinanceKline
        open_at:
          type: integer
        open:
          type: number
        high:
          type: number
        low:
          type: number
        close:
          type: number
        volume:
          type: number
        close_at:
          type: integer
        quote_volume:
          type: number
        trade_count:
          type: integer
        taker_buy_base_volume:
          type: number
        taker_buy_quote_volume:
          type: number
      type: object
      required:
        - open_at
        - open
        - high
        - low
        - close
        - volume
        - close_at
        - quote_volume
        - trade_count
        - taker_buy_base_volume
        - taker_buy_quote_volume
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
      type: object
    BinanceKlineInterval:
      type: string
      enum:
        - 1s
        - 1m
        - 3m
        - 5m
        - 15m
        - 30m
        - 1h
        - 2h
        - 4h
        - 6h
        - 8h
        - 12h
        - 1d
        - 3d
        - 1w
        - 1M
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
        msg:
          type: string
        type:
          type: string
        input: {}
        ctx:
          type: object
      type: object
      required:
        - loc
        - msg
        - type
  securitySchemes:
    AccessToken:
      type: apiKey
      in: header
      name: access-token
      description: API token from the dashboard

````