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

# Get price candles

> Open, high, low and close prices and volume per interval for each venue leg of the market, oldest first. Prices are for the side the leg buys. A request covers at most 1000 intervals. Pass `venue` to read one venue only.



## OpenAPI

````yaml api-reference/openapi.json GET /markets/{id}/candles
openapi: 3.0.0
info:
  title: Lean API
  version: 0.1.0
  description: >-
    Programmatic access to Lean: canonical sports markets, quotes, orders,
    positions and balances.
servers:
  - url: '{baseUrl}/v1'
    description: Lean API
    variables:
      baseUrl:
        default: https://api.lean.xyz
        description: >-
          The Lean API base URL, without /v1. Same value as LEAN_API_URL in the
          guides.
security:
  - apiKey: []
paths:
  /markets/{id}/candles:
    get:
      tags:
        - Markets
      summary: Get price candles
      description: >-
        Open, high, low and close prices and volume per interval for each venue
        leg of the market, oldest first. Prices are for the side the leg buys. A
        request covers at most 1000 intervals. Pass `venue` to read one venue
        only.
      operationId: getMarketCandles
      parameters:
        - schema:
            type: string
            minLength: 1
            maxLength: 512
            description: >-
              A market id from GET /markets, or a venue symbol that names one
              market: a Polymarket token id, a Hyperliquid book coin (`#…`,
              written `%23…` in a path), or a leg `ticker` (`pm:…`, `hl:…`,
              `pmus:…` or a Kalshi market ticker) that lists only this outcome.
              A symbol that names more than one market, such as a Polymarket
              condition id, is refused with 400; use the token id or the market
              id instead.
            example: >-
              mkt_bmZsOjIwMjYtMTAtMTE6REVOLUxBQwpzcHJlYWQ6Z2FtZTpERU46LTMuNQpERU4
          required: true
          description: >-
            A market id from GET /markets, or a venue symbol that names one
            market: a Polymarket token id, a Hyperliquid book coin (`#…`,
            written `%23…` in a path), or a leg `ticker` (`pm:…`, `hl:…`,
            `pmus:…` or a Kalshi market ticker) that lists only this outcome. A
            symbol that names more than one market, such as a Polymarket
            condition id, is refused with 400; use the token id or the market id
            instead.
          name: id
          in: path
        - schema:
            type: string
            enum:
              - 1s
              - 1m
              - 5m
              - 15m
              - 1h
              - 2h
            default: 1m
            description: Length of each candle.
          required: false
          description: Length of each candle.
          name: interval
          in: query
        - schema:
            type: string
            format: date-time
            description: >-
              First candle at or after this time, rounded down to the interval.
              Defaults to 100 intervals before `end`.
          required: false
          description: >-
            First candle at or after this time, rounded down to the interval.
            Defaults to 100 intervals before `end`.
          name: start
          in: query
        - schema:
            type: string
            format: date-time
            description: Candles that open before this time. Defaults to now.
          required: false
          description: Candles that open before this time. Defaults to now.
          name: end
          in: query
        - schema:
            type: string
            enum:
              - kalshi
              - polymarket
              - polymarket_us
              - hyperliquid
            description: Only this venue leg.
          required: false
          description: Only this venue leg.
          name: venue
          in: query
      responses:
        '200':
          description: Candles for each venue leg, oldest first
          content:
            application/json:
              schema:
                oneOf:
                  - type: object
                    properties:
                      success:
                        type: boolean
                        enum:
                          - true
                      data:
                        type: object
                        properties:
                          market_id:
                            type: string
                            minLength: 1
                          interval:
                            type: string
                            enum:
                              - 1s
                              - 1m
                              - 5m
                              - 15m
                              - 1h
                              - 2h
                          start:
                            type: string
                            format: date-time
                          end:
                            type: string
                            format: date-time
                          legs:
                            type: array
                            items:
                              type: object
                              properties:
                                venue:
                                  type: string
                                  enum:
                                    - kalshi
                                    - polymarket
                                    - polymarket_us
                                    - hyperliquid
                                ticker:
                                  type: string
                                  minLength: 1
                                side:
                                  type: string
                                  enum:
                                    - 'yes'
                                    - 'no'
                                candles:
                                  type: array
                                  items:
                                    type: object
                                    properties:
                                      time:
                                        type: string
                                        format: date-time
                                      open:
                                        type: string
                                      high:
                                        type: string
                                      low:
                                        type: string
                                      close:
                                        type: string
                                      volume:
                                        type: string
                                        pattern: ^\d+(?:\.\d+)?$
                                    required:
                                      - time
                                      - open
                                      - high
                                      - low
                                      - close
                                      - volume
                              required:
                                - venue
                                - ticker
                                - side
                                - candles
                          livemode:
                            type: boolean
                        required:
                          - market_id
                          - interval
                          - start
                          - end
                          - legs
                          - livemode
                      meta:
                        type: object
                        properties:
                          timestampMs:
                            type: integer
                            minimum: 0
                          requestId:
                            type: string
                            minLength: 1
                          traceId:
                            type: string
                            minLength: 1
                          cachedAtMs:
                            type: integer
                            minimum: 0
                          source:
                            type: string
                            enum:
                              - cache
                              - database
                              - clickhouse
                              - upstream
                              - fallback
                              - internal
                        required:
                          - timestampMs
                          - requestId
                    required:
                      - success
                      - data
                      - meta
                  - $ref: '#/components/schemas/ApiError'
              example:
                success: true
                data:
                  market_id: >-
                    mkt_bmZsOjIwMjYtMTAtMTE6REVOLUxBQwpzcHJlYWQ6Z2FtZTpERU46LTMuNQpERU4
                  interval: 5m
                  start: '2026-10-29T17:50:00.000Z'
                  end: '2026-10-29T18:00:00.000Z'
                  legs:
                    - venue: hyperliquid
                      ticker: hl:9999
                      side: 'yes'
                      candles:
                        - time: '2026-10-29T17:50:00.000Z'
                          open: '0.52'
                          high: '0.55'
                          low: '0.51'
                          close: '0.54'
                          volume: '120'
                    - venue: polymarket
                      ticker: >-
                        pm:0x2222222222222222222222222222222222222222222222222222222222222222
                      side: 'yes'
                      candles:
                        - time: '2026-10-29T17:50:00.000Z'
                          open: '0.53'
                          high: '0.55'
                          low: '0.52'
                          close: '0.54'
                          volume: '310.5'
                        - time: '2026-10-29T17:55:00.000Z'
                          open: '0.54'
                          high: '0.56'
                          low: '0.54'
                          close: '0.55'
                          volume: '82'
                  livemode: true
                meta:
                  timestampMs: 1792771200000
                  requestId: 7d2c9f4e-1b3a-4e8d-9c6f-2a5b8e0d4f17
        '400':
          description: Unknown interval, start not before end, or more than 1000 intervals
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
              example:
                success: false
                error:
                  code: VALIDATION_ERROR
                  message: >-
                    Unknown interval, start not before end, or more than 1000
                    intervals
                meta:
                  timestampMs: 1792771200000
                  requestId: 7d2c9f4e-1b3a-4e8d-9c6f-2a5b8e0d4f17
        '401':
          description: Missing, invalid, expired or revoked API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
              example:
                success: false
                error:
                  code: UNAUTHORIZED
                  message: Invalid, expired or revoked API key
                meta:
                  timestampMs: 1792771200000
                  requestId: 7d2c9f4e-1b3a-4e8d-9c6f-2a5b8e0d4f17
        '403':
          description: The key lacks the scope this route needs
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
              example:
                success: false
                error:
                  code: FORBIDDEN
                  message: This API key lacks the scope this route needs
                meta:
                  timestampMs: 1792771200000
                  requestId: 7d2c9f4e-1b3a-4e8d-9c6f-2a5b8e0d4f17
        '404':
          description: No market with this id, or none on the requested venue
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
              example:
                success: false
                error:
                  code: NOT_FOUND
                  message: No market with this id, or none on the requested venue
                meta:
                  timestampMs: 1792771200000
                  requestId: 7d2c9f4e-1b3a-4e8d-9c6f-2a5b8e0d4f17
        '429':
          description: API error
          headers:
            Retry-After:
              description: Seconds remaining in the upstream read cooldown, when available
              schema:
                type: integer
                minimum: 0
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
              example:
                success: false
                error:
                  code: RATE_LIMITED
                  message: Too many requests for this API key
                meta:
                  timestampMs: 1792771200000
                  requestId: 7d2c9f4e-1b3a-4e8d-9c6f-2a5b8e0d4f17
        '500':
          description: API error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
              example:
                success: false
                error:
                  code: INTERNAL_ERROR
                  message: An internal error occurred.
                meta:
                  timestampMs: 1792771200000
                  requestId: 7d2c9f4e-1b3a-4e8d-9c6f-2a5b8e0d4f17
components:
  schemas:
    ApiError:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - false
        error:
          type: object
          properties:
            code:
              type: string
              enum:
                - VALIDATION_ERROR
                - NOT_FOUND
                - UNAUTHORIZED
                - FORBIDDEN
                - CONFLICT
                - UPSTREAM_ERROR
                - RATE_LIMITED
                - INTERNAL_ERROR
                - FEATURE_DISABLED
                - CONDITIONAL_SELL_REJECTED
                - CONDITIONAL_SELL_ACTIVE
            message:
              type: string
              minLength: 1
            details:
              nullable: true
          required:
            - code
            - message
        meta:
          type: object
          properties:
            timestampMs:
              type: integer
              minimum: 0
            requestId:
              type: string
              minLength: 1
            traceId:
              type: string
              minLength: 1
            cachedAtMs:
              type: integer
              minimum: 0
            source:
              type: string
              enum:
                - cache
                - database
                - clickhouse
                - upstream
                - fallback
                - internal
          required:
            - timestampMs
            - requestId
      required:
        - success
        - error
        - meta
  securitySchemes:
    apiKey:
      type: http
      scheme: bearer
      description: >-
        A Lean API key, sent as `Authorization: Bearer <key>`. A test key
        (`lean_sk_test_...`) simulates orders and fills with no money; a live
        key (`lean_sk_live_...`) trades for real within the key's limits. Every
        successful response says which mode answered in `data.livemode`.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.